Skip to content

Commit

Permalink
Port dependency fixes to v3.3.x. (#4992)
Browse files Browse the repository at this point in the history
* Lockfile updates (#4968)

* 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]>

* New lockfiles.

* What's New entry.

* What's New correction.

Co-authored-by: Lockfile bot <[email protected]>
  • Loading branch information
trexfeathers and web-flow authored Sep 26, 2022
1 parent d38c504 commit 2a41be2
Show file tree
Hide file tree
Showing 10 changed files with 237 additions and 219 deletions.
10 changes: 10 additions & 0 deletions docs/src/whatsnew/3.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ v3.3.1 |build_date| [unreleased]
#. `@pp-mo`_ ensured that :data:`iris.cube.Cube.cell_methods` must always be an iterable
of :class:`iris.coords.CellMethod` objects (:pull:`4933`).

#. `@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:`4992`)

#. `@trexfeathers`_ introduced the ``netcdf4!=1.6.1`` pin to avoid a
problem with segfaults. (:pull:`4992`)


📢 Announcements
================
Expand Down Expand Up @@ -361,3 +369,5 @@ v3.3.1 |build_date| [unreleased]
.. _PyData Sphinx Theme: https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html
.. _pytest: https://docs.pytest.org
.. _setuptools-scm: https://github.com/pypa/setuptools_scm
.. _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
133 changes: 67 additions & 66 deletions requirements/ci/nox.lock/py310-linux-64.lock

Large diffs are not rendered by default.

133 changes: 67 additions & 66 deletions requirements/ci/nox.lock/py38-linux-64.lock

Large diffs are not rendered by default.

135 changes: 68 additions & 67 deletions requirements/ci/nox.lock/py39-linux-64.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions requirements/ci/py310.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ dependencies:
- setuptools-scm >=7

# Core dependencies.
- cartopy >=0.20
- cartopy >=0.21
- cf-units >=3.1
- cftime >=1.5
- dask-core >=2
- matplotlib
- netcdf4
- netcdf4 !=1.6.1
- numpy >=1.19
- python-xxhash
- pyproj
Expand Down
4 changes: 2 additions & 2 deletions requirements/ci/py38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ dependencies:
- setuptools-scm >=7

# Core dependencies.
- cartopy >=0.20
- cartopy >=0.21
- cf-units >=3.1
- cftime >=1.5
- dask-core >=2
- matplotlib
- netcdf4
- netcdf4 !=1.6.1
- numpy >=1.19
- python-xxhash
- pyproj
Expand Down
4 changes: 2 additions & 2 deletions requirements/ci/py39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ dependencies:
- setuptools-scm >=7

# Core dependencies.
- cartopy >=0.20
- cartopy >=0.21
- cf-units >=3.1
- cftime >=1.5
- dask-core >=2
- matplotlib
- netcdf4
- netcdf4 !=1.6.1
- numpy >=1.19
- python-xxhash
- pyproj
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ version = attr: iris.__version__
[options]
include_package_data = True
install_requires =
cartopy>=0.20
cartopy>=0.21
cf-units>=3.1
cftime>=1.5.0
dask[array]>=2
matplotlib
netcdf4
netcdf4!=1.6.1
numpy>=1.19
scipy
shapely!=1.8.3
Expand Down

0 comments on commit 2a41be2

Please sign in to comment.