### Clone WeatherBench 2 Repository Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/index.md Clone the GitHub repository to get started with WeatherBench 2. This is the initial step for setting up the project locally. ```bash git clone git@github.com:google-research/weatherbench2.git ``` -------------------------------- ### Slice dataset execution example Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/command-line-scripts.md Example command to run slice_dataset.py with specific selection and indexing criteria. ```bash python slice_dataset.py -- \ --input_path=gs://weatherbench2/datasets/ens/2018-64x32_equiangular_with_poles_conservative.zarr \ --output_path=PATH \ --sel="prediction_timedelta_stop=15 days,latitude_start=-33.33,latitude_stop=33.33" \ --isel="longitude_start=0,longitude_stop=180,longitude_step=40" \ --keep_variables=geopotential,temperature ``` -------------------------------- ### Install WeatherBench 2 Package Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/index.md Install the WeatherBench 2 package using pip after cloning the repository. This command installs the package in the current environment. ```bash cd weatherbench2 pip install . ``` -------------------------------- ### Compute averages execution example Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/command-line-scripts.md Example command to run compute_averages.py using DataflowRunner. ```bash python compute_averages.py \ --input_path=gs://weatherbench2/datasets/era5/1959-2022-6h-64x32_equiangular_with_poles_conservative.zarr \ --output_path=gs://$BUCKET/datasets/era5/$USER/temperature-vertical-profile.zarr \ --runner=DataflowRunner \ -- \ --project=$PROJECT \ --averaging_dims=time,longitude \ --variables=temperature \ --temp_location=gs://$BUCKET/tmp/ \ --setup_file=./setup.py \ --requirements_file=./scripts/dataflow-requirements.txt \ --job_name=compute-vertical-profile-$USER ``` -------------------------------- ### Install WeatherBench2 in editable mode Source: https://github.com/google-research/weatherbench2/blob/main/docs/contributing.md Installs the project and its test dependencies in editable mode for local development. ```shell pip install -e ".[tests]" ``` -------------------------------- ### Display Help for Evaluate Script Source: https://github.com/google-research/weatherbench2/blob/main/scripts/README.md Use the `--help` flag to see how to invoke the `evaluate.py` pipeline with examples. This is applicable to all core pipelines. ```shell python3 evaluate.py --help ``` -------------------------------- ### Example: Compute Derived Variables Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/command-line-scripts.md An example command to run the derived variables computation script. It specifies input and output paths, rechunking parameters, and options for renaming total precipitation variables. ```bash python compute_derived_variables.py \ --input_path=gs://weatherbench2/datasets/hres/2016-2022-12h-6h-0p25deg-chunk-1.zarr/ \ --output_path=PATH \ --working_chunks=prediction_timedelta=-1 \ --rename_raw_tp_name=True \ --raw_tp_name=total_precipitation_6hr \ --rechunk_itemsize=1 \ ``` -------------------------------- ### Install WeatherBench 2 Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/evaluation.ipynb Install the WeatherBench 2 package from GitHub. Pip might show a warning about the Pandas version, but the notebook should still function correctly. ```python # Pip might complain about the Pandas version. The notebook should still work as expected. !pip install git+https://github.com/google-research/weatherbench2.git ``` -------------------------------- ### Install WeatherBench 2 for Development Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/index.md Install the WeatherBench 2 package in editable mode for active development. This allows changes to the code to be reflected immediately without reinstallation. ```bash pip install -e . ``` -------------------------------- ### Example: Compute Zonal Energy Spectra Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/command-line-scripts.md An example command to compute zonal energy spectra. It sets the input and output paths, specifies a time range, and lists the base variables for which to compute spectra. ```bash python compute_zonal_energy_spectrum.py \ --input_path=gs://weatherbench2/datasets/era5/1959-2022-6h-240x121_equiangular_with_poles_conservative.zarr \ --output_path=PATH \ --time_start=2020 \ --time_stop=2020 \ --base_variables=geopotential,specific_humidity,temperature,u_component_of_wind,v_component_of_wind,wind_speed,10m_u_component_of_wind,10m_v_component_of_wind,10m_wind_speed,2m_temperature,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr ``` -------------------------------- ### Install GCP Requirements for WeatherBench 2 Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/index.md Install the additional requirements for WeatherBench 2 if you plan to launch jobs on Google Cloud Platform (GCP). This includes dependencies for GCP services like DataFlow. ```bash pip install .[gcp] ``` -------------------------------- ### Dataflow Execution with Beam DataflowRunner Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/beam-in-the-cloud.md Run on Google Cloud Dataflow using the DataflowRunner. Ensure GCP requirements are installed and specify project, region, and temporary storage. ```bash python scripts/evaluate.py \ --forecast_path=gs://weatherbench2/datasets/hres/2016-2022-0012-64x32_equiangular_with_poles_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-64x32_equiangular_with_poles_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_64x32_equiangular_with_poles_conservative.zarr \ --output_dir=gs://$BUCKET \ --output_file_prefix=hres_vs_era_2020_ \ --by_init=True \ --input_chunks=init_time=10 \ --eval_configs=deterministic \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential \ --use_beam=True \ --runner=DataflowRunner \ -- \ --project $PROJECT \ --region $REGION \ --temp_location gs://$BUCKET/tmp/ \ --setup_file=./setup.py ``` -------------------------------- ### Evaluate SphericalCNN Forecasts Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Evaluates SphericalCNN model forecasts against ERA5 reanalysis for 2020. This example specifies the forecast path for SphericalCNN data and uses standard evaluation configurations. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/sphericalcnn/2020-240x121_equiangular_with_poles_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-240x121_equiangular_with_poles_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_240x121_equiangular_with_poles_conservative.zarr \ --output_dir=$OUTDIR/240x121/deterministic/ \ --output_file_prefix=sphericalcnn_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=10 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity \ --derived_variables=wind_speed \ --add_land_region=False \ --use_beam=True ``` -------------------------------- ### Open FuXi Zarr Dataset Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/data-guide.ipynb Opens a FuXi model dataset from a Google Cloud Storage path using xarray. This dataset contains forecasts for 2020. Ensure you have the necessary authentication and xarray installed. ```python xr.open_zarr('gs://weatherbench2/datasets/fuxi/2020-1440x721.zarr') ``` -------------------------------- ### Read METAR Parquet Data with Pandas Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/data-guide.ipynb Demonstrates how to open and inspect a single Parquet file containing METAR data using the pandas library. Ensure pandas is installed and you have access to the specified GCS path. ```python import pandas as pd # Opening a single partition pd.read_parquet( 'gs://weatherbench2/datasets/metar/metar-timeNominal-by-month/year=2020/month=1/2020-01.parquet' ).head() ``` -------------------------------- ### Evaluate Pangu-HRES-Init vs Analysis Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Evaluates the Pangu-HRES-Init model against analysis data for the year 2020. This configuration disables persistence evaluation and uses Apache Beam. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/pangu_hres_init/2020_0012_64x32_equiangular_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/hres_t0/2016-2022-6h-64x32_equiangular_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_64x32_equiangular_conservative.zarr \ --output_dir=$OUTDIR/64x32/deterministic/ \ --output_file_prefix=pangu_hres_init_vs_analysis_2020_ \ --input_chunks=init_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure \ --add_land_region=False \ --use_beam=True ``` -------------------------------- ### Evaluate Pangu-HRES Init vs Analysis Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Evaluates the Pangu-HRES init model against analysis data for 2020. This configuration uses a land surface model dataset and disables climatology/persistence evaluations. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/pangu_hres_init/2020_0012_240x121_equiangular_with_poles_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/hres_t0/2016-2022-6h-240x121_equiangular_with_poles_conservative.zarr \ --lsm_dataset=gs://weatherbench2/datasets/era5/1959-2022-6h-240x121_equiangular_with_poles_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_240x121_equiangular_with_poles_conservative.zarr \ --output_dir=$OUTDIR/240x121/deterministic/ \ --output_file_prefix=pangu_hres_init_vs_analysis_2020_ \ --input_chunks=init_time=1,lead_time=10 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure \ --add_land_region=False \ --use_beam=True ``` -------------------------------- ### Evaluate Pangu-HRES-Init Model vs Analysis Data Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Evaluates the Pangu-HRES-Init model against analysis data (HRES T0) for the year 2020. This command uses a different observation dataset path. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/pangu_hres_init/2020_0012_0p25.zarr \ --obs_path=gs://weatherbench2/datasets/hres_t0/2016-2022-6h-1440x721.zarr \ --lsm_dataset=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/deterministic/ \ --output_file_prefix=pangu_hres_init_vs_analysis_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure \ --add_land_region=False \ --use_beam=True ``` -------------------------------- ### Open Spherical CNN Zarr Dataset Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/data-guide.ipynb Opens a Spherical CNN dataset from a Google Cloud Storage path using xarray. Ensure you have the necessary authentication and xarray installed. ```python xr.open_zarr( 'gs://weatherbench2/datasets/sphericalcnn/2020-240x121_equiangular_with_poles.zarr' ) ``` -------------------------------- ### Evaluate Pangu-HRES-Init vs ERA5 Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Evaluates the Pangu-HRES-Init model against ERA5 observations for the year 2020. This configuration disables persistence evaluation and uses Apache Beam. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/pangu/pangu_hres_init/2020_0012_64x32_equiangular_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-64x32_equiangular_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_64x32_equiangular_conservative.zarr \ --output_dir=$OUTDIR/64x32/deterministic/ \ --output_file_prefix=pangu_hres_init_vs_era_2020_ \ --input_chunks=init_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure \ --add_land_region=False \ --use_beam=True ``` -------------------------------- ### Import Libraries for WeatherBench 2 Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/evaluation.ipynb Import necessary libraries for WeatherBench 2, including apache_beam and xarray. Apache Beam needs to be imported separately to prevent a TypingError. ```python import apache_beam # Needs to be imported separately to avoid TypingError import weatherbench2 import xarray as xr ``` -------------------------------- ### Open GraphCast Operational Zarr Dataset Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/data-guide.ipynb Use this snippet to open a GraphCast operational forecast dataset stored in Zarr format from a Google Cloud Storage path. Ensure you have the xarray library installed. ```python xr.open_zarr( 'gs://weatherbench2/datasets/graphcast_hres_init/2020/date_range_2019-11-16_2021-02-01_12_hours_derived.zarr' ) ``` -------------------------------- ### Evaluate Pangu-HRES-Init Model vs ERA5 Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Evaluates the Pangu-HRES-Init model against ERA5 data for the year 2020. This configuration also disables persistence evaluation. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/pangu_hres_init/2020_0012_0p25.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/deterministic/ \ --output_file_prefix=pangu_hres_init_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure \ --add_land_region=False \ --use_beam=True ``` -------------------------------- ### Define input dataset paths Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/evaluation.ipynb Set the Google Cloud Storage paths for forecast, observation, and climatology Zarr datasets. ```python forecast_path = 'gs://weatherbench2/datasets/hres/2016-2022-0012-64x32_equiangular_conservative.zarr' obs_path = 'gs://weatherbench2/datasets/era5/1959-2022-6h-64x32_equiangular_conservative.zarr' climatology_path = 'gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_64x32_equiangular_conservative.zarr' ``` -------------------------------- ### Open IFS HRES t=0 Zarr Archive Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/data-guide.ipynb Opens a Zarr archive containing IFS HRES t=0 analysis data. This is used as ground truth for forecast evaluation. Ensure you have the xarray library installed. ```python xr.open_zarr('gs://weatherbench2/datasets/hres_t0/2016-2022-6h-1440x721.zarr') ``` -------------------------------- ### Run Probabilistic Evaluation at 1440x721 Resolution Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Executes probabilistic evaluation scripts for weather datasets. Requires setting the OUTDIR environment variable before execution. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/ens/2018-2022-1440x721.zarr \ --obs_path=gs://weatherbench2/datasets/hres_t0/2016-2022-6h-1440x721.zarr \ --lsm_dataset=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/probabilistic/ \ --output_file_prefix=ens_vs_analysis_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=probabilistic \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,10m_wind_speed,wind_speed \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/ens/2018-2022-1440x721.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/probabilistic/ \ --output_file_prefix=ens_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=probabilistic \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr,10m_wind_speed,wind_speed \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/ens/2018-2022-1440x721.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/probabilistic/ \ --output_file_prefix=climatology_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=probabilistic \ --evaluate_probabilistic_climatology=True \ --probabilistic_climatology_start_year=1990 \ --probabilistic_climatology_end_year=2019 \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr,10m_wind_speed,wind_speed \ --use_beam=True ``` -------------------------------- ### Evaluate Pangu-HRES Init vs ERA5 Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Evaluates the Pangu-HRES init model against ERA5 data for 2020. This script disables climatology and persistence evaluations and land region calculations. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/pangu_hres_init/2020_0012_240x121_equiangular_with_poles_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-240x121_equiangular_with_poles_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_240x121_equiangular_with_poles_conservative.zarr \ --output_dir=$OUTDIR/240x121/deterministic/ \ --output_file_prefix=pangu_hres_init_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=10 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure \ --add_land_region=False \ --use_beam=True ``` -------------------------------- ### Compute Zonal Energy Spectrum for Keisler Dataset Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Use this script to compute the zonal energy spectrum for the Keisler dataset. Specify the input Zarr path, output directory, and time range. This example uses a different spatial resolution (360x181). ```bash python compute_zonal_energy_spectrum.py -- \ --input_path=gs://weatherbench2/datasets/keisler/2020-360x181.zarr \ --output_path=$OUTDIR/highest_res/spectra/keisler_2020.zarr \ --time_start=2020 \ --time_stop=2020 \ --base_variables=geopotential,specific_humidity,temperature,u_component_of_wind,v_component_of_wind,wind_speed \ ``` -------------------------------- ### List Dataflow User Metrics Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/beam-in-the-cloud.md Use the beta gcloud CLI commands to list user metrics for a specific Dataflow job. ```shell JOBID= gcloud beta dataflow metrics list $JOBID --source=user ``` -------------------------------- ### Run Probabilistic Evaluation Commands Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md Execute evaluation scripts using the evaluate.py entry point with specific dataset paths, time ranges, and evaluation configurations. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/ens/2018-2022-64x32_equiangular_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/hres_t0/2016-2022-6h-64x32_equiangular_conservative.zarr \ --lsm_dataset=gs://weatherbench2/datasets/era5/1959-2022-6h-64x32_equiangular_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_64x32_equiangular_conservative.zarr \ --output_dir=$OUTDIR/64x32/probabilistic/ \ --output_file_prefix=ens_vs_analysis_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=probabilistic \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,10m_wind_speed,wind_speed \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/ens/2018-2022-64x32_equiangular_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-64x32_equiangular_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_64x32_equiangular_conservative.zarr \ --output_dir=$OUTDIR/64x32/probabilistic/ \ --output_file_prefix=ens_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=probabilistic \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr,10m_wind_speed,wind_speed \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/ens/2018-2022-64x32_equiangular_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-64x32_equiangular_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_64x32_equiangular_conservative.zarr \ --output_dir=$OUTDIR/64x32/probabilistic/ \ --output_file_prefix=climatology_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=probabilistic \ --evaluate_probabilistic_climatology=True \ --probabilistic_climatology_start_year=1990 \ --probabilistic_climatology_end_year=2019 \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr,10m_wind_speed,wind_speed \ --use_beam=True ``` -------------------------------- ### Evaluate Forecasts with WeatherBench2 Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/command-line-scripts.md Use this script to evaluate forecast data against observations. Specify input dataset paths, output directory, and evaluation configurations. ```bash python evaluate.py \ --forecast_path=gs://weatherbench2/datasets/hres/2016-2022-0012-64x32_equiangular_with_poles_conservative.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-64x32_equiangular_with_poles_conservative.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_64x32_equiangular_with_poles_conservative.zarr \ --output_dir=./ \ --output_file_prefix=hres_vs_era_2020_ \ --input_chunks=init_time=1 \ --eval_configs=deterministic,deterministic_spatial,deterministic_temporal \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr,10m_wind_speed,wind_speed ``` -------------------------------- ### Import Evaluation Functions Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/evaluation.ipynb Import necessary functions for running evaluations, either in-memory or via Apache Beam. ```python from weatherbench2.evaluation import evaluate_in_memory, evaluate_with_beam ``` -------------------------------- ### Evaluate Weather Forecasts with WeatherBench2 Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/official-evaluation.md These commands execute the evaluation pipeline for different forecast models against ERA5 or analysis data. Ensure the OUTDIR environment variable is set before running. ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/hres/2016-2022-0012-1440x721.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/deterministic/ \ --output_file_prefix=hres_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr,10m_wind_speed,wind_speed \ --compute_seeps=True \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/hres/2016-2022-0012-1440x721.zarr \ --obs_path=gs://weatherbench2/datasets/hres_t0/2016-2022-6h-1440x721.zarr \ --lsm_dataset=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/deterministic/ \ --output_file_prefix=hres_vs_analysis_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,10m_wind_speed,wind_speed \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/ens/2018-2022-1440x721_mean.zarr/ \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/deterministic/ \ --output_file_prefix=ens_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr,10m_wind_speed,wind_speed \ --compute_seeps=True \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/ens/2018-2022-1440x721_mean.zarr/ \ --obs_path=gs://weatherbench2/datasets/hres_t0/2016-2022-6h-1440x721.zarr \ --lsm_dataset=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/deterministic/ \ --output_file_prefix=ens_vs_analysis_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=False \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,10m_wind_speed,wind_speed \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/hres/2016-2022-0012-1440x721.zarr \ --obs_path=gs://weatherbench2/datasets/era5/1959-2022-6h-1440x721.zarr \ --climatology_path=gs://weatherbench2/datasets/era5-hourly-climatology/1990-2019_6h_1440x721.zarr \ --output_dir=$OUTDIR/1440x721/deterministic/ \ --output_file_prefix=climatology_vs_era_2020_ \ --input_chunks=init_time=1,lead_time=1 \ --fanout=27 \ --regions=all \ --eval_configs=deterministic,deterministic_temporal \ --evaluate_climatology=True \ --evaluate_persistence=False \ --time_start=2020-01-01 \ --time_stop=2020-12-31 \ --variables=geopotential,temperature,u_component_of_wind,v_component_of_wind,specific_humidity,2m_temperature,10m_u_component_of_wind,10m_v_component_of_wind,mean_sea_level_pressure,total_precipitation_6hr,total_precipitation_24hr,10m_wind_speed,wind_speed \ --compute_seeps=True \ --use_beam=True ``` ```bash python evaluate.py -- \ --forecast_path=gs://weatherbench2/datasets/hres/2016-2022-0012-1440x721.zarr ``` -------------------------------- ### Import WeatherBench2 Configuration Module Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/evaluation.ipynb Imports the necessary configuration module from the weatherbench2 library. This is a prerequisite for defining configurations. ```python from weatherbench2 import config ``` -------------------------------- ### Open Pangu-Weather Dataset Source: https://github.com/google-research/weatherbench2/blob/main/docs/source/data-guide.ipynb Opens the Pangu-Weather forecast dataset from Google Cloud Storage using xarray. This dataset includes various meteorological variables. ```python xr.open_zarr('gs://weatherbench2/datasets/pangu/2018-2022_0012_0p25.zarr') ```