From ce1344d70da5ffeba688ef40f4c0203632d17fa8 Mon Sep 17 00:00:00 2001 From: Heiko Klein Date: Tue, 16 Jul 2024 09:33:19 +0200 Subject: [PATCH] use isin instead of in1d to avoid deprecation warnings --- setup.cfg | 2 +- src/pyaro/timeseries/Filter.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index f16f812..b26a7ce 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,7 +23,7 @@ url = https://pyaro.readthedocs.io [options] python_version = >=3.10 install_requires = - numpy + numpy >= 1.13 importlib-metadata >= 3.6; python_version < "3.10" package_dir = =src diff --git a/src/pyaro/timeseries/Filter.py b/src/pyaro/timeseries/Filter.py index 40f4cf0..06402ff 100644 --- a/src/pyaro/timeseries/Filter.py +++ b/src/pyaro/timeseries/Filter.py @@ -310,7 +310,7 @@ def filter_data_idx(self, data: Data, stations: dict[str, Station], variables: s stat_names = self.filter_stations(stations).keys() dstations = data.stations stat_names = np.fromiter(stat_names, dtype=dstations.dtype) - index = np.in1d(dstations, stat_names) + index = np.isin(dstations, stat_names) return index @@ -495,7 +495,7 @@ def usable_flags(self): def filter_data_idx(self, data: Data, stations: dict[str, Station], variables: str): validflags = np.fromiter(self._valid, dtype=data.flags.dtype) - index = np.in1d(data.flags, validflags) + index = np.isin(data.flags, validflags) return index @@ -712,7 +712,7 @@ def filter_data_idx(self, data: Data, stations: dict[str, Station], variables: s end_time_dt = datetime.strptime(end_time, self.time_format) dstations = data.stations stat_names = np.fromiter(stations, dtype=dstations.dtype) - exclude_idx = np.in1d(dstations, stat_names) + exclude_idx = np.isin(dstations, stat_names) exclude_idx &= (start_time_dt <= data.start_times) & ( end_time_dt > data.start_times )