Commit 6ea37fc3 authored by Niklas Selke's avatar Niklas Selke
Browse files

Added a check for the 'data_capture' argument in ''. The check...

Added a check for the 'data_capture' argument in ''. The check function is included in ''.
parent 69d0ff78
......@@ -7,6 +7,7 @@ check_data - check the given data argument
check_metadata - check the given metadata argument
check_seasons - check the given seasons argument
check_crops - check the given crops argument
check_data_capture - check the given data capture argument
from collections import namedtuple
......@@ -197,3 +198,18 @@ def check_crops(crops_in):
if not crops_out:
return None
return crops_out
def check_data_capture(data_capture_in):
"""Check the given data capture argument.
:param data_capture_in: the given data capture argument
:return: The processed data capture argument or None if there was a
problem while processing the given data capture argument
if not isinstance(data_capture_in, (float, int)):
return None
if not 0 <= data_capture_in <= 1:
return None
return data_capture_in
......@@ -4,9 +4,10 @@ This module contains the following function:
calculate_statistics - calculate the requested statistics
from toarstats.input_checks import (check_crops, check_data, check_metadata,
check_sampling, check_seasons,
from toarstats.input_checks import (
check_crops, check_data, check_data_capture, check_metadata,
check_sampling, check_seasons, check_statistics
def calculate_statistics(
......@@ -100,3 +101,4 @@ def calculate_statistics(
seasons_list = check_seasons(seasons)
crops_list = check_crops(crops)
data_capture_value = check_data_capture(data_capture)
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