Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbjoernl committed Sep 4, 2024
1 parent 58ecadf commit 469c76e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pyaro/timeseries/Filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,9 @@ def __init__(self, min_altitude: float | None = None, max_altitude: float | None
"""
:param min_altitude : float of minimum altitude in meters required to keep the station.
:param max_altitude : float of maximum altitude in meters required to keep the station.
Stations will be kept if min_altitude ≤ x ≤ max_altitude where x is the elevation of the
station. If station elevation is nan, it is always excluded.
"""
if min_altitude is not None and max_altitude is not None:
if min_altitude > max_altitude:
Expand All @@ -848,9 +851,9 @@ def name(self):

def filter_stations(self, stations: dict[str, Station]) -> dict[str, Station]:
if self._min_altitude is not None:
stations = {n: s for n, s in stations.items() if (math.isnan(s["altitude"]) or s["altitude"] >= self._min_altitude) }
stations = {n: s for n, s in stations.items() if (not math.isnan(s["altitude"]) and s["altitude"] >= self._min_altitude) }

if self._max_altitude is not None:
stations = {n: s for n, s in stations.items() if (math.isnan(s["altitude"]) or s["altitude"] <= self._max_altitude) }
stations = {n: s for n, s in stations.items() if (not math.isnan(s["altitude"]) and s["altitude"] <= self._max_altitude) }

return stations

0 comments on commit 469c76e

Please sign in to comment.