Skip to content

Regridding fails for geostationary coordinate systems #5485

Open
@stephenworsley

Description

@stephenworsley
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

Activity

stephenworsley

stephenworsley commented on Sep 20, 2023

@stephenworsley
ContributorAuthor

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

trexfeathers commented on Oct 17, 2023

@trexfeathers
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

trexfeathers commented on Oct 26, 2023

@trexfeathers
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.

added this to 🚴 Peloton and removed this from 🚴 Pelotonon Dec 15, 2023
moved this to 🆕 New - potential tasks in 🐙Iris v3.8.0on Jan 31, 2024
moved this from 🆕 New - potential tasks to Candidate for next sprint in 🐙Iris v3.8.0on Jan 31, 2024
moved this from Candidate for next sprint to 📋 Backlog in 🐙Iris v3.8.0on Feb 2, 2024
moved this from 📋 Backlog to 🔖Assigned in 🐙Iris v3.8.0on Feb 5, 2024
moved this from 🔖Assigned to 🏗 In progress in 🐙Iris v3.8.0on Feb 15, 2024
moved this from 🏗 In progress to 👀 In review in 🐙Iris v3.8.0on Feb 16, 2024
moved this from 👀 In review to 🏗 In progress in 🐙Iris v3.8.0on Feb 16, 2024
moved this from 🏗 In progress to 👀 In review in 🐙Iris v3.8.0on Feb 16, 2024
moved this from 👀 In review to paused in 🐙Iris v3.8.0on Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @bjlittle@trexfeathers@stephenworsley

      Issue actions

        Regridding fails for geostationary coordinate systems · Issue #5485 · SciTools/iris