diff --git a/docs/src/whatsnew/3.2.rst b/docs/src/whatsnew/3.2.rst index fac755ad72..38f4ce0b8e 100644 --- a/docs/src/whatsnew/3.2.rst +++ b/docs/src/whatsnew/3.2.rst @@ -38,7 +38,9 @@ v3.2.1 |build_date| [unreleased] 🐛 **Bugs Fixed** - #. N/A + #. `@dennissergeev`_ changed _crs_distance_differentials() so that it uses the `Globe` + attribute from a given CRS instead of creating a new `ccrs.Globe()` object. + Iris can now handle non-Earth semi-major axes, as discussed in :issue:`4582` (:pull:`4605`). 💼 **Internal** @@ -388,6 +390,7 @@ v3.2.1 |build_date| [unreleased] .. _@aaronspring: https://github.com/aaronspring .. _@akuhnregnier: https://github.com/akuhnregnier .. _@bsherratt: https://github.com/bsherratt +.. _@dennissergeev: https://github.com/dennissergeev .. _@larsbarring: https://github.com/larsbarring .. _@pdearnshaw: https://github.com/pdearnshaw .. _@SimonPeatman: https://github.com/SimonPeatman diff --git a/lib/iris/analysis/cartography.py b/lib/iris/analysis/cartography.py index 373487af53..116dfe0b70 100644 --- a/lib/iris/analysis/cartography.py +++ b/lib/iris/analysis/cartography.py @@ -927,7 +927,7 @@ def _crs_distance_differentials(crs, x, y): """ # Make a true-latlon coordinate system for distance calculations. - crs_latlon = ccrs.Geodetic(globe=ccrs.Globe(ellipse="sphere")) + crs_latlon = ccrs.Geodetic(globe=crs.globe) # Transform points to true-latlon (just to get the true latitudes). _, true_lat = _transform_xy(crs, x, y, crs_latlon) # Get coordinate differentials w.r.t. true-latlon. diff --git a/lib/iris/tests/unit/analysis/cartography/test_rotate_winds.py b/lib/iris/tests/unit/analysis/cartography/test_rotate_winds.py index 9e3af90603..31a3a0510a 100644 --- a/lib/iris/tests/unit/analysis/cartography/test_rotate_winds.py +++ b/lib/iris/tests/unit/analysis/cartography/test_rotate_winds.py @@ -493,5 +493,18 @@ def test_rotated_to_unrotated(self): self.assertArrayAlmostEqual(res_y, y2d) +class TestNonEarthPlanet(tests.IrisTest): + def test_non_earth_semimajor_axis(self): + u, v = uv_cubes() + u.coord("grid_latitude").coord_system = iris.coord_systems.GeogCS(123) + u.coord("grid_longitude").coord_system = iris.coord_systems.GeogCS(123) + v.coord("grid_latitude").coord_system = iris.coord_systems.GeogCS(123) + v.coord("grid_longitude").coord_system = iris.coord_systems.GeogCS(123) + other_cs = iris.coord_systems.RotatedGeogCS( + 0, 0, ellipsoid=iris.coord_systems.GeogCS(123) + ) + rotate_winds(u, v, other_cs) + + if __name__ == "__main__": tests.main()