From fb17ba1d7f60af84d2fbd48ab8043dbc1d632285 Mon Sep 17 00:00:00 2001 From: Tomasz Noczynski Date: Tue, 5 Mar 2024 16:25:42 +0100 Subject: [PATCH] Handle `MIN30` resolution --- src/volue/mesh/_common.py | 2 ++ src/volue/mesh/_timeseries.py | 2 ++ src/volue/mesh/tests/test_calculation.py | 1 + 3 files changed, 5 insertions(+) diff --git a/src/volue/mesh/_common.py b/src/volue/mesh/_common.py index 90a27b85..69fc5c0f 100644 --- a/src/volue/mesh/_common.py +++ b/src/volue/mesh/_common.py @@ -366,6 +366,8 @@ def _from_proto_resolution( resolution = Timeseries.Resolution.BREAKPOINT elif proto_resolution.type == type.resources_pb2.Resolution.MIN15: resolution = Timeseries.Resolution.MIN15 + elif proto_resolution.type == type.resources_pb2.Resolution.MIN30: + resolution = Timeseries.Resolution.MIN30 elif proto_resolution.type == type.resources_pb2.Resolution.HOUR: resolution = Timeseries.Resolution.HOUR elif proto_resolution.type == type.resources_pb2.Resolution.DAY: diff --git a/src/volue/mesh/_timeseries.py b/src/volue/mesh/_timeseries.py index 4d7446d7..0e0d11af 100644 --- a/src/volue/mesh/_timeseries.py +++ b/src/volue/mesh/_timeseries.py @@ -48,6 +48,7 @@ class Resolution(Enum): UNSPECIFIED: BREAKPOINT: MIN15: + MIN30: HOUR: DAY: WEEK: @@ -63,6 +64,7 @@ class Resolution(Enum): WEEK = 5 MONTH = 6 YEAR = 7 + MIN30 = 8 class PointFlags(Enum): """ diff --git a/src/volue/mesh/tests/test_calculation.py b/src/volue/mesh/tests/test_calculation.py index 4cd23c95..06bc0784 100644 --- a/src/volue/mesh/tests/test_calculation.py +++ b/src/volue/mesh/tests/test_calculation.py @@ -145,6 +145,7 @@ def test_preparing_transform_request_with_timezone_should_add_this_parameter_to_ "resolution, expected_number_of_points", [ (Timeseries.Resolution.MIN15, 33), + (Timeseries.Resolution.MIN30, 17), (Timeseries.Resolution.HOUR, 9), (Timeseries.Resolution.DAY, 1), (Timeseries.Resolution.WEEK, 1),