[decoders] Java GRIB 1 Decoder Problems with Flag Variables

NOTE: The decoders mailing list is no longer active. The list archives are made available for historical reasons.

Hello,

 

I'm using the latest java Decoders package and am running into an error
trying to decode some GRIB (v1) files.  The error occurs when I try to
grab data that has a format of simple flags like (0 or 1) or (0,1,2,or
3).   What seems to be happening is that the code mistakenly thinks the
offset passed in is the Grid Description Section (GDS) even though the
data offset is what is being passed in.  

 

Normally this is handled ok by the code but when the length of the
Binary Data Section(BDS) is small, it mistakenly thinks its in a GDS and
subsequently the file pointer gets messed up.  In our case, we have a
flag parameter that happens to have a very small BDS (its an icing flag
and I there was no icing in our area) and hence the length octet is
small (12) and therefore less than 50 which fools the code into thinking
its in a GDS.   This less than 50 check happens around line 129 of the
Grib1Data class.  

 

My question to the mailing list is whether this is a bug or is there a
way I'm misunderstanding the API?   I can currently work around this by
deliberately bypassing the Grib1Data class.  To do so, you just need to
do the following:

1)       Set the raf (file pointer) to the data offset of your GDS

2)      If the Product Data Section (PDS) says that the bms exists, then
build a Grib1BitMapSection from the raf.

3)      Build a new Grib1BinaryDataSection object from the raf, the
decimal scale of the PDS and the above mentioned bms

4)      Then call getValues on that object.  

 

Does anyone see a problem with my workaround?  

If it is a bug, it might be easily taken care of by having another
Boolean variable passed in that tells the code whether it's a data
offset or a gds offset.

 

Any help or comments would be greatly appreciated.  Thanks,


Sincerely,

 

Mike Macaulay

Sr. Software Engineer

Lockheed Martin

  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the decoders archives: