Open Chrismarsh opened 3 years ago
Doing a grib_dump on the product definition section of that file, I see:
% grib_dump -O -p section_4 CMC_hrdps_west_ALBDO_SFC_0_ps2.5km_2021021600_P000-00.grib2
====================== SECTION_4 ( length=34, padding=0 ) ======================
1-4 section4Length = 34
5 numberOfSection = 4
6-7 NV = 0
8-9 productDefinitionTemplateNumber = 0 [Analysis or forecast at a horizontal level or in a horizontal layer at a point in time (grib2/tables/4/4.0.table) ]
10 parameterCategory = 19 [Physical atmospheric properties (grib2/tables/4/4.1.0.table) ]
11 parameterNumber = 1 [Albedo (%) (grib2/tables/4/4.2.0.19.table) ]
12 typeOfGeneratingProcess = 2 [Forecast (grib2/tables/4/4.3.table) ]
13 backgroundProcess = 50
14 generatingProcessIdentifier = 50
15-16 hoursAfterDataCutoff = 0
17 minutesAfterDataCutoff = 0
18 indicatorOfUnitOfTimeRange = 0 [Minute (grib2/tables/4/4.4.table) ]
19-22 forecastTime = 0
23 typeOfFirstFixedSurface = 1 [Ground or water surface (grib2/tables/4/4.5.table) ]
24 scaleFactorOfFirstFixedSurface = MISSING
25-28 scaledValueOfFirstFixedSurface = MISSING
29 typeOfSecondFixedSurface = 255 [Missing (grib2/tables/4/4.5.table) ]
30 scaleFactorOfSecondFixedSurface = MISSING
31-34 scaledValueOfSecondFixedSurface = MISSING
So the key that tells you the forecast time units is "indicatorOfUnitOfTimeRange" (0 means minute)
Thanks, that helps!
Is it possible to load all these attributes into the xarray .attrs
?
Broadly related to #89.
I'm noticing that various attributes are missing when I read in an Environment Canada grib file. The
backend_kwargs
arg approach is non optimal as it requires knowing the attributes before reading the file, making data exploration difficult.However, my specific problem is that setting
backend_kwargs
with the known attribute does not seem to work as expected. In the following example I expectforecast_time_units
to be present.Datafile: CMC_hrdps_west_ALBDO_SFC_0_ps2.5km_2021021600_P000-00.grib2 (I am linking to the folder as the daily forecasts are deleted daily).
If I use (the now EOL)
pynio
loader (note that pynio loads the data asALBDO_P0_L1_GST0
whereascgrid
loads asal
)I am unsure if I am doing something wrong or if there is a bug in the loader? I would also like to reiterate that being able to load all the attributes from the grib file without knowing a priori their names would be helpful!