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

Remove addition of period from wrap_lons #3994

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ env:
# Increment the build number to force new nox cache upload.
NOX_CACHE_BUILD: "0"
# Increment the build number to force new pip cache upload.
PIP_CACHE_BUILD: "0"
PIP_CACHE_BUILD: "1"
# Pip packages to be upgraded/installed.
PIP_CACHE_PACKAGES: "nox pip pyyaml setuptools wheel"
# Conda packages to be installed.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,16 @@ This document explains the changes made to Iris for this release
#. `@rcomer`_ modified a NetCDF saver test to prevent it triggering a numpy
deprecation warning. (:issue:`4374`, :pull:`4376`)

#. `@akuhnregnier`_ removed addition of period from
:func:`~iris.analysis.cartography.wrap_lons` and updated affected tests
using assertArrayAllClose following :issue:`3993`.
(:pull:`3994`)

.. comment
Whatsnew author names (@github name) in alphabetical order. Note that,
core dev names are automatically included by the common_links.inc:

.. _@akuhnregnier: https://github.com/akuhnregnier
.. _@bsherratt: https://github.com/bsherratt
.. _@larsbarring: https://github.com/larsbarring
.. _@pdearnshaw: https://github.com/pdearnshaw
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/analysis/cartography.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def wrap_lons(lons, base, period):
# It is important to use 64bit floating precision when changing a floats
# numbers range.
lons = lons.astype(np.float64)
return ((lons - base + period * 2) % period) + base
return ((lons - base) % period) + base


def unrotate_pole(rotated_lons, rotated_lats, pole_lon, pole_lat):
Expand Down
7 changes: 2 additions & 5 deletions lib/iris/tests/unit/cube/test_Cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1662,11 +1662,8 @@ def test_wrap_radians(self):
cube = create_cube(0, 360)
cube.coord("longitude").convert_units("radians")
result = cube.intersection(longitude=(-1, 0.5))
self.assertEqual(
result.coord("longitude").points[0], -0.99483767363676634
)
self.assertEqual(
result.coord("longitude").points[-1], 0.48869219055841207
self.assertArrayAllClose(
result.coord("longitude").points, np.arange(-57, 29) * np.pi / 180
)
self.assertEqual(result.data[0, 0, 0], 303)
self.assertEqual(result.data[0, 0, -1], 28)
Expand Down