NOAA-EMC / wgrib2

Provides functionality for interacting with, reading, writing, and manipulating GRIB2 files.
27 stars 13 forks source link

Differences between wgrib2 and g2c decoding? #164

Closed edwardhartnett closed 2 months ago

edwardhartnett commented 3 months ago

What are the difference between how g2c and wgrib2 decode messages?

For every case, we need a test case on both wgrib2 and g2c sides. We have a number of test files available on FTP. Do any of them contain messages which are decoded differently?

Let's identify the issues and resolve them one by one...

webisu commented 3 months ago

I stopped looking at g2c and g2 over a decade ago. The last time I wrote code to decode a grib2 file using g2clib was the initial version of wgrib2 which was 20 years ago. I never wrote code to read/write a grib file using g2lib.

I was continually fixing bugs in g2clib decode routines until I wrote the internal decode routines and made g2clib a non-default compile time option. I never used the g2clib encode routines in wgrib2. As far as I am concerned, the differences between decoding by wgrib2 and g2lib and g2clib are problems of g2lib and g2clib.

The only connections that wgrib2 needs with g2clib are the png/jasper/openjpeg lower level encode/decode routines. Not sure how they have changed over the years.

The decenc_openjpeg.c is copyright EMCWF with modifications for g2c and wgrib2.

Personally I would get rid of g2clib, and jasper. The latter would be replaced by openjpeg.

Wesley

On Fri, Jul 5, 2024 at 9:40 AM Edward Hartnett @.***> wrote:

What are the difference between how g2c and wgrib2 decode messages?

For every case, we need a test case on both wgrib2 and g2c sides. We have a number of test files available on FTP. Do any of them contain messages which are decoded differently?

Let's identify the issues and resolve them one by one...

— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/wgrib2/issues/164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZUYZVNXGQZGSELKILLZK2O4FAVCNFSM6AAAAABKNHLVLCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM4TENRTGMZTMOI . You are receiving this because you were assigned.Message ID: @.***>

edwardhartnett commented 2 months ago

In terms of Jasper vs. openjpeg, I also support the sunsetting of Jasper, but we cannot control that single-handedly. The answer for us is to build (and test) with either. Then, when enough applications (i.e. all of them) stop using jasper, it can be removed. Until then, we have to support it in both wgrib2 and g2/g2c.

It's a bummer that you had bad experiences with g2c. Of course, that was an earlier time, before agile management of this software on GitHub. These days, no one needs to be held back in making modifications or fixes to g2c. Moving forward, I hope we can achieve better cooperation between the two codes and reduce duplication of effort and of code.

I will close this issue and we'll pursue these issues under more specific, detailed issues. Thanks for the answers.