NOAA-MDL / grib2io

Python interface to the NCEP G2C Library for reading and writing GRIB2 messages.
https://noaa-mdl.github.io/grib2io
MIT License
30 stars 11 forks source link

Bad gridlengthXDirection when reading gaussian grid #123

Closed alcoat closed 8 months ago

alcoat commented 8 months ago

Input files could be CSFR V2 or any CFS forecast or may be any files with a gaussian grid

import grib2io
file = "flxf2024011700.01.2024011700.grb2"
g = grib2io.open(file)
msg = g.select(shortName='UGRD')[0]
print(msg.gridlengthXDirection)

This issue is leading to an error in the xarray backend as the dimension of longitude is not correct using the msg.grid() method.

EricEngle-NOAA commented 8 months ago

Thanks for reporting. I can confirm the issue. I have identified the issue and a solution is working. This also led me to discover a missing attribute for messages with Gaussian grids and is a fairly important one, the number of parallels.

v2.1.3 coming in the next few hours with this fix.

EricEngle-NOAA commented 8 months ago

v2.1.3 released with the fix for this. It is now available on PyPI and will be available on conda-forge in a few hours.