OSOceanAcoustics / echopype

Enabling interoperability and scalability in ocean sonar data analysis
https://echopype.readthedocs.io/
Apache License 2.0
89 stars 70 forks source link

Resolve deprecation warnings re: `datatree`, `xr.drop_var`, `numpy.array_equal` #1309

Open leewujung opened 2 months ago

leewujung commented 2 months ago

There are multiple deprecation warnings that we should address in the next release.

One of the warning is related to the use of pkg_resources in datatree, but our datatree version is pinned to a pretty old version. This one may take some more time.

../../miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/datatree/__init__.py:4
  /Users/wujung/miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/datatree/__init__.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import DistributionNotFound, get_distribution

../../miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/pkg_resources/__init__.py:2832
../../miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/pkg_resources/__init__.py:2832
../../miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/pkg_resources/__init__.py:2832
../../miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/pkg_resources/__init__.py:2832
../../miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/pkg_resources/__init__.py:2832
../../miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/pkg_resources/__init__.py:2832
  /Users/wujung/miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/pkg_resources/__init__.py:2832: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

echopype/tests/calibrate/test_calibrate_ek80.py::test_ek80_BB_complex_multiplex_NaNs_and_non_NaNs[NYOS2105-D20210525-T213648.raw-target_channel_ping_pattern0]
echopype/tests/calibrate/test_calibrate_ek80.py::test_ek80_BB_complex_multiplex_NaNs_and_non_NaNs[NYOS2105-D20210525-T213648.raw-target_channel_ping_pattern0]
  /Users/wujung/code_git/echopype/echopype/calibrate/cal_params.py:318: DeprecationWarning: dropping variables using `drop` is deprecated; use drop_vars.
    da_param = da_param.drop(plb_var)

echopype/tests/calibrate/test_calibrate_ek80.py::test_ek80_BB_complex_multiplex_NaNs_and_non_NaNs[NYOS2105-D20210525-T213648.raw-target_channel_ping_pattern0]
  /Users/wujung/code_git/echopype/echopype/calibrate/range.py:187: DeprecationWarning: dropping variables using `drop` is deprecated; use drop_vars.
    valid_idx = ~beam["backscatter_r"].isel(beam=0).drop("beam").isnull()

echopype/tests/calibrate/test_calibrate_ek80.py::test_ek80_BB_complex_multiplex_NaNs_and_non_NaNs[NYOS2105-D20210525-T213648.raw-target_channel_ping_pattern0]
  /Users/wujung/miniconda3/envs/echopype_20240415/lib/python3.9/site-packages/dask/array/core.py:1712: FutureWarning: The `numpy.array_equal` function is not implemented by Dask array. You may want to use the da.map_blocks function or something similar to silence this warning. Your code may stop working in a future release.
    warnings.warn(

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