Skip to content
Snippets Groups Projects
Commit 6d08b814 authored by Niklas Selke's avatar Niklas Selke
Browse files

Added a custom sampling option to aggregate over the full time series time span.

parent 1ca21b88
No related branches found
No related tags found
2 merge requests!11Added a custom sampling option to aggregate over the full time series time span,!10Resolve "Allow for arbitrary sampling intervals"
...@@ -74,7 +74,7 @@ def test_calculate_statistics_run_all_statistics_with_all_samplings( ...@@ -74,7 +74,7 @@ def test_calculate_statistics_run_all_statistics_with_all_samplings(
elif statistic == "percentiles1": elif statistic == "percentiles1":
expected_num_columns *= 3 expected_num_columns *= 3
elif statistic == "percentiles2": elif statistic == "percentiles2":
if sampling in {"daily", "monthly", "seasonal", "vegseason"}: if sampling not in {"summer", "xsummer", "annual"}:
expected_num_columns *= 7 expected_num_columns *= 7
else: else:
expected_num_columns *= 9 expected_num_columns *= 9
......
...@@ -16,7 +16,8 @@ ALLOWED_SAMPLING_VALUES = [ ...@@ -16,7 +16,8 @@ ALLOWED_SAMPLING_VALUES = [
"vegseason", "vegseason",
"summer", "summer",
"xsummer", "xsummer",
"annual" "annual",
"custom"
] ]
STATISTICS_LIST = [ STATISTICS_LIST = [
...@@ -156,5 +157,6 @@ RSTAGS = { ...@@ -156,5 +157,6 @@ RSTAGS = {
"seasonal": "AS", "seasonal": "AS",
"summer": "AS", "summer": "AS",
"xsummer": "AS", "xsummer": "AS",
"annual": "AS" "annual": "AS",
"custom": "100AS"
} }
...@@ -26,7 +26,7 @@ def calculate_statistics( ...@@ -26,7 +26,7 @@ def calculate_statistics(
:param sampling: temporal aggregation, one of ``daily``, :param sampling: temporal aggregation, one of ``daily``,
``monthly``, ``seasonal``, ``vegseason``, ``monthly``, ``seasonal``, ``vegseason``,
``summer``, ``xsummer``, or ``annual``; ``summer``, ``xsummer``, ``annual``, or ``custom``;
``summer`` will pick the 6-months summer season in ``summer`` will pick the 6-months summer season in
the hemisphere where the station is located; the hemisphere where the station is located;
``xsummer`` does the same for a 7-months summer ``xsummer`` does the same for a 7-months summer
......
...@@ -484,7 +484,7 @@ def diurnal_cycle(ser, ref, mtype, metadata, seasons, min_data_capture): ...@@ -484,7 +484,7 @@ def diurnal_cycle(ser, ref, mtype, metadata, seasons, min_data_capture):
# data record. # data record.
nyears = ser.index.year.unique().size nyears = ser.index.year.unique().size
vmax = {"daily": 1, "monthly": 29, "seasonal": 91, "summer": 182, 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) dcap = int(min_data_capture * vmax[mtype] * nyears)
for r in res: for r in res:
grouped = r["ser"].groupby(r["ser"].index.hour) grouped = r["ser"].groupby(r["ser"].index.hour)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment