Skip to content

Commit

Permalink
Lockfile updates (#4968)
Browse files Browse the repository at this point in the history
* Updated environment lockfiles

* Adjustments for Cartopy v0.21.0 (SciTools/cartopy@fcb784d).

* Cartopy >=0.21 pin.

* What's New entry.

* WIP try netCDF4 pin.

* Try pip installing netcdf4==1.6.1 as requested by @ocefpaf.

* Revert "Try pip installing netcdf4==1.6.1 as requested by @ocefpaf."

This reverts commit ce9f890.

* netcdf4!=1.6.1

* Align Conda YAML formatting.

Co-authored-by: Lockfile bot <[email protected]>
  • Loading branch information
trexfeathers and web-flow authored Sep 16, 2022
1 parent 06c8bc6 commit de911ce
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 150 deletions.
13 changes: 11 additions & 2 deletions docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This document explains the changes made to Iris for this release
#. `@bjlittle`_ and `@lbdreyer`_ (reviewer) fixed the building of the CF
Standard Names module ``iris.std_names`` for the ``setup.py`` commands
``develop`` and ``std_names``. (:issue:`4951`, :pull:`4952`)

#. `@lbdreyer`_ and `@pp-mo`_ (reviewer) fixed the cube print out such that
scalar ancillary variables are displayed in a dedicated section rather than
being added to the vector ancillary variables section. Further, ancillary
Expand Down Expand Up @@ -83,6 +83,13 @@ This document explains the changes made to Iris for this release

#. `@rcomer`_ introduced the ``dask >=2.26`` minimum pin, so that Iris can benefit
from Dask's support for `NEP13`_ and `NEP18`_. (:pull:`4905`)
#. `@trexfeathers`_ advanced the Cartopy pin to ``>=0.21``, as Cartopy's
change to default Transverse Mercator projection affects an Iris test.
See `SciTools/cartopy@fcb784d`_ and `SciTools/cartopy@8860a81`_ for more
details.
(:pull:`4968`)
#. `@trexfeathers`_ introduced the ``netcdf4!=1.6.1`` pin to avoid a problem
with segfaults. (:pull:`4968`)


📚 Documentation
Expand Down Expand Up @@ -117,4 +124,6 @@ This document explains the changes made to Iris for this release
.. _NEP13: https://numpy.org/neps/nep-0013-ufunc-overrides.html
.. _NEP18: https://numpy.org/neps/nep-0018-array-function-protocol.html
.. _pypa/setuptools#1684: https://github.com/pypa/setuptools/issues/1684
.. _pypa/setuptools#1684: https://github.com/pypa/setuptools/issues/1684
.. _SciTools/cartopy@fcb784d: https://github.com/SciTools/cartopy/commit/fcb784daa65d95ed9a74b02ca292801c02bc4108
.. _SciTools/cartopy@8860a81: https://github.com/SciTools/cartopy/commit/8860a8186d4dc62478e74c83f3b2b3e8f791372e
4 changes: 2 additions & 2 deletions lib/iris/analysis/cartography.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,8 @@ def _transform_distance_vectors_tolerance_mask(
u_one_t, v_zero_t = _transform_distance_vectors(ones, zeros, ds, dx2, dy2)
u_zero_t, v_one_t = _transform_distance_vectors(zeros, ones, ds, dx2, dy2)
# Squared magnitudes should be equal to one within acceptable tolerance.
# A value of atol=2e-3 is used, which corresponds to a change in magnitude
# of approximately 0.1%.
# A value of atol=2e-3 is used, which masks any magnitude changes >0.5%
# (approx percentage - based on experimenting).
sqmag_1_0 = u_one_t**2 + v_zero_t**2
sqmag_0_1 = u_zero_t**2 + v_one_t**2
mask = np.logical_not(
Expand Down
25 changes: 15 additions & 10 deletions lib/iris/tests/unit/analysis/cartography/test_rotate_winds.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import cartopy.crs as ccrs
import numpy as np
import numpy.ma as ma
import pytest

from iris.analysis.cartography import rotate_winds, unrotate_pole
import iris.coord_systems
Expand Down Expand Up @@ -410,7 +411,11 @@ def test_transposed(self):
class TestMasking(tests.IrisTest):
def test_rotated_to_osgb(self):
# Rotated Pole data with large extent.
x = np.linspace(311.9, 391.1, 10)
# A 'correct' answer is not known for this test; it is therefore
# written as a 'benchmark' style test - a change in behaviour will
# cause a test failure, requiring developers to approve/reject the
# new behaviour.
x = np.linspace(221.9, 301.1, 10)
y = np.linspace(-23.6, 24.8, 8)
u, v = uv_cubes(x, y)
ut, vt = rotate_winds(u, v, iris.coord_systems.OSGB())
Expand All @@ -422,14 +427,14 @@ def test_rotated_to_osgb(self):
# Snapshot of mask with fixed tolerance of atol=2e-3
expected_mask = np.array(
[
[1, 1, 1, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 0, 0, 0, 0, 1, 1],
[1, 1, 1, 1, 0, 0, 0, 0, 1, 1],
[1, 1, 1, 1, 0, 0, 0, 0, 1, 1],
[1, 1, 1, 1, 1, 0, 0, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 0, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 0, 1, 1, 1],
[0, 0, 0, 1, 1, 1, 0, 0, 0, 1],
[0, 0, 0, 0, 1, 1, 1, 0, 1, 1],
[0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
[0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
[0, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[0, 1, 1, 1, 0, 1, 1, 1, 0, 0],
[0, 1, 0, 0, 0, 0, 1, 1, 1, 0],
],
np.bool_,
)
Expand All @@ -443,7 +448,7 @@ def test_rotated_to_osgb(self):
# Calculate percentage error (note there are no zero magnitudes
# so we can divide safely).
anom = 100.0 * np.abs(res_mag - expected_mag) / expected_mag
self.assertTrue(anom[~ut.data.mask].max() < 0.1)
assert anom[~ut.data.mask].max() == pytest.approx(0.3227935)

def test_rotated_to_unrotated(self):
# Suffiently accurate so that no mask is introduced.
Expand Down
Loading

0 comments on commit de911ce

Please sign in to comment.