Skip to content
Snippets Groups Projects
Commit 8af6b3e8 authored by Carsten Hinz's avatar Carsten Hinz
Browse files

bug fix.

In dataclass attributes with an explicit setter to restrict the valid parameters are treated as having a default value by python

changed constructor of MetaData
parent 04d52c62
No related branches found
No related tags found
1 merge request!11Creation of first beta release version
{
"cSpell.words": [
"timeseries"
]
}
\ No newline at end of file
...@@ -81,7 +81,7 @@ def time_rest_client_response(start, end): ...@@ -81,7 +81,7 @@ def time_rest_client_response(start, end):
use_downloaded=False, use_downloaded=False,
) )
time_window = TimeSample(start, end, SAMPLING) time_window = TimeSample(start, end, SAMPLING)
sample = Metadata.construct("mole_fraction_of_ozone_in_air", STATISTIC, time_window) sample = Metadata.construct("mole_fraction_of_ozone_in_air", time_window, STATISTIC)
timer_start = datetime.now() timer_start = datetime.now()
wait_for_client_response(rest_client, sample) wait_for_client_response(rest_client, sample)
......
...@@ -44,7 +44,7 @@ def toar_variable_ozon(): ...@@ -44,7 +44,7 @@ def toar_variable_ozon():
@pytest.fixture @pytest.fixture
def metadata_ozone_mean(toar_variable_ozon, time): def metadata_ozone_mean(toar_variable_ozon, time):
return Metadata(toar_variable_ozon, "mean", time) return Metadata(toar_variable_ozon, time, "mean")
def load_local_data(*args, **kwargs): def load_local_data(*args, **kwargs):
......
...@@ -40,7 +40,7 @@ def get_gridded_toar_data( ...@@ -40,7 +40,7 @@ def get_gridded_toar_data(
""" """
metadatas = [ metadatas = [
Metadata.construct(var, stat, time) for var, stat in product(variables, stats) Metadata.construct(var, time, stat) for var, stat in product(variables, stats)
] ]
datasets = [] datasets = []
......
...@@ -88,18 +88,17 @@ class Metadata: ...@@ -88,18 +88,17 @@ class Metadata:
---------- ----------
variable: variable:
support variable of the TOAR data base support variable of the TOAR data base
statistics:
statistical processing applied by the TOAR database for this request
time: time:
requested time points requested time points
statistics:
statistical processing applied by the TOAR database for this request
""" """
variable: TOARVariable variable: TOARVariable
statistic: str
time: TimeSample time: TimeSample
statistic: str
@staticmethod @staticmethod
def construct(standart_name: str, stat: str, time: TimeSample): def construct(standart_name: str, time: TimeSample, stat: str):
"""constructor """constructor
Parameters: Parameters:
...@@ -115,7 +114,7 @@ class Metadata: ...@@ -115,7 +114,7 @@ class Metadata:
variable = TOARVariable.get(standart_name) variable = TOARVariable.get(standart_name)
return Metadata(variable, stat, time) return Metadata(variable, time, stat)
@property @property
def statistic(self) -> str: # TODO make better def statistic(self) -> str: # TODO make better
...@@ -127,7 +126,7 @@ class Metadata: ...@@ -127,7 +126,7 @@ class Metadata:
return self._statistic return self._statistic
@statistic.setter @statistic.setter
def statistics(self, stat : str): def statistic(self, stat : str):
if stat not in STATISTICS_LIST: if stat not in STATISTICS_LIST:
raise ValueError(f"invalid statistic: {stat}") raise ValueError(f"invalid statistic: {stat}")
self._statistic = stat self._statistic = stat
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment