nmangue / NGrib

NGrib is a .NET library to read GRIB (GRid in Binary) files. GRIB is a gridded data standard from WMO (World Meteorological Organisation) and is used by many meteorological organisation. Fork of GribCS.
GNU Lesser General Public License v3.0
17 stars 10 forks source link

Grib1Reader ReadRecordRawData only returning 0 values #9

Closed da-br closed 11 months ago

da-br commented 11 months ago

Hello again 😄 ,

Let me preface this by saying I am new to Grib files in general.


When calling ReadRecordRawData on a grib1 file I only retrieve values = 0. I have worked my way through the library code a little and can see Brib1BinaryDataSection.isConstant = true which means the number of bits per value is 0 and therefore returning the refValue (0 in this case)

I can use the grib1 file in the test folder which does return values. I assume it must be the files I am using

When opening the file in Panoply some of the values are displayed as NaN. Not sure if this will have any affect.

image

I am not sure I can attach the file being used, I will find out and attach it if I can.

Any help would be appreciated.


Latest version of NGrib Windows DotNet 472

nmangue commented 11 months ago

Hello !

It could be a bug or an unsupported format. Data can be serialized in many different way in a grib file. To be able to help you, I need access to the file. If you can't post it publicly, you could directly send it to me.

da-br commented 11 months ago

After a bit of digging again, I have answered my own question.

There was a BMS section in the file that was being skipped. I have added support for this in the linked PR. However, I do not know if this was done for a specific reason.

Thanks 😀