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

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.

@scitools-ci scitools-ci bot removed this from 🚴 Peloton Dec 15, 2023
@stephenworsley stephenworsley moved this to 🆕 New - potential tasks in 🐙Iris v3.8.0 Jan 31, 2024
@stephenworsley stephenworsley moved this from 🆕 New - potential tasks to Candidate for next sprint in 🐙Iris v3.8.0 Jan 31, 2024
@stephenworsley stephenworsley moved this from Candidate for next sprint to 📋 Backlog in 🐙Iris v3.8.0 Feb 2, 2024
@stephenworsley stephenworsley moved this from 📋 Backlog to 🔖Assigned in 🐙Iris v3.8.0 Feb 5, 2024
@stephenworsley stephenworsley linked a pull request Feb 14, 2024 that will close this issue
@trexfeathers trexfeathers moved this from 🔖Assigned to 🏗 In progress in 🐙Iris v3.8.0 Feb 15, 2024
@bjlittle bjlittle moved this from 🏗 In progress to 👀 In review in 🐙Iris v3.8.0 Feb 16, 2024
@bjlittle bjlittle moved this from 👀 In review to 🏗 In progress in 🐙Iris v3.8.0 Feb 16, 2024
@stephenworsley stephenworsley moved this from 🏗 In progress to 👀 In review in 🐙Iris v3.8.0 Feb 16, 2024
@bjlittle bjlittle assigned bjlittle and unassigned trexfeathers Feb 16, 2024
@stephenworsley stephenworsley moved this from 👀 In review to paused in 🐙Iris v3.8.0 Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: paused
Development

Successfully merging a pull request may close this issue.

3 participants