From 577d3019e3c9da7618cada202e0251a10800f898 Mon Sep 17 00:00:00 2001 From: Heiko Klein Date: Tue, 12 Nov 2024 16:56:31 +0100 Subject: [PATCH] more fixes --- docs/how-to-add-new-reader.rst | 4 ++-- src/pyaro/timeseries/Filter.py | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/how-to-add-new-reader.rst b/docs/how-to-add-new-reader.rst index c725f1a..12f831e 100644 --- a/docs/how-to-add-new-reader.rst +++ b/docs/how-to-add-new-reader.rst @@ -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. @@ -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 diff --git a/src/pyaro/timeseries/Filter.py b/src/pyaro/timeseries/Filter.py index f5758a8..95f3634 100644 --- a/src/pyaro/timeseries/Filter.py +++ b/src/pyaro/timeseries/Filter.py @@ -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__( @@ -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=""): @@ -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: