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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regridding fails for geostationary coordinate systems #5485

Open
stephenworsley opened this issue Sep 8, 2023 · 3 comments 路 May be fixed by #5745
Open

Regridding fails for geostationary coordinate systems #5485

stephenworsley opened this issue Sep 8, 2023 · 3 comments 路 May be fixed by #5745

Comments

@stephenworsley
Copy link
Contributor

馃悰 Bug Report

When one of the cubes involved in regridding has coordinates with a geostationary coordinate system, their units ought to be in radians, however iris insists that they ought to be in meters and regridding will fail when it gets to this line:

if coord.units != "m":
msg = (
"Unsupported units for coordinate system. "
"Expected 'metres' got {!r}.".format(coord.units)
)
raise ValueError(msg)

This logic should be changed to allow for gesostationary coordinates with radian units.

See Proj for a description of the geostationary projection: https://proj.org/en/9.3/operations/projections/geos.html

@stephenworsley
Copy link
Contributor Author

See the CF conventions for this projection for a more concrete statement of expected units: http://cfconventions.org/cf-conventions/cf-conventions.html#_geostationary_projection

The use of projection_x_coordinate and projection_y_coordinate was deprecated in version 1.9 of the CF Conventions. The initial definition of this projection used these standard names to identify the projection coordinates even though their canonical units (meters) do not match those required for this projection (radians).

Note that this also suggests we ought to be able to handle x and y coordinates with the names projection_x_angular_coordinate and projection_y_angular_coordinate.

@trexfeathers
Copy link
Contributor

In case it helps:

iris/lib/iris/plot.py

Lines 984 to 996 in e9c77c0

def _check_geostationary_coords_and_convert(x, y, kwargs):
# Geostationary stores projected coordinates as scanning angles (
# radians), in line with CF definition (this behaviour is unique to
# Geostationary). Before plotting, must be converted by multiplying by
# satellite height.
x, y = (i.copy() for i in (x, y))
transform = kwargs.get("transform")
if isinstance(transform, cartopy.crs.Geostationary):
satellite_height = transform.proj4_params["h"]
for i in (x, y):
i *= satellite_height
return x, y

@trexfeathers
Copy link
Contributor

See the CF conventions for this projection for a more concrete statement of expected units: http://cfconventions.org/cf-conventions/cf-conventions.html#_geostationary_projection

The use of projection_x_coordinate and projection_y_coordinate was deprecated in version 1.9 of the CF Conventions. The initial definition of this projection used these standard names to identify the projection coordinates even though their canonical units (meters) do not match those required for this projection (radians).

Note that this also suggests we ought to be able to handle x and y coordinates with the names projection_x_angular_coordinate and projection_y_angular_coordinate.

Need to remember to update guess_coord_axis() when we add these new coordinate names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: paused
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants