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

Remove obsolete workarounds. #410

Merged
merged 8 commits into from
Apr 19, 2024
Merged

Conversation

pp-mo
Copy link
Member

@pp-mo pp-mo commented Apr 12, 2024

Closes #239

I'm happy that none of these workarounds are now needed, as all fixed in eccodes. Long ago, I think.
This passes existing tests, but there is no effective testing of the relevant code.
What I have done is a roundtrip test : that at least does seem to work :

>>> ellipsoid = GeogCS(EARTH_RADIUS)
>>> data = np.arange(12).reshape(3, 4)
>>> cube = Cube(data, "air_pressure_anomaly")
>>> trans_merc = TransverseMercator(
...     49.0, -2.0, -400000.0, 100000.0, 0.9996012717, ellipsoid
... )
>>> coord = DimCoord(
...     np.arange(3),
...     "projection_y_coordinate",
...     units="m",
...     coord_system=trans_merc,
... )
>>> cube.add_dim_coord(coord, 0)
>>> coord = DimCoord(
...     np.arange(4),
...     "projection_x_coordinate",
...     units="m",
...     coord_system=trans_merc,
... )
>>> cube.add_dim_coord(coord, 1)
>>> coord = DimCoord(
...     np.arange(1),
...     "time",
...     units="days since 2000-01-01",
... )
>>> cube.add_aux_coord(coord, ())
>>> 
>>> print("\nInital cube to save:"); print(cube)

Inital cube to save:
air_pressure_anomaly / (unknown)    (projection_y_coordinate: 3; projection_x_coordinate: 4)
    Dimension coordinates:
        projection_y_coordinate                             x                           -
        projection_x_coordinate                             -                           x
    Scalar coordinates:
        time                        2000-01-01 00:00:00
>>> print("\nsaved + reloaded ...\n")

saved + reloaded ...

>>> result = iris.load_cube('temp.grib2')
>>> print(result); print("  ==> re-loaded coord system = ", result.coord_system())
unknown / (unknown)                 (projection_y_coordinate: 3; projection_x_coordinate: 4)
    Dimension coordinates:
        projection_y_coordinate                             x                           -
        projection_x_coordinate                             -                           x
    Scalar coordinates:
        forecast_period             0 hours
        forecast_reference_time     2000-01-01 00:00:00
        time                        2000-01-01 00:00:00
    Attributes:
        GRIB_PARAM                  GRIB2:d255c255n255
  ==> re-loaded coord system =  TransverseMercator(latitude_of_projection_origin=49.0, longitude_of_central_meridian=-2.0, false_easting=-400000.0, false_northing=100000.0, scale_factor_at_central_meridian=0.9996012449264526, ellipsoid=GeogCS(6371229.0))
>>> 

@pp-mo pp-mo requested a review from trexfeathers April 12, 2024 16:10
@pp-mo pp-mo self-assigned this Apr 16, 2024
@pp-mo pp-mo requested review from stephenworsley and removed request for trexfeathers April 16, 2024 09:26
Copy link
Contributor

@stephenworsley stephenworsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_save_rules also defines fixup_int32_as_int32 and fixup_int32_as_uint32, should these also be removed likefixup_float32_from_int32? Their docstring also mentions how they are a workaround, is this for the same issue?

@pp-mo
Copy link
Member Author

pp-mo commented Apr 18, 2024

Thanks @stephenworsley
Now rebased, and removed the remaining "fixup" routines which you mentioned -- which were now completely unused, anyway

Copy link
Contributor

@stephenworsley stephenworsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, there's a couple comments which ought to be removed and this should be good to go.

iris_grib/_load_convert.py Outdated Show resolved Hide resolved
iris_grib/_save_rules.py Outdated Show resolved Hide resolved
iris_grib/_save_rules.py Outdated Show resolved Hide resolved
@pp-mo
Copy link
Member Author

pp-mo commented Apr 18, 2024

Thanks @stephenworsley good spots !
I think I addressed those 3 now, please take another look.

Copy link
Contributor

@stephenworsley stephenworsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@stephenworsley stephenworsley merged commit 7eacda5 into SciTools:main Apr 19, 2024
10 checks passed
@pp-mo
Copy link
Member Author

pp-mo commented Apr 19, 2024

Thanks @stephenworsley !

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.

Remove probably-obsolete fixes for (gribapi bugs in signed/unsiged keys
2 participants