From 0167568d54d62e3647a0002d9428b0f8499fbdd2 Mon Sep 17 00:00:00 2001 From: Georgios Efstathiadis Date: Wed, 29 Nov 2023 13:36:28 -0500 Subject: [PATCH 1/3] additional frequency names --- forest/constants.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/forest/constants.py b/forest/constants.py index 8d95f4ce..0d933e8b 100644 --- a/forest/constants.py +++ b/forest/constants.py @@ -20,13 +20,19 @@ class Frequency(Enum): """This class enumerates possible frequencies for summary data.""" - MINUTELY = 1 + MINUTE = 1 HOURLY = 60 + HOUR = 60 THREE_HOURLY = 3 * 60 + THREE_HOURS = 3 * 60 SIX_HOURLY = 6 * 60 + SIX_HOURS = 6 * 60 TWELVE_HOURLY = 12 * 60 + TWELVE_HOURS = 12 * 60 DAILY = 24 * 60 + DAY = 24 * 60 HOURLY_AND_DAILY = -1 + HOUR_AND_DAY = -1 class OSMTags(Enum): From c633af66c8ca3fc92986df4471035a0d13363508 Mon Sep 17 00:00:00 2001 From: Georgios Efstathiadis Date: Wed, 29 Nov 2023 13:39:30 -0500 Subject: [PATCH 2/3] replace MINUTELY with MINUTE --- forest/jasmine/traj2stats.py | 4 ++-- forest/oak/base.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/forest/jasmine/traj2stats.py b/forest/jasmine/traj2stats.py index da6ca15c..79e887a7 100644 --- a/forest/jasmine/traj2stats.py +++ b/forest/jasmine/traj2stats.py @@ -1125,7 +1125,7 @@ def gps_summaries( ValueError: Frequency is not valid """ - if frequency in [Frequency.HOURLY_AND_DAILY, Frequency.MINUTELY]: + if frequency in [Frequency.HOURLY_AND_DAILY, Frequency.MINUTE]: raise ValueError(f"Frequency cannot be {frequency.name.lower()}.") if frequency != Frequency.DAILY: @@ -1600,7 +1600,7 @@ def gps_stats_main( """ # no minutely analysis on GPS data - if frequency == Frequency.MINUTELY: + if frequency == Frequency.MINUTE: raise ValueError("Frequency cannot be minutely.") os.makedirs(output_folder, exist_ok=True) diff --git a/forest/oak/base.py b/forest/oak/base.py index 2fbe1c8e..a2e484e6 100644 --- a/forest/oak/base.py +++ b/forest/oak/base.py @@ -602,7 +602,7 @@ def run(study_folder: str, output_folder: str, tz_str: Optional[str] = None, or frequency == Frequency.HOURLY ): freq = 'H' - elif frequency == Frequency.MINUTELY: + elif frequency == Frequency.MINUTE: freq = 'T' else: freq = str(frequency.value/60) + 'H' @@ -653,7 +653,7 @@ def run(study_folder: str, output_folder: str, tz_str: Optional[str] = None, ] # transform t to full hours t_series = pd.Series(t_datetime) - if frequency == Frequency.MINUTELY: + if frequency == Frequency.MINUTE: t_hours_pd = t_series.dt.floor('T') else: t_hours_pd = t_series.dt.floor('H') From 8ec0bf77ee56280d38195f78ec73034c70b9ef97 Mon Sep 17 00:00:00 2001 From: Georgios Efstathiadis Date: Sun, 3 Dec 2023 16:21:08 -0500 Subject: [PATCH 3/3] remove duplicate frequencies --- forest/constants.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/forest/constants.py b/forest/constants.py index 0d933e8b..420d8c8d 100644 --- a/forest/constants.py +++ b/forest/constants.py @@ -22,17 +22,11 @@ class Frequency(Enum): """This class enumerates possible frequencies for summary data.""" MINUTE = 1 HOURLY = 60 - HOUR = 60 THREE_HOURLY = 3 * 60 - THREE_HOURS = 3 * 60 SIX_HOURLY = 6 * 60 - SIX_HOURS = 6 * 60 TWELVE_HOURLY = 12 * 60 - TWELVE_HOURS = 12 * 60 DAILY = 24 * 60 - DAY = 24 * 60 HOURLY_AND_DAILY = -1 - HOUR_AND_DAY = -1 class OSMTags(Enum):