import xarray as xr
import fsspec
fs = fsspec.filesystem('s3', anon=True)
url = 's3://noaa-hrrr-bdp-pds/hrrr.20210902/conus/hrrr.t12z.wrfsfcf01.grib2'
_ = fs.download(url, 'test.grib2')
ds = xr.open_dataset('test.grib2', engine='cfgrib',
backend_kwargs={'filter_by_keys': {'typeOfLevel': 'heightAboveGround', 'level': 2}})
Ignoring index file 'test.grib2.9810b.idx' older than GRIB file
ds.data_vars
Data variables: unknown (y, x) float32 ... t2m (y, x) float32 ... pt (y, x) float32 ... sh2 (y, x) float32 ... d2m (y, x) float32 ... r2 (y, x) float32 ...
ds1 = xr.open_dataset('test.grib2', engine='cfgrib',
backend_kwargs={'filter_by_keys': {'typeOfLevel': 'heightAboveGround', 'level': 10}})
ds1.data_vars
Ignoring index file 'test.grib2.9810b.idx' older than GRIB file
Data variables: u10 (y, x) float32 ... v10 (y, x) float32 ... si10 (y, x) float32 ... unknown (y, x) float32 ...