Data source: http://edc.occ-data.org/nexrad/mosaic/#data-updates
- Using 'MRMS_PrecipRate_00.00_20010101-120000.grib2' which is the first file in the 2001 dataset
Problem: The 'PrecipRate' attribute I know to be in the grib file is unrecognized. The data are there but I'd like to preserve the metadata in the xarray dataset.
import xarray as xr
ds = xr.open_dataset('MRMS_PrecipRate_00.00_20010101-120000.grib2', engine = 'cfgrib')
print(ds)
<xarray.Dataset>
Dimensions: (latitude: 3500, longitude: 7000)
Coordinates:
time datetime64[ns] 2001-01-01T12:00:00
step timedelta64[ns] 00:00:00
surface float64 0.0
* latitude (latitude) float64 54.99 54.98 54.98 54.97 ... 20.03 20.02 20.01
* longitude (longitude) float64 230.0 230.0 230.0 ... 300.0 300.0 300.0
valid_time datetime64[ns] 2001-01-01T12:00:00
Data variables:
unknown (latitude, longitude) float32 ...
Attributes:
GRIB_edition: 2
GRIB_centre: 161
GRIB_centreDescription: 161
GRIB_subCentre: 0
Conventions: CF-1.7
institution: 161
history: 2021-05-04T13:11 GRIB to CDM+CF via cfgrib-0.9.9...
This is a common failure working with grib data. Extract grib data requires grib tables. In these tables the parameter identifier are explained and mapped to their names.
So what you have to do, is get in contact with the publisher/provider of the grib files and ask for the corresponding grib tables. I guess pygrib uses public ncep grib tables.
Additionally I recommend to use xarray in combination with cfgrib. It based on the powerful ECCODES Library by ECMWF. Here you have to set an additional
ECCODES_DEFINTION_PATH
to where the grib tables stored. Maybe eccodes contains the right grib tables by default. Otherwise get in contact with the grib file provider.