Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ This document explains the changes made to Iris for this release
"Cube names differ: var1 != var1" if var1 appears multiple times in the list
(:issue:`4342`, :pull:`4345`)

#. `@larsbarring`_ fixed :class:`~iris.coord_systems.GeoCS` to handle spherical ellipsoid
parameter inverse_flattening = 0 (:issue: `4146`, :pull:`4348`)


💣 Incompatible Changes
=======================

Expand Down
2 changes: 1 addition & 1 deletion lib/iris/coord_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def __init__(

# Perfect sphere (semi_major_axis only)? (1 0 0)
elif semi_major_axis is not None and (
semi_minor_axis is None and inverse_flattening is None
semi_minor_axis is None and not inverse_flattening
Copy link
Member

Choose a reason for hiding this comment

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

This means that all of the following are now identical ellipsoid specifications for a sphere:

  • GeogCS(major_semi_axis=1.0, inverse_flattening=0)
  • GeogCS(major_semi_axis=1.0, inverse_flattening=None)
  • GeogCS(major_semi_axis=1.0)
  • GeogCS(1.0)

I think that this new behaviour will be quite natural to users 👍

):
semi_minor_axis = semi_major_axis
inverse_flattening = 0.0
Expand Down
11 changes: 11 additions & 0 deletions lib/iris/tests/unit/coord_systems/test_GeogCS.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ def test_optional_args_None(self):
)
self._check_crs_defaults(crs)

def test_zero_inverse_flattening_on_perfect_sphere(self):
# allow inverse_flattening to be 0 for a perfect sphere
# i.e. semi-major axis defined, semi-minor is None.
crs = GeogCS(
1.0,
semi_minor_axis=None,
inverse_flattening=0.0,
longitude_of_prime_meridian=None,
)
self._check_crs_defaults(crs)


if __name__ == "__main__":
tests.main()