-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get additional attributes from grib file #89
Comments
@enyfeo I'm surprised that this feature had not been requested earlier :) The reason I didn't implement a way to access the other keys yet is that I couldn't come up with a reasonable API and I fear the implementation would make the I agree this is an important new feature. |
@enyfeo and @EddyCMWF in branch >>> ds = xr.open_dataset('seas5.grib', engine='cfgrib', backend_kwargs={'read_keys':['systemNumber']})
>>> ds.mx2t24
<xarray.DataArray 'mx2t24' (time: 2, step: 3, latitude: 61, longitude: 120)>
dask.array<shape=(2, 3, 61, 120), dtype=float32, chunksize=(2, 3, 61, 120)>
Coordinates:
number int64 ...
* time (time) datetime64[ns] 2018-04-01 2018-05-01
* step (step) timedelta64[ns] 30 days 31 days 61 days
surface int64 ...
* latitude (latitude) float64 90.0 87.0 84.0 81.0 ... -84.0 -87.0 -90.0
* longitude (longitude) float64 0.0 3.0 6.0 9.0 ... 348.0 351.0 354.0 357.0
valid_time (time, step) datetime64[ns] dask.array<shape=(2, 3), chunksize=(2, 3)>
Attributes:
GRIB_paramId: 51
GRIB_shortName: mx2t24
...
GRIB_systemNumber: 5
long_name: Maximum temperature at 2 metres...
units: K Note that the feature is experimental. |
Hi, Looks great, |
I released version 0.9.7.2 with the feature. |
I have just tried this one with both
Do you have any suggestion on what I might be doing wrong? |
@edupenabad additional keys are added to the variable attrs, not to the global ones, check out the attrs of |
Hi Eduardo,
I did try this and saw it working.
If I recall correctly the systemNumber would show if you look at the
variable.
So try ds.t2m
…On Fri, 15 Nov 2019 at 18:02, Eduardo Penabad Ramos < ***@***.***> wrote:
I have just tried this one with both 0.9.7.2 and 0.9.7.3 and I haven't
managed to get the systemNumber keyword value:
In [3]: ds=xr.open_dataset('seas5_t2m_6h.grib',engine='cfgrib',backend_kwargs={'read_keys':['systemNumber']})
In [4]: ds
Out[4]:
<xarray.Dataset>
Dimensions: (latitude: 181, longitude: 360, step: 16, time: 2)
Coordinates:
number int64 ...
* time (time) datetime64[ns] 2019-10-01 2019-11-01
* step (step) timedelta64[ns] 0 days 06:00:00 ... 4 days 00:00:00
surface int64 ...
* latitude (latitude) float64 90.0 89.0 88.0 87.0 ... -88.0 -89.0 -90.0
* longitude (longitude) float64 0.0 1.0 2.0 3.0 ... 356.0 357.0 358.0 359.0
valid_time (time, step) datetime64[ns] ...
Data variables:
t2m (time, step, latitude, longitude) float32 ...
Attributes:
GRIB_edition: 1
GRIB_centre: ecmf
GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts
GRIB_subCentre: 0
Conventions: CF-1.7
institution: European Centre for Medium-Range Weather Forecasts
history: 2019-11-15T17:55:12 GRIB to CDM+CF via cfgrib-0....
In [5]: xr.__version__
Out[5]: '0.14.0'
In [6]: cfgrib.__version__
Out[6]: '0.9.7.2'
Do you have any suggestion on what I might be doing wrong?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AGW3QPTZJ4ZXN6GRCBNHOGTQT3P4JA5CNFSM4HVWN3T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGHTUY#issuecomment-554465747>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGW3QPQDEQNLQFDOGOOFUADQT3P4JANCNFSM4HVWN3TQ>
.
|
Thanks! |
Hi,
There are some attributes within the grib_file that are being ignored when we open the grib file in cfgrib. Is there a way to augment the list of keys that you would like to include to be converted into the xarray dataset?
They also do not appears in the output using cfgrib.open_file
For example :
dateOfModelVersion = 20181010;
The text was updated successfully, but these errors were encountered: