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(
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
......
......@@ -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"
}
......@@ -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
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment