Skip to content

Commit

Permalink
Merge pull request #40 from metno/isin
Browse files Browse the repository at this point in the history
Use isin instead of in1d to avoid deprecation warnings
  • Loading branch information
lewisblake authored Jul 16, 2024
2 parents 385f83e + ce1344d commit 23c785b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/pyaro/timeseries/Filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit 23c785b

Please sign in to comment.