diff --git a/tests/test_metrics/test_interface.py b/tests/test_metrics/test_interface.py index ad1dc6375c1b7088516ca68af82bfb65422ab40f..1bf22d7cee9676314d0ba1b4456fa3f15eb421fc 100644 --- a/tests/test_metrics/test_interface.py +++ b/tests/test_metrics/test_interface.py @@ -74,7 +74,7 @@ def test_calculate_statistics_run_all_statistics_with_all_samplings( elif statistic == "percentiles1": expected_num_columns *= 3 elif statistic == "percentiles2": - if sampling in {"daily", "monthly", "seasonal", "vegseason"}: + if sampling not in {"summer", "xsummer", "annual"}: expected_num_columns *= 7 else: expected_num_columns *= 9 diff --git a/toarstats/metrics/constants.py b/toarstats/metrics/constants.py index af2d0aa4e6017db08afb9c0657fa8360348e7d1d..ba019589889c7a2da813cf4d9ee3074e42cccd19 100644 --- a/toarstats/metrics/constants.py +++ b/toarstats/metrics/constants.py @@ -16,7 +16,8 @@ ALLOWED_SAMPLING_VALUES = [ "vegseason", "summer", "xsummer", - "annual" + "annual", + "custom" ] STATISTICS_LIST = [ @@ -156,5 +157,6 @@ RSTAGS = { "seasonal": "AS", "summer": "AS", "xsummer": "AS", - "annual": "AS" + "annual": "AS", + "custom": "100AS" } diff --git a/toarstats/metrics/interface.py b/toarstats/metrics/interface.py index bba7fb5e5233d48c45ce08ad3ac3b01108dc9b05..28c88ae8c6bc14e6f2adfec793fb7dfe43844445 100644 --- a/toarstats/metrics/interface.py +++ b/toarstats/metrics/interface.py @@ -26,7 +26,7 @@ def calculate_statistics( :param sampling: temporal aggregation, one of ``daily``, ``monthly``, ``seasonal``, ``vegseason``, - ``summer``, ``xsummer``, or ``annual``; + ``summer``, ``xsummer``, ``annual``, or ``custom``; ``summer`` will pick the 6-months summer season in the hemisphere where the station is located; ``xsummer`` does the same for a 7-months summer diff --git a/toarstats/metrics/stats.py b/toarstats/metrics/stats.py index b67ba062b493ab2d899218a951fb7e4123ee8037..e7cea61b12eded303b0dda2d953747e9a3de212d 100644 --- a/toarstats/metrics/stats.py +++ b/toarstats/metrics/stats.py @@ -484,7 +484,7 @@ def diurnal_cycle(ser, ref, mtype, metadata, seasons, min_data_capture): # data record. nyears = ser.index.year.unique().size vmax = {"daily": 1, "monthly": 29, "seasonal": 91, "summer": 182, - "xsummer": 212, "annual": 365} + "xsummer": 212, "annual": 365, "custom": 365} dcap = int(min_data_capture * vmax[mtype] * nyears) for r in res: grouped = r["ser"].groupby(r["ser"].index.hour)