GRIB_API ERROR : Wrong number of fields

Hi Jan,

In case the grib file is damaged in some way, can you use 'grib_ls' or 'grib_dump' to check the entire file can be read, e.g.

grib_dump ICMGGgvfc+000008

it will produce a lot of output but will confirm the file can be read ok. I suspect the file is fine but good to check.

When using cdo, it is best to split the file so that each level type (pressure, surface) is in a separate file. Cdo's cgribex engine doesn't tend to work well if it sees a mix of vertical coordinates. You can do the split like this using cdo or grib_api depending on your preference:

# cdo solution
cdo splitzaxis ICMGGgvfc+000008 ICMGGgvfc+000008_split
# grib_api solution.
grib_copy ICMGGgvfc+000008 ICMSHg4a4+000000_[typeOfLevel]

Then try again.

There are, unfortunately, a few caveats when using cdo with OpenIFS grib output, particularly when converting to a regular lat-long grid.

I recommend reading both this page on the OpenIFS website: How to convert GRIB to netCDF (including comments at the bottom) and this post on the OpenIFS forum: Grib to netcdf conversion, which goes into the caveats and workarounds in much more detail.

Regards,   Glenn