Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
heikoklein committed Nov 12, 2024
1 parent cedd786 commit 577d301
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/how-to-add-new-reader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ with :py:meth:`~pyaro.list_timeseries_readers()`.
TimeseriesEngine/Reader subclassing
+++++++++++++++++++++++++++++++++++

It is strongly advised to use the use the helper classes :py:class:`~pyaro.timeseries.AutoFilterReaderEngine.AutoFilterEngine`
It is strongly advised to use the use the helper classes :py:class:`~pyaro.timeseries.AutoFilterReaderEngine.AutoFilterEngine`
and :py:class:`~pyaro.timeseries.AutoFilterReaderEngine.AutoFilterReader` to implement a Engine and a Reader since Filters will
automatically be handled then.

Expand All @@ -42,7 +42,7 @@ The ``YourReader`` should extend :py:class:`~pyaro.timeseries.AutoFilterReaderEn

- the ``__init__`` method of :py:class:`~pyaro.timeseries.Reader` with two fixed args (`self` and `filename_or_obj_or_url`) and several kwargs,
one of them should be `filters`
- it must store the `filters` calling `self._set_filters(filters)`
- it must store the `filters` calling `self._set_filters(filters)`
- the :py:meth:`~pyaro.timeseries.AutoFilterReaderEngine.AutoFilterReader._unfiltered_data` method
- the :py:meth:`~pyaro.timeseries.AutoFilterReaderEngine.AutoFilterReader._unfiltered_stations` method
- the :py:meth:`~pyaro.timeseries.AutoFilterReaderEngine.AutoFilterReader._unfiltered_variables` method
Expand Down
26 changes: 14 additions & 12 deletions src/pyaro/timeseries/Filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,20 +551,22 @@ class TimeBoundsFilter(DataIndexFilter):
Examples:
end_include: [("2023-01-01 10:00:00", "2024-01-01 07:00:00")]
end_include: `[("2023-01-01 10:00:00", "2024-01-01 07:00:00")]`
will only include observations where the end time of each observation
is within the interval specified
(i.e. "end" >= 2023-01-01 10:00:00 and "end" <= "2024-01-01 07:00:00")
Including multiple bounds will act as an OR, allowing multiple selections.
If we want every observation in January for 2021, 2022, 2023, and 2024 this
could be made as the following filter:
startend_include: [
("2021-01-01 00:00:00", "2021-02-01 00:00:00"),
("2022-01-01 00:00:00", "2022-02-01 00:00:00"),
("2023-01-01 00:00:00", "2023-02-01 00:00:00"),
("2024-01-01 00:00:00", "2024-02-01 00:00:00"),
]
could be made as the following filter::
startend_include: [
("2021-01-01 00:00:00", "2021-02-01 00:00:00"),
("2022-01-01 00:00:00", "2022-02-01 00:00:00"),
("2023-01-01 00:00:00", "2023-02-01 00:00:00"),
("2024-01-01 00:00:00", "2024-02-01 00:00:00"),
]
"""

def __init__(
Expand Down Expand Up @@ -711,9 +713,11 @@ class TimeVariableStationFilter(DataIndexFilter):
:param exclude_from_csvfile: this is a helper option to enable a large list of excludes
to be read from a "\t" separated file with columns
start \t end \t variable \t station
where start and end are timestamps of format YYYY-MM-DD HH:MM:SS in UTC, e.g.
the year 2020 is:
2020-01-01 00:00:00 \t 2020-12-31 23:59:59 \t ...
"""

def __init__(self, exclude=[], exclude_from_csvfile=""):
Expand Down Expand Up @@ -1023,10 +1027,8 @@ def UNITS_METER(self): #: :meta private:
def topography(self): #: :meta private:
"""Internal property, don't use.
:raises ModuleNotFoundError: _description_
:raises ModuleNotFoundError: _description_
:raises FilterException: _description_
:raises FilterException: _description_
:raises ModuleNotFoundError: if cf-units or xarray is not installed
:raises FilterException: if topograpy file is not provided
:return: topography as internal representation
"""
if "cf_units" not in sys.modules:
Expand Down

0 comments on commit 577d301

Please sign in to comment.