ecmwf / cfgrib

A Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes
Apache License 2.0
407 stars 77 forks source link

Alternate scanning directions not honored in NBM GRIB files #276

Closed jsillin closed 2 years ago

jsillin commented 2 years ago

I was attempting to read some NBM (National Blend of Models) GRIB files using xarray and cfgrib: t_ds = xr.open_dataset('blend.t12z.core.f%03d.co.grib2'%12, filter_by_keys={'stepType': 'instant', 'typeOfLevel': 'surface','paramId':130}) The reading operation was successful in that it didn't throw an error... but it also ended up looking really screwy when I went to make a very quick plot t_ds['t'].plot(): nbm_gribreadfail

The twitter hive mind (thread for reference: https://twitter.com/JackSillin/status/1484617258852888582) quickly assessed that this was due to cfgrib not honoring some flag/option in the NBM GRIBs that reads the rows in the alternating order in which they were written. I've only ever had this issue with NBM gribs (to replicate the issue you may want to find yourself one or two https://noaa-nbm-grib2-pds.s3.amazonaws.com/index.html#blend.20220121/12/core/).

shahramn commented 2 years ago

I think there may be an issue with the ecCodes library (the GeoIterator for Polar Stereographic projection).

shahramn commented 2 years ago

This will be fixed in ecCodes v2.25.0, which will most likely be released in February

shahramn commented 2 years ago

ecCodes v2.25.0 has been released. See https://confluence.ecmwf.int/display/ECC/ecCodes+version+2.25.0+released

cameronbracken commented 2 years ago

This doesn't seem to be fixed. I'm using ecCodes v2.27.0 and I still get the same graphic as above when I try and plot.

iainrussell commented 2 years ago

Hi @cameronbracken, try the master branch of cfgrib if you can, that has a fix for alternate scanning. #296

cameronbracken commented 2 years ago

Thanks for the tip, I was able to get things working by manually installing cfgrib. Any idea when this will make it way to conda-forge/pypi?

iainrussell commented 2 years ago

Excellent! I think we could schedule a release for this coming week, as there are some important issues that have been fixed.

iainrussell commented 2 years ago

Hi @cameronbracken, cfgrib 0.9.10.2 is now on pypi and conda-forge!

cameronbracken commented 2 years ago

Thank you! I did a fresh install from conda-forge and everything works as expected.

iainrussell commented 2 years ago

That's great, thanks for letting me know!