spidru / JGribX

Java GRIB-1/GRIB-2 decoder
MIT License
34 stars 14 forks source link

NoValidGribException: No valid GRIB records found. #20

Closed gaci0703 closed 2 years ago

gaci0703 commented 2 years ago

Hello. I currently pull my grib2 data from https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/MT.gfs_CY.00/RD.20220705/PT.grid_DF.gr2/. When I put this data into a GribFile, I get the NoValidGribException. I am using the current version of the JGribX.jar. After downloading one of these records from this url, I also checked using java -jar JGribX.jar -i grib2.grb and I get the same NoValidGribException. Can you please tell me what is wrong with this data?

Thank you.

spidru commented 2 years ago

Hi @gaci0703,

Thanks for using JGribX!

It seems that the link you provided is a directory. For convenience, I'll use this particular file for testing this issue.

It appears that you're encountering a currently unsupported feature within a GDS. It seems that the number of points along a parallel (Ni) is being read as -1. This indicates that the GDS is a quasi-regular grid, with each row having a variable number of points along the parallel.

Interestingly, I also checked with zyGrib and it also fails with a similar error:

DBG Grib2Record.cpp: 103: Grib2Record(): Record 1: Ni=-1 Nj=73 terminate called after throwing an instance of 'std::bad_array_new_length' what(): std::bad_array_new_length

I guess they also do not support this :)

I'll need some time to add support for quasi-regular grids, will keep you posted!

gaci0703 commented 2 years ago

Thank you so much for your quick response.
I will keep checking for your updates!!

spidru commented 2 years ago

Hi @gaci0703,

The quasi-regular grid implementation is almost complete, but sadly I see that there is another feature which is currently not supported (JPEG2000 packing in DRS). Once again, I need some more time to implement this.

gaci0703 commented 2 years ago

Thank you. I am hoping that url that contains the grib2 files is helping you with the updates.

spidru commented 2 years ago

Hi @gaci0703,

I finally have a new version for you to test. Could you try it out? It requires JRE 8 or higher.

https://output.circle-artifacts.com/output/job/70d21686-98f4-40d3-89e5-7f8ad42aaf77/artifacts/0/build/libs/JGribX.jar

gaci0703 commented 2 years ago

Hello @spidru, It works perfectly on the gfs wind data from this directory - https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/MT.gfs_CY.00/RD.20220705/PT.grid_DF.gr2/. When I try the new update on RAP or NAM wind data, I get the NoValidGribException. I would assume GFS, RAP, and NAM are all in the same format. https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/MT.rap_CY.06/RD.20220725/PT.grid_DF.gr2/ - for RAP and https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/MT.nam_AR.ak_CY.06/RD.20220725/PT.grid_DF.gr2/ for NAM

spidru commented 2 years ago

Hi @gaci0703,

Thanks for confirming that at least the original issue (i.e. unsupported quasi-regular grids and JPEG 2000 encoded data) has been resolved. I would therefore like to close this issue and kindly ask you to open a new one.

But to already give some feedback, I noticed that all 3 gr2 files you linked in your last message do not work for me. Could you resend them (in a new issue) as attachments? Thanks!

gaci0703 commented 2 years ago

I opened a new issue - Thank you!!!

spidru commented 2 years ago

Merged to master with b99d8a5.