Repository navigation
feat(people-and-planet-ai): Modernize the weather-forecasting sample - #14764
Conversation
|
Here is the summary of changes. You are about to add 4 region tags.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Code Review
This pull request modernizes the weather forecasting sample by replacing the custom PyTorch FCN model with a pipeline that integrates Google Earth Engine, BigQuery ML (TimesFM 2.5), Google DeepMind's WeatherNext 3, and Gemini 3.8 Flash for multimodal storm risk nowcasting. The changes include new scripts for data ingestion, time-series loading via Apache Beam, zero-shot forecasting, multimodal analysis, and visualization, alongside updated documentation and comprehensive tests. Feedback on the changes highlights a critical issue in fetch_weather_patch.py where raw netCDF scale factors and offsets are incorrectly applied to already-calibrated GOES thermal IR bands, which would corrupt downstream calculations and visualizations.
e6954b8 to
a273ad8
Compare
e6864d4 to
a1cc3b5
Compare
… Earth Engine, Apache Beam, BigQuery ML AI.FORECAST, and Gemini 3.8 Flash Problem: The legacy people-and-planet-ai/weather-forecasting sample spanned 45 files across four separate notebooks, four duplicate test harnesses, and a custom PyTorch/HuggingFace Cloud Run serving container with checked-in model weights (serving/model/pytorch_model.bin). It relied on the deprecated NASA/GPM_L3/IMERG_V06 Earth Engine collection, hardcoded NOAA/GOES/16/MCMIPF (which ceased operation in April 2025 in favor of GOES-19), used legacy Vertex AI custom training and gcloud AI Platform commands, and included an outdated user feedback form. Solution: - Consolidate the multi-notebook workflow into a single end-to-end tutorial notebook (README.ipynb) orchestrating standalone, single-task Python modules aligned with JoTa task_rules.yaml and DevSite Dataflow Python ML references. - Add fetch_weather_patch.py to query calibrated half-hourly precipitation from NASA GPM IMERG V07 (NASA/GPM_L3/IMERG_V07), cloud-top brightness and moisture bands from NOAA GOES-19 (NOAA/GOES/19/MCMIPF) and GOES-16 (NOAA/GOES/16/MCMIPF), and terrain elevation from MERIT DEM (MERIT/DEM/v1_0_3), featuring Hurricane Melissa (Oct 2025, Jamaica) and Hurricane Helene (Sept 2024, Southern Appalachians) case studies. - Add load_weather_time_series.py (dataflow_weather_load_time_series) to transform and load hourly satellite observations into BigQuery using Apache Beam. - Add forecast_precipitation.py (bigquery_weather_forecast_precipitation) for zero-shot multi-hour precipitation nowcasting using BigQuery ML AI.FORECAST with TimesFM 2.5. - Add analyze_storm_risk.py (googlegenaisdk_weather_analyze_storm_risk) for structured multimodal flood-risk synthesis combining multi-sensor satellite composites and forecasted precipitation curves using the Google Gen AI SDK (gemini-3.8-flash on global). - Document scaling to global medium-range ensemble forecasts using Google DeepMind WeatherNext 3 in Earth Engine and BigQuery. - Remove legacy notebooks, serving scaffolding, binary weights, static PNGs, and outdated feedback forms, and add fast offline unit tests in test_weather_forecasting.py.
a1cc3b5 to
7d17195
Compare
…er-forecasting Problem: Review of PR #14764 identified several polish and correctness issues in people-and-planet-ai/weather-forecasting: - Several unittest.mock.patch.object calls in test_weather_forecasting.py lacked autospec=True, masking that fetch_weather_patch.py passed the legacy opt_url keyword argument to ee.Initialize instead of url. - visualize.py replaced its original 2023 copyright year with 2026 and included an unnecessary shebang for a non-CLI library module. - Error messages in load_weather_time_series.py (and forecast_precipitation.py) omitted dataset_id alongside table_id. - README.ipynb configured PROJECT_ID via gcloud before authenticating in Google Colab, and the cleanup cell only removed gs://{BUCKET_NAME}/temp without cleaning up a newly created staging bucket. Solution: - Add autospec=True to all patch.object calls in test_weather_forecasting.py, add test_load_weather_time_series_error, and update ee.Initialize calls in fetch_weather_patch.py from opt_url= to url=. - Restore '# Copyright 2023 Google LLC' and remove the unused shebang in visualize.py. - Include dataset_id ('{dataset_id}.{table_id}') in stderr diagnostics for both load_weather_time_series.py and forecast_precipitation.py while continuing to omit project_id. - Reorder README.ipynb so Colab authentication runs before project configuration, track CREATED_BUCKET when creating the staging bucket, and remove the full bucket on cleanup only when created during the notebook run.
Description
Replaces the
people-and-planet-ai/weather-forecastingsample with an end-to-end storm nowcasting tutorial built on current Google Cloud services. The previous sample trained and served a custom PyTorch model, which needed a separate serving container and a multi-notebook flow.The new sample shows how to combine:
AI.FORECAST(TimesFM 2.5);README.ipynbcovers a historical hurricane hindcast (Hurricane Melissa, Steps 1–5) and a live Bay Area microclimate forecast (Step 6). Each step is a standalone script with its own region tag, so the documentation can include them individually.Notable decisions
scripts/notebook-setuphelper (chore(scripts): add reusable notebook_setup sparse-checkout helper #14768) instead of its own clone and install logic. The notebook runs the same way in Colab, in Colab Enterprise, and in a local checkout of the repository.noxfile_config.pytests on Python 3.12, the repository's minimum supported version.serving/,notebooks/,tests/,images/andcreate_dataset.pyfrom the old sample are deleted. The Weather forecasting entry inpeople-and-planet-ai/README.mdnow points to the new notebook and describes the new sample.Dependency notes
pillowis pinned to 12.3.0 because apache-beam 2.77.0 requirespillow<13. The fixed 13.x line will be adopted once apache-beam 2.78.0 is released.earthengine-api,google-genaiandnumpyare also held below their latest releases for compatibility withapache-beam[gcp]2.77.0. Each pin is annotated inrequirements.txt.Trying the notebook before merge
The launch badges point at
main, so they won't work until this PR merges. To try it now, open the notebook from this PR's head commit:Then, in the setup cell, set
BRANCH = "feat/modernize-ppai-weather-forecasting"before running it.Checklist
Testing
Compliance & Style
Post-Approval Actions