google-research / weatherbench2

A benchmark for the next generation of data-driven global weather models.
https://weatherbench2.readthedocs.io
Apache License 2.0
401 stars 40 forks source link

Downloading data for one selected pressure level. #149

Open ChenyuDongNUS opened 4 months ago

ChenyuDongNUS commented 4 months ago

When I want to download data for one selected pressure level (full resolution), e.g. 850hPa uwind. If I download the data in directory: _weatherbench2/datasets/era5/1959-2022-full_37-1h-0p25deg-chunk-1.zarr-v2/u_component_ofwind However, accessing this data results in downloading approximately 200 TB, which includes uwind data across 37 pressure levels. Is there a way to download data for only selected pressure levels? I apologize if this question seems trivial, and I appreciate any comment/guidance. Thank you!

SadeghTabas-NOAA commented 4 months ago

@ChenyuDongNUS Please see below:

import xarray as xr
ds = xr.open_zarr('gs://weatherbench2/datasets/era5/1959-2023_01_10-wb13-6h-1440x721_with_derived_variables.zarr')
u_wind_850 = ds['u_component_of_wind'].sel(level=850)
u_wind_850.to_netcdf('your/save/directory.nc')
# or to save in zarr:
# u_wind_850.to_zarr('your/save/directory.zarr', mode='w')