opera-adt / COMPASS

COregistered Multi-temPorAl Sar Slc
Apache License 2.0
39 stars 18 forks source link

interp2d` is deprecated in SciPy 1.10 and will be removed in SciPy 1.12.0. #98

Open scottstanie opened 1 year ago

scottstanie commented 1 year ago

Low priority, but let's change the iono.py interpolation code so we get rid of the DeprecationWarning

$ pytest

tests/test_ionex.py::test_get_ionex_value
  /Users/staniewi/repos/COMPASS/src/compass/utils/iono.py:156: DeprecationWarning: `interp2d` is deprecated!
  `interp2d` is deprecated in SciPy 1.10 and will be removed in SciPy 1.12.0.

  For legacy code, nearly bug-for-bug compatible replacements are
  `RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
  scattered 2D data.

  In new code, for regular grids use `RegularGridInterpolator` instead.
  For scattered data, prefer `LinearNDInterpolator` or
  `CloughTocher2DInterpolator`.

  For more details see
  `https://gist.github.com/ev-br/8544371b40f414b7eaf3fe6217209bff`

    tec_val = interpolate.interp2d(
vbrancat commented 1 year ago

@scottstanie Has this been addressed? I believe we have taken care of this as I do not see this message when processing.

scottstanie commented 1 year ago

Nope I think the code will still start erroring with scipy 1.13. Try running pytest tests/test_ionex.py.

https://scipy.github.io/devdocs/notebooks/interp_transition_guide.html

$ pytest  tests/test_ionex.py
================================================================================================ test session starts =================================================================================================
platform darwin -- Python 3.10.9, pytest-7.1.2, pluggy-1.0.0
Using --randomly-seed=350643922
rootdir: /Users/staniewi/repos/COMPASS
plugins: anyio-3.6.1, randomly-3.10.1, xdist-3.1.0, dash-2.7.0, hypothesis-6.56.4, cov-3.0.0
collected 2 items

tests/test_ionex.py ..                                                                                                                                                                                         [100%]

================================================================================================== warnings summary ==================================================================================================
../../miniconda3/envs/mapping/lib/python3.10/site-packages/matplotlib/__init__.py:152
../../miniconda3/envs/mapping/lib/python3.10/site-packages/matplotlib/__init__.py:152
../../miniconda3/envs/mapping/lib/python3.10/site-packages/matplotlib/__init__.py:152
../../miniconda3/envs/mapping/lib/python3.10/site-packages/matplotlib/__init__.py:152
../../miniconda3/envs/mapping/lib/python3.10/site-packages/matplotlib/__init__.py:152
  /Users/staniewi/miniconda3/envs/mapping/lib/python3.10/site-packages/matplotlib/__init__.py:152: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(module.__version__) < minver:

../../miniconda3/envs/mapping/lib/python3.10/site-packages/setuptools/_distutils/version.py:346
../../miniconda3/envs/mapping/lib/python3.10/site-packages/setuptools/_distutils/version.py:346
../../miniconda3/envs/mapping/lib/python3.10/site-packages/setuptools/_distutils/version.py:346
../../miniconda3/envs/mapping/lib/python3.10/site-packages/setuptools/_distutils/version.py:346
../../miniconda3/envs/mapping/lib/python3.10/site-packages/setuptools/_distutils/version.py:346
  /Users/staniewi/miniconda3/envs/mapping/lib/python3.10/site-packages/setuptools/_distutils/version.py:346: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    other = LooseVersion(other)

tests/test_ionex.py::test_get_ionex_value
  /Users/staniewi/repos/COMPASS/src/compass/utils/iono.py:157: DeprecationWarning: `interp2d` is deprecated!
  `interp2d` is deprecated in SciPy 1.10 and will be removed in SciPy 1.12.0.

  For legacy code, nearly bug-for-bug compatible replacements are
  `RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
  scattered 2D data.

  In new code, for regular grids use `RegularGridInterpolator` instead.
  For scattered data, prefer `LinearNDInterpolator` or
  `CloughTocher2DInterpolator`.

  For more details see
  `https://gist.github.com/ev-br/8544371b40f414b7eaf3fe6217209bff`

    tec_val = interpolate.interp2d(

tests/test_ionex.py::test_get_ionex_value
  /Users/staniewi/repos/COMPASS/src/compass/utils/iono.py:157: DeprecationWarning:         `interp2d` is deprecated!
          `interp2d` is deprecated in SciPy 1.10 and will be removed in SciPy 1.12.0.

          For legacy code, nearly bug-for-bug compatible replacements are
          `RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
          scattered 2D data.

          In new code, for regular grids use `RegularGridInterpolator` instead.
          For scattered data, prefer `LinearNDInterpolator` or
          `CloughTocher2DInterpolator`.

          For more details see
          `https://gist.github.com/ev-br/8544371b40f414b7eaf3fe6217209bff`

    tec_val = interpolate.interp2d(

tests/test_ionex.py: 13 warnings
  /Users/staniewi/repos/COMPASS/src/compass/utils/iono.py:181: DeprecationWarning: `interp2d` is deprecated!
  `interp2d` is deprecated in SciPy 1.10 and will be removed in SciPy 1.12.0.

  For legacy code, nearly bug-for-bug compatible replacements are
  `RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
  scattered 2D data.

  In new code, for regular grids use `RegularGridInterpolator` instead.
  For scattered data, prefer `LinearNDInterpolator` or
  `CloughTocher2DInterpolator`.

  For more details see
  `https://gist.github.com/ev-br/8544371b40f414b7eaf3fe6217209bff`

    interpolate.interp2d(

tests/test_ionex.py::test_get_ionex_value
  /Users/staniewi/repos/COMPASS/src/compass/utils/iono.py:123: DeprecationWarning:         `interp2d` is deprecated!
          `interp2d` is deprecated in SciPy 1.10 and will be removed in SciPy 1.12.0.

          For legacy code, nearly bug-for-bug compatible replacements are
          `RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
          scattered 2D data.

          In new code, for regular grids use `RegularGridInterpolator` instead.
          For scattered data, prefer `LinearNDInterpolator` or
          `CloughTocher2DInterpolator`.

          For more details see
          `https://gist.github.com/ev-br/8544371b40f414b7eaf3fe6217209bff`

    tec_val0 = interpfs[ind0](lon0, lat)

tests/test_ionex.py::test_get_ionex_value
  /Users/staniewi/repos/COMPASS/src/compass/utils/iono.py:124: DeprecationWarning:         `interp2d` is deprecated!
          `interp2d` is deprecated in SciPy 1.10 and will be removed in SciPy 1.12.0.

          For legacy code, nearly bug-for-bug compatible replacements are
          `RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
          scattered 2D data.

          In new code, for regular grids use `RegularGridInterpolator` instead.
          For scattered data, prefer `LinearNDInterpolator` or
          `CloughTocher2DInterpolator`.

          For more details see
          `https://gist.github.com/ev-br/8544371b40f414b7eaf3fe6217209bff`

    tec_val1 = interpfs[ind1](lon1, lat)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html