Commit 9bce1c32 authored by Niklas Selke's avatar Niklas Selke
Browse files

Added a for loop to 'calculate_statistics' to run all the necessary calculations.

parent f27de1d4
......@@ -4,6 +4,7 @@ This module contains the following function:
calculate_statistics - calculate the requested statistics
"""
from toarstats import stats, ozone_metrics
from toarstats.defaults import DEFAULT_CROPS, DEFAULT_DATA_CAPTURE
from toarstats.input_checks import check_input_parameters
from toarstats.stats_utils import create_reference_data_frame, get_seasons
......@@ -126,3 +127,12 @@ def calculate_statistics(
data_capture_value = 0.5
else:
data_capture_value = DEFAULT_DATA_CAPTURE
results = []
for i, stat in enumerate(input_parameters.statistics):
results.extend(
getattr(stats, stat, getattr(ozone_metrics, stat, None))(
input_parameters.data, reference_data_frame, resample_rule,
input_parameters.metadata, seasons_per_statistic[i],
data_capture_value
)
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment