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

Provide lookup functions for GRIB2 variable shortNames #109

Merged
merged 8 commits into from
Nov 1, 2023

Conversation

EricEngle-NOAA
Copy link
Collaborator

Addresses issue #108

New file grib2io/tables/section4_discipline20.py for new-ish GRIB2
discipline 20 (Health and Socioeconomic Impacts).
Added parameter tables for discipline 20

Added section 4 tables 4.234, 4.235, 4.236, 4.238, 4.239, 4.244, and
4.251.

Updated shape of for entry 5 of earth_params dict to ellipsoid.
In make_grib2_tables/make-ncep-grib2-tables.sh, the earth_params table
is now prefixed with "table_" like the other tables.
Fixed an issue with EarthRadius, EarthMajorAxis, EarthMinorAxis
descriptor classes not providing values from earth_params table.

Added EarthShape descriptor class.
Added earthShape metadata attribute to the Grib2Message object.
New functions get_shortnames() and get_metadata_from_shortname().
In grib2io/templates.py, mistakingly did not change the duplicated
EarthRadius class to EarthShape.

In grib2io/tables/__init__.py, using lru_cache decorator instead of
cache since cache is available starting from Python 3.9. The functools
documentation states that @cache == @lru_cache(maxsize=None).
@EricEngle-NOAA EricEngle-NOAA linked an issue Nov 1, 2023 that may be closed by this pull request
@EricEngle-NOAA EricEngle-NOAA merged commit bc19017 into master Nov 1, 2023
20 checks passed
@EricEngle-NOAA EricEngle-NOAA deleted the 108-variable-shortname-lookup branch November 1, 2023 14:20
EricEngle-NOAA added a commit that referenced this pull request Nov 1, 2023
* Update for NCEP Tables.

New file grib2io/tables/section4_discipline20.py for new-ish GRIB2
discipline 20 (Health and Socioeconomic Impacts).

* NCEP GRIB2 Tables update

Added parameter tables for discipline 20

Added section 4 tables 4.234, 4.235, 4.236, 4.238, 4.239, 4.244, and
4.251.

Updated shape of for entry 5 of earth_params dict to ellipsoid.

* Update NCEP GRIB2 tables.

* Update for earth_params table

In make_grib2_tables/make-ncep-grib2-tables.sh, the earth_params table
is now prefixed with "table_" like the other tables.

* Update templates.py

Fixed an issue with EarthRadius, EarthMajorAxis, EarthMinorAxis
descriptor classes not providing values from earth_params table.

Added EarthShape descriptor class.

* Update for _grib2io.py

Added earthShape metadata attribute to the Grib2Message object.

* Update for tables/__init__.py

New functions get_shortnames() and get_metadata_from_shortname().

* 2 Fixes here...

In grib2io/templates.py, mistakingly did not change the duplicated
EarthRadius class to EarthShape.

In grib2io/tables/__init__.py, using lru_cache decorator instead of
cache since cache is available starting from Python 3.9. The functools
documentation states that @cache == @lru_cache(maxsize=None).

---------

Co-authored-by: Eric Engle <[email protected]>
EricEngle-NOAA added a commit that referenced this pull request Nov 12, 2023
* Adding support for GDT 32678 and 32769.

In templates.py, adding template classes for templates 32678 and 32679.

* Update for GDT 32769.

initial support for generating lats and lons for grid 32769.

this commit references issue #96

* Update for grib2io xarray backend

Adding support to pass method_options keyword to the various
array interpolation functions and accessor functions. This
keyword will map to grib2io's interpolation functions with the
same keyword argument name.

This commit references issue #97

* Updating C sources from Cython

Generated from Cython 3.0.

* Update grib2io

Added logic when creating a GRIB2 message from scratch, to populate
the reference date/time information in section1 with default values
of the UNIX epoch date.  This avoids raising a ValueError with the
datetime.datetime object.

* Update for xarray backend

Adding accessor function 'griddef' to return a grib2io.Grib2GridDef
object from a Dataset or DataArray.

* Update docs.

[skip ci]

* Update for grib2io xarray backend

- Adding validDate coordinate variable
- Adding fullName and shortName to data variables.
- Changed message selection on 1 line to use isel()

* Version bump to v2.0.1.

* Update grib2io/__init__.py

Change "import g2clib" to "import .g2clib".

* Update docs and version bump to v2.0.2.

* Fix for missing template numbers

This commit fixes the missing template numbers in section arrays.

Also adding property functions gdt, pdt, and drt as shortcuts.

This commit references issue #101

* Update docs.

* Fix for correct number of data points in section 3

section3[1] should hold the number of data points, generally that is nx*ny. This
was not getting set when creating a Grib2Message object from scratch.

Added 'sourceOfGridDefinition' and 'numberOfDataPoints' to section 3 metadata
that is provided via __repr__().

this commit references issue #101

* Update docs.

* 95 add support for drt 542 aecccsds compression (#103)

* Adding support for DRT 5.42

Adding support for DRT 5.42 AEC/CCSDS compression.

Other changes in g2clib Cython related to changes to g2c coming version
1.8.0 and also Cython major udate to v3.0 from 0.29...

ref issue #95

[skip ci]

* Clean up of code to support DRT 5.42.

Using 'aec' as the string for this compression scheme.

Removed "CCSDS" from descriptor classes and attributes.

* Update setup.py

Still getting conditions where g2c_incdir is not set, so I think this
takes care of that....ugh.

* Update for grib2io xarray backend

Adding support to pass method_options keyword to the various
array interpolation functions and accessor functions. This
keyword will map to grib2io's interpolation functions with the
same keyword argument name.

This commit references issue #97

* Updating C sources from Cython

Generated from Cython 3.0.

* Update grib2io

Added logic when creating a GRIB2 message from scratch, to populate
the reference date/time information in section1 with default values
of the UNIX epoch date.  This avoids raising a ValueError with the
datetime.datetime object.

* Update for xarray backend

Adding accessor function 'griddef' to return a grib2io.Grib2GridDef
object from a Dataset or DataArray.

* Update docs.

[skip ci]

* Update for grib2io xarray backend

- Adding validDate coordinate variable
- Adding fullName and shortName to data variables.
- Changed message selection on 1 line to use isel()

* Version bump to v2.0.1.

* Update grib2io/__init__.py

Change "import g2clib" to "import .g2clib".

* Update docs and version bump to v2.0.2.

* Fix for missing template numbers

This commit fixes the missing template numbers in section arrays.

Also adding property functions gdt, pdt, and drt as shortcuts.

This commit references issue #101

* Update docs.

* Fix for correct number of data points in section 3

section3[1] should hold the number of data points, generally that is nx*ny. This
was not getting set when creating a Grib2Message object from scratch.

Added 'sourceOfGridDefinition' and 'numberOfDataPoints' to section 3 metadata
that is provided via __repr__().

this commit references issue #101

* Update docs.

* Adding support for DRT 5.42

Adding support for DRT 5.42 AEC/CCSDS compression.

Other changes in g2clib Cython related to changes to g2c coming version
1.8.0 and also Cython major udate to v3.0 from 0.29...

ref issue #95

[skip ci]

* Update for g2clib cython

Return g2clib v1.7.0 G2_VERSION definitions.

* Hopefully...final clean up for AEC support

Fixed typo in templates.py

Added custom preprocessing definition in cdef for grib2.h in g2clib.pyx
to check for G2_VERSION or G2C_VERSION.

Added AEC support print in grib2io.show_config()

This commit references issue #95

---------

Co-authored-by: Eric Engle <[email protected]>

* Testing support for Python 3.12

* Update README.md

Added Python 3.12 badge

[skip ci]

* Update docs.

[skip ci]

* Allow to append grib file (#104)

* Update _grib2io.py

Allow read access with appending file

* Update _grib2io.py

remove empty line

* Update build_linux.yml

* Update build_linux.yml

remove workflow_dispatch

* Provide lookup functions for GRIB2 variable shortNames (#109)

* Update for NCEP Tables.

New file grib2io/tables/section4_discipline20.py for new-ish GRIB2
discipline 20 (Health and Socioeconomic Impacts).

* NCEP GRIB2 Tables update

Added parameter tables for discipline 20

Added section 4 tables 4.234, 4.235, 4.236, 4.238, 4.239, 4.244, and
4.251.

Updated shape of for entry 5 of earth_params dict to ellipsoid.

* Update NCEP GRIB2 tables.

* Update for earth_params table

In make_grib2_tables/make-ncep-grib2-tables.sh, the earth_params table
is now prefixed with "table_" like the other tables.

* Update templates.py

Fixed an issue with EarthRadius, EarthMajorAxis, EarthMinorAxis
descriptor classes not providing values from earth_params table.

Added EarthShape descriptor class.

* Update for _grib2io.py

Added earthShape metadata attribute to the Grib2Message object.

* Update for tables/__init__.py

New functions get_shortnames() and get_metadata_from_shortname().

* 2 Fixes here...

In grib2io/templates.py, mistakingly did not change the duplicated
EarthRadius class to EarthShape.

In grib2io/tables/__init__.py, using lru_cache decorator instead of
cache since cache is available starting from Python 3.9. The functools
documentation states that @cache == @lru_cache(maxsize=None).

---------

Co-authored-by: Eric Engle <[email protected]>

* Commit for issue #105 in templates.py (#106)

Added descriptor classes for upper limit scale factor and scaled value.

Added attributes for lower and upper limit scale factors and scaled
values to product definition template classes 4.5 and 4.9.

This commit references issue #105

Co-authored-by: Eric Engle <[email protected]>

* Commit for issue #105 in templates.py (#110)

Added descriptor classes for upper limit scale factor and scaled value.

Added attributes for lower and upper limit scale factors and scaled
values to product definition template classes 4.5 and 4.9.

This commit references issue #105

Co-authored-by: Eric Engle <[email protected]>

* Added VERSION file

Updated setup.py to read from VERSION file.

* Removal of Cython-generated C sources

Removing Cython-generated C sources from git tracking.

* Update MANIFEST.in

Remove *.c Cython-generated sources.

* Adding support for GDT 32678 and 32769.

In templates.py, adding template classes for templates 32678 and 32679.

* Update for grib2io/templates.py

Changing metadata attr names...

unitOfTimeRange -> unitOfForecastTime
forecastTime -> valueOfForecastTime

These new names are more consistent with attr names elsewhere and should
be less confusing as end users should use leadTime attr which is a
datetime.timedelta object.

* Update for lat lon storage

Changed storage object of lats and lons from a tuple in the data
store to a dictionary with keys 'latitude' and 'longitude'. This is
due to the Arakawa rotate grid (32769) that will generate rotation
angles for vector quantities and we will want to store those as well.

* Adding lat/lon generation for GDT 32769

Adding functions to support generation of lats and lons for GDT 32769.
These functions have been adapted from the NCAR command langauge (ncl).

This commit also adds a function to generate rotation angles for vector
quantities.  The angles should be applied to U/V-based grids in the
following manner:

         formula_u :	Uearth = sin(rot)*Vgrid + cos(rot)*Ugrid
         formula_v :	Vearth = cos(rot)*Vgrid - sin(rot)*Ugrid

This commit references issue #96

---------

Co-authored-by: Eric Engle <[email protected]>
Co-authored-by: alcoat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variable shortName lookup
1 participant