Skip to content

Commit

Permalink
Adopt SPEC0 calendar, drop Python3.9 (#1915)
Browse files Browse the repository at this point in the history
### What kind of change does this PR introduce?

* Extends support for Python3.13 and drops support for Python3.9
* Raises the base required versions for a handful of dependencies based
on Scientific Python's SPEC 0 standard:
    * `ipython` to v8.5.0+
    * `matplotlib` to v3.6.0+
    * `numpy` to v1.23+
    * `scikit-learn` to v1.1.0+
* Updates the codebase to use Python3.10+ conventions
* `nbsphinx` has been pinned to v0.9.5+

### Does this PR introduce a breaking change?

Yes. Python3.9 support has been dropped.

### Other information:

https://scientific-python.org/specs/spec-0000/
https://peps.python.org/pep-0619/

Notable changes:
* https://peps.python.org/pep-0604/
* https://peps.python.org/pep-0618/
  • Loading branch information
Zeitsperre authored Sep 18, 2024
1 parent e9ae422 commit ba5901d
Show file tree
Hide file tree
Showing 43 changed files with 174 additions and 211 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@ permissions:

jobs:
lint:
name: Lint (Python${{ matrix.python-version }})
name: Lint
runs-on: ubuntu-latest
if: |
(github.event.action != 'labeled') ||
(github.event.review.state == 'approved') ||
(github.event_name == 'push')
strategy:
matrix:
python-version: [ "3.9" ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
Expand All @@ -53,10 +50,10 @@ jobs:
pypi.org:443
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python${{ matrix.python-version }}
- name: Set up Python3
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
python-version: "3.x"
cache: 'pip'
- name: Install CI libraries
run: |
Expand All @@ -82,7 +79,7 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: [ "3.9" ]
python-version: [ "3.10" ]
testdata-cache: [ '~/.cache/xclim-testdata' ]
steps:
- name: Harden Runner
Expand Down Expand Up @@ -153,20 +150,20 @@ jobs:
- os: 'windows-latest'
testdata-cache: 'C:\Users\runneradmin\AppData\Local\xclim-testdata\xclim-testdata\Cache'
markers: -m 'not slow'
python-version: "3.9"
tox-env: py39-coverage-prefetch # Test data prefetch is needed for Windows
python-version: "3.10"
tox-env: py310-coverage-prefetch # Test data prefetch is needed for Windows
# macOS builds
- os: 'macos-latest'
testdata-cache: '~/Library/Caches/xclim-testdata'
markers: '' # Slow tests
python-version: "3.10"
tox-env: py310-coverage-extras
python-version: "3.11"
tox-env: py311-coverage-extras
# Specialized tests
- os: 'ubuntu-latest'
testdata-cache: '~/.cache/xclim-testdata'
markers: -m 'not requires_internet and not slow'
python-version: "3.9"
tox-env: py39-coverage-offline-prefetch
python-version: "3.11"
tox-env: py311-coverage-sbck-offline-prefetch
- os: 'ubuntu-latest'
testdata-cache: '~/.cache/xclim-testdata'
markers: '' # No markers for notebooks
Expand Down Expand Up @@ -198,7 +195,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install Eigen3 (SBCK)
if: ${{ matrix.python-version == '3.11' }}
if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install libeigen3-dev
Expand Down Expand Up @@ -247,7 +244,7 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: [ "3.9", "3.12" ]
python-version: [ "3.10", "3.12" ]
testdata-cache: [ '~/.cache/xclim-testdata' ]
defaults:
run:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ v0.53.0 (unreleased)
--------------------
Contributors to this version: Adrien Lamarche (:user:`LamAdr`), Trevor James Smith (:user:`Zeitsperre`), Éric Dupuis (:user:`coxipi`), Pascal Bourgault (:user:`aulemahal`).

Announcements
^^^^^^^^^^^^^
* `xclim` has now adopted the `Scientific Python SPEC 0 <https://scientific-python.org/specs/spec-0000/>`_ conventions for its suggested dependency support schedule. (:issue:`1914`, :pull:`1915`).
* `xclim` has dropped support for Python 3.9 and adopted Python 3.10+ code styling conventions. (:issue:`1914`, :pull:`1915`).

New indicators
^^^^^^^^^^^^^^
* New ``heat_spell_frequency``, ``heat_spell_max_length`` and ``heat_spell_total_length`` : spell length statistics on a bivariate condition that uses the average over a window by default. (:pull:`1885`).
Expand All @@ -25,6 +30,7 @@ Breaking changes
* `platformdirs` is no longer a direct dependency of `xclim`, but `pooch` is required to use many of the new testing functions (installable via `pip install pooch` or `pip install 'xclim[dev]'`). (:pull:`1889`).
* The following previously-deprecated functions have now been removed from `xclim`: ``xclim.core.calendar.convert_calendar``, ``xclim.core.calendar.date_range``, ``xclim.core.calendar.date_range_like``, ``xclim.core.calendar.interp_calendar``, ``xclim.core.calendar.days_in_year``, ``xclim.core.calendar.datetime_to_decimal_year``. For guidance on how to migrate to alternatives, see the `version 0.50.0 Breaking changes <#v0-50-0-2024-06-17>`_. (:issue:`1010`, :pull:`1845`).
* `transform` argument of `OTC/dOTC` classes (and child functions) is changed to `normalization`, and `numIterMax` is changed to `num_iter_max` in `utils.optimal_transport` (:pull:`1896`).
* `xclim` now requires `numpy >=1.23.0` and `scikit-learn >=1.1.0`, as well as (optionally) `ipython >=8.5.0`, `nbsphinx >=0.9.5`, and `matplotlib >=3.6.0` . (:issue:`1914`, :pull:`1915`).

Internal changes
^^^^^^^^^^^^^^^^
Expand Down
5 changes: 2 additions & 3 deletions CI/requirements_ci.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
bump-my-version==0.26.1
coveralls==4.0.1
deptry==0.20.0
flit==3.9.0
pip==24.2
pip==24.2.0
pylint==3.2.7
tox==4.19.0
tox-gh==1.3.3
tox-gh==1.4.1
75 changes: 5 additions & 70 deletions CI/requirements_ci.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --generate-hashes --output-file=CI/requirements_ci.txt CI/requirements_ci.in
Expand Down Expand Up @@ -135,64 +135,6 @@ colorama==0.4.6 \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
# via tox
coverage[toml]==7.6.0 \
--hash=sha256:0086cd4fc71b7d485ac93ca4239c8f75732c2ae3ba83f6be1c9be59d9e2c6382 \
--hash=sha256:01c322ef2bbe15057bc4bf132b525b7e3f7206f071799eb8aa6ad1940bcf5fb1 \
--hash=sha256:03cafe82c1b32b770a29fd6de923625ccac3185a54a5e66606da26d105f37dac \
--hash=sha256:044a0985a4f25b335882b0966625270a8d9db3d3409ddc49a4eb00b0ef5e8cee \
--hash=sha256:07ed352205574aad067482e53dd606926afebcb5590653121063fbf4e2175166 \
--hash=sha256:0d1b923fc4a40c5832be4f35a5dab0e5ff89cddf83bb4174499e02ea089daf57 \
--hash=sha256:0e7b27d04131c46e6894f23a4ae186a6a2207209a05df5b6ad4caee6d54a222c \
--hash=sha256:1fad32ee9b27350687035cb5fdf9145bc9cf0a094a9577d43e909948ebcfa27b \
--hash=sha256:289cc803fa1dc901f84701ac10c9ee873619320f2f9aff38794db4a4a0268d51 \
--hash=sha256:3c59105f8d58ce500f348c5b56163a4113a440dad6daa2294b5052a10db866da \
--hash=sha256:46c3d091059ad0b9c59d1034de74a7f36dcfa7f6d3bde782c49deb42438f2450 \
--hash=sha256:482855914928c8175735a2a59c8dc5806cf7d8f032e4820d52e845d1f731dca2 \
--hash=sha256:49c76cdfa13015c4560702574bad67f0e15ca5a2872c6a125f6327ead2b731dd \
--hash=sha256:4b03741e70fb811d1a9a1d75355cf391f274ed85847f4b78e35459899f57af4d \
--hash=sha256:4bea27c4269234e06f621f3fac3925f56ff34bc14521484b8f66a580aacc2e7d \
--hash=sha256:4d5fae0a22dc86259dee66f2cc6c1d3e490c4a1214d7daa2a93d07491c5c04b6 \
--hash=sha256:543ef9179bc55edfd895154a51792b01c017c87af0ebaae092720152e19e42ca \
--hash=sha256:54dece71673b3187c86226c3ca793c5f891f9fc3d8aa183f2e3653da18566169 \
--hash=sha256:6379688fb4cfa921ae349c76eb1a9ab26b65f32b03d46bb0eed841fd4cb6afb1 \
--hash=sha256:65fa405b837060db569a61ec368b74688f429b32fa47a8929a7a2f9b47183713 \
--hash=sha256:6616d1c9bf1e3faea78711ee42a8b972367d82ceae233ec0ac61cc7fec09fa6b \
--hash=sha256:6fe885135c8a479d3e37a7aae61cbd3a0fb2deccb4dda3c25f92a49189f766d6 \
--hash=sha256:7221f9ac9dad9492cecab6f676b3eaf9185141539d5c9689d13fd6b0d7de840c \
--hash=sha256:76d5f82213aa78098b9b964ea89de4617e70e0d43e97900c2778a50856dac605 \
--hash=sha256:7792f0ab20df8071d669d929c75c97fecfa6bcab82c10ee4adb91c7a54055463 \
--hash=sha256:831b476d79408ab6ccfadaaf199906c833f02fdb32c9ab907b1d4aa0713cfa3b \
--hash=sha256:9146579352d7b5f6412735d0f203bbd8d00113a680b66565e205bc605ef81bc6 \
--hash=sha256:9cc44bf0315268e253bf563f3560e6c004efe38f76db03a1558274a6e04bf5d5 \
--hash=sha256:a73d18625f6a8a1cbb11eadc1d03929f9510f4131879288e3f7922097a429f63 \
--hash=sha256:a8659fd33ee9e6ca03950cfdcdf271d645cf681609153f218826dd9805ab585c \
--hash=sha256:a94925102c89247530ae1dab7dc02c690942566f22e189cbd53579b0693c0783 \
--hash=sha256:ad4567d6c334c46046d1c4c20024de2a1c3abc626817ae21ae3da600f5779b44 \
--hash=sha256:b2e16f4cd2bc4d88ba30ca2d3bbf2f21f00f382cf4e1ce3b1ddc96c634bc48ca \
--hash=sha256:bbdf9a72403110a3bdae77948b8011f644571311c2fb35ee15f0f10a8fc082e8 \
--hash=sha256:beb08e8508e53a568811016e59f3234d29c2583f6b6e28572f0954a6b4f7e03d \
--hash=sha256:c4cbe651f3904e28f3a55d6f371203049034b4ddbce65a54527a3f189ca3b390 \
--hash=sha256:c7b525ab52ce18c57ae232ba6f7010297a87ced82a2383b1afd238849c1ff933 \
--hash=sha256:ca5d79cfdae420a1d52bf177de4bc2289c321d6c961ae321503b2ca59c17ae67 \
--hash=sha256:cdab02a0a941af190df8782aafc591ef3ad08824f97850b015c8c6a8b3877b0b \
--hash=sha256:d17c6a415d68cfe1091d3296ba5749d3d8696e42c37fca5d4860c5bf7b729f03 \
--hash=sha256:d39bd10f0ae453554798b125d2f39884290c480f56e8a02ba7a6ed552005243b \
--hash=sha256:d4b3cd1ca7cd73d229487fa5caca9e4bc1f0bca96526b922d61053ea751fe791 \
--hash=sha256:d50a252b23b9b4dfeefc1f663c568a221092cbaded20a05a11665d0dbec9b8fb \
--hash=sha256:da8549d17489cd52f85a9829d0e1d91059359b3c54a26f28bec2c5d369524807 \
--hash=sha256:dcd070b5b585b50e6617e8972f3fbbee786afca71b1936ac06257f7e178f00f6 \
--hash=sha256:ddaaa91bfc4477d2871442bbf30a125e8fe6b05da8a0015507bfbf4718228ab2 \
--hash=sha256:df423f351b162a702c053d5dddc0fc0ef9a9e27ea3f449781ace5f906b664428 \
--hash=sha256:dff044f661f59dace805eedb4a7404c573b6ff0cdba4a524141bc63d7be5c7fd \
--hash=sha256:e7e128f85c0b419907d1f38e616c4f1e9f1d1b37a7949f44df9a73d5da5cd53c \
--hash=sha256:ed8d1d1821ba5fc88d4a4f45387b65de52382fa3ef1f0115a4f7a20cdfab0e94 \
--hash=sha256:f2501d60d7497fd55e391f423f965bbe9e650e9ffc3c627d5f0ac516026000b8 \
--hash=sha256:f7db0b6ae1f96ae41afe626095149ecd1b212b424626175a6633c2999eaad45b
# via coveralls
coveralls==4.0.1 \
--hash=sha256:7a6b1fa9848332c7b2221afb20f3df90272ac0167060f41b5fe90429b30b1809 \
--hash=sha256:7b2a0a2bcef94f295e3cf28dcc55ca40b71c77d1c2446b538e85f0f7bc21aa69
# via -r CI/requirements_ci.in
deptry==0.20.0 \
--hash=sha256:012fb106dbea6ca95196cdcd75ac90c516c8f01292f7934f2e802a7cf025a660 \
--hash=sha256:0c90ce64e637d0e902bc97c5a020adecfee9e9f09ee0bf4c61554994139bebdb \
Expand All @@ -215,9 +157,6 @@ distlib==0.3.8 \
--hash=sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784 \
--hash=sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64
# via virtualenv
docopt==0.6.2 \
--hash=sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491
# via coveralls
docutils==0.21.2 \
--hash=sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f \
--hash=sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2
Expand Down Expand Up @@ -401,9 +340,7 @@ questionary==2.0.1 \
requests==2.32.3 \
--hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \
--hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6
# via
# coveralls
# flit
# via flit
rich==13.7.1 \
--hash=sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222 \
--hash=sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432
Expand All @@ -418,7 +355,6 @@ tomli==2.0.1 \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
# via
# coverage
# deptry
# pylint
# pyproject-api
Expand All @@ -439,9 +375,9 @@ tox==4.19.0 \
# via
# -r CI/requirements_ci.in
# tox-gh
tox-gh==1.3.3 \
--hash=sha256:7a05f176ab2180554ada4fc74fd25529d8470d8944d99ac77dfa7b0773a20e25 \
--hash=sha256:99cfcac42706c6b5f4656ca1a4b5fe50b1f1d2c14549c0a542469fb679d29a3f
tox-gh==1.4.1 \
--hash=sha256:005b33d16eef1bd1dae9f7d8b3cef53374af7d475f9c9c33ef098247741fb694 \
--hash=sha256:da422beccbdc5ad5994fe8faf6c193f2d794e957628b052ba23e7fcf9e2e340f
# via -r CI/requirements_ci.in
typing-extensions==4.12.2 \
--hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \
Expand All @@ -450,7 +386,6 @@ typing-extensions==4.12.2 \
# astroid
# pydantic
# pydantic-core
# pylint
# rich-click
urllib3==2.2.2 \
--hash=sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472 \
Expand Down
22 changes: 16 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ Ready to contribute? Here's how to set up `xclim` for local development.

Alternatively, one can use ``$ tox`` to run very specific testing configurations, as GitHub Workflows would do when a Pull Request is submitted and new commits are pushed::

$ tox -e py39-coverage # run tests on Python 3.9, reporting code coverage
$ tox -e py310-upstream # run tests on Python 3.10, with upstream dependencies
$ tox -e py310-coverage # run tests on Python 3.10, reporting code coverage
$ tox -e py313-upstream # run tests on Python 3.13, with upstream dependencies
$ tox -e py311-prefetch-offline -- -m "not slow" # run tests on Python 3.11, force download of testing, ensure tests are all offline, exclude "slow" marked tests
$ tox -e py312-lmoments -- -m "not slow" # run tests on Python 3.12, installing lmoments3, excluding "slow" marked tests
$ tox -e notebooks,doctests # run the notebook-based tests, then run the doctests
Expand Down Expand Up @@ -227,15 +227,18 @@ Before you submit a pull request, please follow these guidelines:

.. warning::
Try to keep your contributions within the scope of the issue that you are addressing.
While it might be tempting to fix other aspects of the library as it comes up, it's better to simply to flag the problems in case others are already working on it.
While it might be tempting to fix other aspects of the library as it comes up,
it's better to simply to flag the problems in case others are already working on it.

Consider adding a "**# TODO:**" or "**# FIXME:**" comment if the need arises.

#. Pull requests should raise test coverage for the xclim library. Code coverage is an indicator of how extensively tested the library is.

If you are adding a new set of functions, they **must be tested** and **coverage percentage should not significantly decrease.**

#. If the pull request adds functionality, your functions should include docstring explanations. So long as the docstrings are syntactically correct, sphinx-autodoc will be able to automatically parse the information. Please ensure that the docstrings and documentation adhere to the following standards (badly formed docstrings will fail build tests):
#. If the pull request adds functionality, your functions should include docstring explanations.
So long as the docstrings are syntactically correct, sphinx-autodoc will be able to automatically parse the information.
Please ensure that the docstrings and documentation adhere to the following standards (badly formed docstrings will fail build tests):

* `numpydoc`_
* `reStructuredText (ReST)`_
Expand All @@ -244,17 +247,24 @@ Before you submit a pull request, please follow these guidelines:
If you aren't accustomed to writing documentation in reStructuredText (`.rst`), we encourage you to spend a few minutes going over the
incredibly well-summarized `reStructuredText Primer`_ from the sphinx-doc maintainer community.

#. The pull request should work for Python 3.9, 3.10, 3.11, and 3.12 as well as raise test coverage.
#. The pull request should work for all currently-supported Python versions as well as raise test coverage.
Pull requests are also checked for documentation build status and for `PEP8`_ compliance.

The build statuses and build errors for pull requests can be found at: https://github.com/Ouranosinc/xclim/actions

.. note::
The currently-supported Python versions are loosely based on the Scientific Python Ecosystem's `SPEC 0` schedule.
Generally, when `numpy` and `xarray` drop support for a dependency, `xclim` will follow suit in a subsequent release.
For more information, see the `SPEC 0 Schedule <https://scientific-python.org/specs/spec-0000/>`_

.. warning::
PEP8, black, pytest (with xdoctest) and pydocstyle (for numpy docstrings) conventions are strongly enforced.
Ensure that your changes pass all tests prior to pushing your final commits to your branch.
Code formatting errors are treated as build errors and will block your pull request from being accepted.

#. The version changes (CHANGELOG.rst) should briefly describe changes introduced in the Pull request. Changes should be organized by type (ie: `New indicators`, `New features and enhancements`, `Breaking changes`, `Bug fixes`, `Internal changes`) and the GitHub Pull Request, GitHub Issue. Your name and/or GitHub handle should also be listed among the contributors to this version. This can be done as follows::
#. The version changes (CHANGELOG.rst) should briefly describe changes introduced in the Pull request.
Changes should be organized by type (ie: `New indicators`, `New features and enhancements`, `Breaking changes`, `Bug fixes`, `Internal changes`) and the GitHub Pull Request, GitHub Issue.
Your name and/or GitHub handle should also be listed among the contributors to this version. This can be done as follows::

Contributors to this version: John Jacob Jingleheimer Schmidt (:user:`username`).

Expand Down
4 changes: 2 additions & 2 deletions docs/notebooks/analogs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"sim_std = convert_calendar(sim, \"standard\")\n",
"obs_chibou = obs.sel(lat=sim.lat, lon=sim.lon, method=\"nearest\")\n",
"\n",
"for ax, var in zip(axs, obs_chibou.data_vars.keys()):\n",
"for ax, var in zip(axs, obs_chibou.data_vars.keys(), strict=False):\n",
" obs_chibou[var].plot(ax=ax, label=\"Observation\")\n",
" sim_std[var].plot(ax=ax, label=\"Simulation\")\n",
" ax.set_title(obs_chibou[var].long_name)\n",
Expand Down Expand Up @@ -233,7 +233,7 @@
"import time\n",
"\n",
"fig, axs = plt.subplots(4, 2, sharex=True, sharey=True, figsize=(10, 10))\n",
"for metric, ax in zip(analog.metrics.keys(), axs.flatten()):\n",
"for metric, ax in zip(analog.metrics.keys(), axs.flatten(), strict=False):\n",
" start = time.perf_counter()\n",
" results = analog.spatial_analogs(sim, obs, method=metric)\n",
" print(f\"Metric {metric} took {time.perf_counter() - start:.0f} s.\")\n",
Expand Down
4 changes: 3 additions & 1 deletion docs/notebooks/benchmarks/sdba_quantile.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@
" sdba.nbutils.quantile(da, **kws).compute()\n",
" timed[use_fnq].append([size, time.time() - t0])\n",
"\n",
"for k, lab in zip([True, False], [\"xclim.core.utils.nan_quantile\", \"fastnanquantile\"]):\n",
"for k, lab in zip(\n",
" [True, False], [\"xclim.core.utils.nan_quantile\", \"fastnanquantile\"], strict=False\n",
"):\n",
" arr = np.array(timed[k])\n",
" plt.plot(arr[:, 0], arr[:, 1] / num_tests, label=lab)\n",
"plt.legend()\n",
Expand Down
6 changes: 4 additions & 2 deletions docs/notebooks/ensembles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
"fig, ax = plt.subplots(figsize=(6, 4))\n",
"mean_delta.plot(ax=ax)\n",
"# For each flag value plot the corresponding hatch.\n",
"for val, ha in zip(robustness.flag_values, [None, \"\\\\\\\\\\\\\", \"xxx\"]):\n",
"for val, ha in zip(robustness.flag_values, [None, \"\\\\\\\\\\\\\", \"xxx\"], strict=False):\n",
" ax.pcolor(\n",
" robustness.lon,\n",
" robustness.lat,\n",
Expand All @@ -445,7 +445,9 @@
"ax.legend(\n",
" handles=[\n",
" Rectangle((0, 0), 2, 2, fill=False, hatch=h, label=lbl)\n",
" for h, lbl in zip([\"\\\\\\\\\\\\\", \"xxx\"], robustness.flag_descriptions[1:])\n",
" for h, lbl in zip(\n",
" [\"\\\\\\\\\\\\\", \"xxx\"], robustness.flag_descriptions[1:], strict=False\n",
" )\n",
" ],\n",
" bbox_to_anchor=(0.0, 1.1),\n",
" loc=\"upper left\",\n",
Expand Down
Loading

0 comments on commit ba5901d

Please sign in to comment.