NOAA-EMC / NCEPLIBS-g2tmpl

GRIB2 codes and templates
Other
4 stars 9 forks source link

resolve duplicate WMO code processing and updating? #140

Open edwardhartnett opened 1 month ago

edwardhartnett commented 1 month ago

@AndrewBenjamin-NOAA just contributed some code updates to g2tmpl: https://github.com/NOAA-EMC/NCEPLIBS-g2tmpl/pull/139/files. (Thanks Andrew!)

Meanwhile, @webisu has his own set of code-handling code, in this directory: https://github.com/NOAA-EMC/wgrib2/tree/develop/wgrib2.

g2c takes a WMO XML file and ingests it directly into memory. I've since learned that there is a CSV file I could use instead, which would eliminate the need for libxml.

The wgrib2 code includes scripts which automatically get updates from WMO. Also the wgrib2 codes include many codes from outside NOAA.

Is there any way to combine efforts here so wgrib2 is not duplicating g2tmpl? And can we upgrade g2tmpl/g2 to the level of service that wgrib2 provides?

If we did that, could wgrib2 then rely on g2/g2c/g2tmpl to handle all codes?

Can we just ingest the WMO files directly and not have any generated code in the system? That would be preferable...

webisu commented 1 month ago

Not easy to code share wgrib2 and g2tmpl/g2 because of the different ways that the metadata is stored. wgrib2 stores metadata in its original byte format. Suppose wgrib2 wants to deal with code table X.Y. There are two routines

(1) address of code table X.Y this routine checks the template, and returns the appropriate address. returns NULL if code table X.Y is not available (2) value of code table X.Y uses (1). To set the value of code table X.Y, (1) is used to get the address. The routine is responsible to know what the appropriate type of data to use.

Wgrib2 puts the template location information into the routine of each routine that returns the address of code table X.Y. g2 puts that information into a different level of the code. Seems g2 is more template driven whereas wgrib2 is more item driven.

On Thu, Jul 25, 2024 at 11:20 AM Edward Hartnett @.***> wrote:

@AndrewBenjamin-NOAA https://github.com/AndrewBenjamin-NOAA just contributed some code updates to g2tmpl: https://github.com/NOAA-EMC/NCEPLIBS-g2tmpl/pull/139/files. (Thanks Andrew!)

Meanwhile, @webisu https://github.com/webisu has his own set of code-handling code, in this directory: https://github.com/NOAA-EMC/wgrib2/tree/develop/wgrib2.

The wgrib2 code includes scripts which automatically get updates from WMO. Also the wgrib2 codes include many codes from outside NOAA.

Is there any way to combine efforts here so wgrib2 is not duplicating g2tmpl? And can we upgrade g2tmpl/g2 to the level of service that wgrib2 provides?

If we did that, could wgrib2 then rely on g2/g2tmpl to handle all codes?

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