Deltares / hatyan

Harmonic tidal analysis and prediction
https://deltares.github.io/hatyan/
GNU General Public License v3.0
13 stars 2 forks source link

fix numpy and pandas deprecationwarning #319

Closed veenstrajelmer closed 2 weeks ago

veenstrajelmer commented 2 months ago

FutureWarning Minute.delta:

tests/test_timeseries.py::test_resample_timeseries
  /home/runner/work/hatyan/hatyan/tests/test_timeseries.py:358: FutureWarning: Minute.delta is deprecated and will be removed in a future version. Use pd.Timedelta(obj) instead
    assert np.isclose(ts_prediction_res.index.freq.delta.total_seconds(), 60*timestep_min)

DeprecationWarning in np.in1d:

tests/test_cli.py: 1 warning
tests/test_hatyan.py: 18 warnings
tests/test_metadata.py: 2 warnings
tests/test_timeseries.py: 2 warnings
  /home/runner/work/hatyan/hatyan/hatyan/timeseries.py:110: DeprecationWarning: `in1d` is deprecated. Use `np.isin` instead.
    LWid_main = LWid_main_raw[np.in1d(LWid_main_raw,validtimes_idx)]
tests/test_cli.py: 1 warning
tests/test_hatyan.py: 18 warnings
tests/test_metadata.py: 2 warnings
tests/test_timeseries.py: 2 warnings
  /home/runner/work/hatyan/hatyan/hatyan/timeseries.py:111: DeprecationWarning: `in1d` is deprecated. Use `np.isin` instead.
    HWid_main = HWid_main_raw[np.in1d(HWid_main_raw,validtimes_idx)]
tests/test_hatyan.py::test_frommergedcomp_HWLW_345[HOEKVHLD]
tests/test_hatyan.py::test_frommergedcomp_HWLW_345[DENHDR]
tests/test_hatyan.py::test_hwlw_numbering_aggers
tests/test_hatyan.py::test_hwlw_numbering_aggers
  /home/runner/work/hatyan/hatyan/hatyan/timeseries.py:[127](https://github.com/Deltares/hatyan/actions/runs/9413410495/job/26639319654#step:7:127): DeprecationWarning: `in1d` is deprecated. Use `np.isin` instead.
    LW_local_bool = ~np.in1d(LWid_all, LWid_main)
tests/test_hatyan.py::test_frommergedcomp_HWLW_345[HOEKVHLD]
tests/test_hatyan.py::test_frommergedcomp_HWLW_345[DENHDR]
tests/test_hatyan.py::test_hwlw_numbering_aggers
tests/test_hatyan.py::test_hwlw_numbering_aggers
  /home/runner/work/hatyan/hatyan/hatyan/timeseries.py:[130](https://github.com/Deltares/hatyan/actions/runs/9413410495/job/26639319654#step:7:130): DeprecationWarning: `in1d` is deprecated. Use `np.isin` instead.
    HW_local_bool = ~np.in1d(HWid_all, HWid_main)