Skip to content
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

Please add support for GRIB files via ECMWF cfgrib / ecCodes #2475

Closed
alexamici opened this issue Oct 9, 2018 · 2 comments
Closed

Please add support for GRIB files via ECMWF cfgrib / ecCodes #2475

alexamici opened this issue Oct 9, 2018 · 2 comments

Comments

@alexamici
Copy link
Collaborator

alexamici commented Oct 9, 2018

The cfgrib project offers to open a GRIB file as an xarray.Dataset:

>>> import cfgrib
>>> cfgrib.open_dataset('era5-levels-members.grib')
<xarray.Dataset>
Dimensions:       (air_pressure: 2, latitude: 61, longitude: 120, number: 10, time: 4)
Coordinates:
  * number        (number) int64 0 1 2 3 4 5 6 7 8 9
  * time          (time) datetime64[ns] 2017-01-01 ... 2017-01-02T12:00:00
    step          timedelta64[ns] ...
  * air_pressure  (air_pressure) float64 850.0 500.0
  * 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 ... 351.0 354.0 357.0
    valid_time    (time) datetime64[ns] ...
Data variables:
    z             (number, time, air_pressure, latitude, longitude) float32 ...
    t             (number, time, air_pressure, latitude, longitude) float32 ...
Attributes:
    GRIB_edition:            1
    GRIB_centre:             ecmf
    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts
    GRIB_subCentre:          0
    history:                 GRIB to CDM+CF via cfgrib-0.9.../ecCodes-2...

It would be very helpful to have a backend for it distributed with xarray to be selected via the engine keyword argument:

>>> import xarray as xr
>>> xr.open_dataset('era5-levels-members.grib', engine='cfgrib')
<xarray.Dataset>
Dimensions:       (air_pressure: 2, latitude: 61, longitude: 120, number: 10, time: 4)
Coordinates:
  * number        (number) int64 0 1 2 3 4 5 6 7 8 9
  * time          (time) datetime64[ns] 2017-01-01 ... 2017-01-02T12:00:00
    step          timedelta64[ns] ...
  * air_pressure  (air_pressure) float64 850.0 500.0
  * 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 ... 351.0 354.0 357.0
    valid_time    (time) datetime64[ns] ...
Data variables:
    z             (number, time, air_pressure, latitude, longitude) float32 ...
    t             (number, time, air_pressure, latitude, longitude) float32 ...
Attributes:
    GRIB_edition:            1
    GRIB_centre:             ecmf
    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts
    GRIB_subCentre:          0
    history:                 GRIB to CDM+CF via cfgrib-0.9.../ecCodes-2...

cc @StephanSiemen @iainrussell

@alexamici
Copy link
Collaborator Author

Great! @shoyer you can close the issue as resolved for me.

@jhamman jhamman closed this as completed Oct 17, 2018
@jhamman
Copy link
Member

jhamman commented Oct 17, 2018

Thanks @alexamici for this contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants