Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better way to handle GRIB codes? #282

Open
edwardhartnett opened this issue Aug 24, 2022 · 10 comments
Open

A better way to handle GRIB codes? #282

edwardhartnett opened this issue Aug 24, 2022 · 10 comments
Assignees
Labels
question Further information is requested

Comments

@edwardhartnett
Copy link
Contributor

Here we can find XML versions of the GRIB codes: https://community.wmo.int/activity-areas/wis/latest-version

Here's a sample:

	<GRIB2_CodeFlag_en>
		<Title_en>Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table</Title_en>
		<CodeFlag>0</CodeFlag>
		<MeaningParameterDescription_en>Meteorological products</MeaningParameterDescription_en>
		<Status>Operational</Status>
	</GRIB2_CodeFlag_en>
	<GRIB2_CodeFlag_en>
		<Title_en>Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table</Title_en>
		<CodeFlag>1</CodeFlag>
		<MeaningParameterDescription_en>Hydrological products</MeaningParameterDescription_en>
		<Status>Operational</Status>
	</GRIB2_CodeFlag_en>
	<GRIB2_CodeFlag_en>
		<Title_en>Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table</Title_en>
		<CodeFlag>2</CodeFlag>
		<MeaningParameterDescription_en>Land surface products</MeaningParameterDescription_en>
		<Status>Operational</Status>
	</GRIB2_CodeFlag_en>

So we can download these XML files (there are 2 for GRIB2) in the repo. Then we can find and use an XML parser library. Then g2c could read the XML and serve up all the code information. This would be very helpful for g2c, and for other applications using g2c.

In a further refactor, the g2tmpl project could just call the g2c library to get the codes, instead of maintaining them in Fortran code.

One problem is that we seem to have also defined our own "keys" which have to be maintained as well. I'm not sure yet how to cope with that.

The advantage is that we could use the WMO XML files directly, getting their updates and changes whenever they make them, automatically.

We would also still have to support any local codes as well.

@BoiVuong-NOAA @Hang-Lei-NOAA any comments on this idea?

@edwardhartnett edwardhartnett added the question Further information is requested label Aug 24, 2022
@edwardhartnett edwardhartnett self-assigned this Aug 24, 2022
@BoiVuong-NOAA
Copy link
Contributor

This is good idea to use XML files in the repo. But, I do not know how UPP code use the g2tmpl lib in GFS, NAM, RRFS, and UFS models. You need to check with developers.

@edwardhartnett
Copy link
Contributor Author

edwardhartnett commented Aug 25, 2022

g2tmpl users will not see any change.

After ingesting the codes into g2c, the g2tmpl Fortran functions can be changed to get their results from the g2c library.

Users of g2tmpl would not see any difference, but the codes would move to the C library and be served from there to any other software that needs them, including g2tmpl.

@BoiVuong-NOAA
Copy link
Contributor

That is great.

@DusanJovic-NOAA
Copy link
Contributor

I do not like the fact that this requires external library to parse xml files. I think this just adds unnecessary complexity.
Why do we need to read xml files instead of equivalent text files.

@edwardhartnett
Copy link
Contributor Author

What equivalent text files?

@DusanJovic-NOAA
Copy link
Contributor

These two, available from the same place the xml files are available from (WMO).

Template.txt

CodeFlag.txt

@edwardhartnett
Copy link
Contributor Author

Those links take me to a sharepoint site for which I do not have permissions. Are these documents on the web?

@DusanJovic-NOAA
Copy link
Contributor

@edwardhartnett
Copy link
Contributor Author

This is related to #345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: No status
Development

No branches or pull requests

4 participants