ESMValGroup / ESMValTool

ESMValTool: A community diagnostic and performance metrics tool for routine evaluation of Earth system models in CMIP
https://www.esmvaltool.org
Apache License 2.0
210 stars 121 forks source link

Update `scipy.integrate.simps` import #3701

Closed ehogan closed 23 hours ago

ehogan commented 1 day ago

Describe the bug From the ESMValCore v2.11.0rc2 testing, the scipy.integrate.simps import has been updated to scipy.integrate.simpson in SciPy v1.14.0 (which is what the environment created for the ESMValCore v2.11.0rc2 testing picked up), see https://docs.scipy.org/doc/scipy/release/1.14.0-notes.html#expired-deprecations:

(rc1-env) % conda list scipy
# packages in environment at /miniforge3/envs/rc1-env:
#
# Name                    Version                   Build  Channel
scipy                     1.13.0          py311h517d4fd_1    conda-forge
(rc2-env) % conda list scipy
# packages in environment at /miniforge3/envs/rc2-env:
#
# Name                    Version                   Build  Channel
scipy                     1.14.0          py311h517d4fd_0    conda-forge

From recipe_cox18nature.yml

  File "/miniforge3/envs/rc2-env/lib/python3.11/site-packages/esmvaltool/diag_scripts/emergent_constraints/__init__.py", line 1676, in <listcomp>
    cum_dens = [integrate.simps(pdf[:idx], data[:idx]) for idx in idx_range]
                ^^^^^^^^^^^^^^^
AttributeError: module 'scipy.integrate' has no attribute 'simps'. Did you mean: 'simpson'?

The imports should be updated to work in both cases 👍

ehogan commented 1 day ago

A PR is on its way! I tested the changes with the rc1 environment and the rc2 environment, then compared the outputs using compare.py; the runs were identical 👍