Skip to content
Snippets Groups Projects
Commit 3a74f016 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Adjusting to namespace in result keys

parent 28eb78bf
No related branches found
No related tags found
No related merge requests found
...@@ -75,15 +75,15 @@ class ReferenceModel(VIPSModel): ...@@ -75,15 +75,15 @@ class ReferenceModel(VIPSModel):
# Calculate day degrees from sowingDate and as far as weather data goes # Calculate day degrees from sowingDate and as far as weather data goes
# Adjusting for base temperature # Adjusting for base temperature
self.df["TMContrib"] = self.df["TM"].apply(get_temp_adjusted_for_base, args=(5,)) self.df["WEATHER.TMContrib"] = self.df["TM"].apply(get_temp_adjusted_for_base, args=(5,))
# Aggregating the day degrees # Aggregating the day degrees
self.df["TMDD"] = self.df["TMContrib"].cumsum() self.df["WEATHER.TMDD"] = self.df["WEATHER.TMContrib"].cumsum()
# Adding the thresholds to the data frame # Adding the thresholds to the data frame
self.df["THRESHOLD_LOW"] = ReferenceModel.THRESHOLD_LOW self.df["%s.THRESHOLD_LOW" % self.MODEL_ID] = ReferenceModel.THRESHOLD_LOW
self.df["THRESHOLD_MEDIUM"] = ReferenceModel.THRESHOLD_MEDIUM self.df["%s.THRESHOLD_MEDIUM" % self.MODEL_ID] = ReferenceModel.THRESHOLD_MEDIUM
self.df["THRESHOLD_HIGH"] = ReferenceModel.THRESHOLD_HIGH self.df["%s.THRESHOLD_HIGH" % self.MODEL_ID] = ReferenceModel.THRESHOLD_HIGH
# For each day: check accumulated day-degrees and decide warning status # For each day: check accumulated day-degrees and decide warning status
self.df["WARNING_STATUS"] = self.df["TMDD"].apply(self.determine_warning_status) self.df["WARNING_STATUS"] = self.df["WEATHER.TMDD"].apply(self.determine_warning_status)
#print(self.df) #print(self.df)
result = get_result_list_from_dataframe(self.df) result = get_result_list_from_dataframe(self.df)
#print(result) #print(result)
......
...@@ -58,7 +58,7 @@ class TestReferenceModel(unittest.TestCase): ...@@ -58,7 +58,7 @@ class TestReferenceModel(unittest.TestCase):
self.assertIsNotNone(result_list) self.assertIsNotNone(result_list)
last_result = result_list[len(result_list)-1] last_result = result_list[len(result_list)-1]
self.assertIsNotNone(result_list[0].valid_time_start) self.assertIsNotNone(result_list[0].valid_time_start)
self.assertEqual(555.8507083333333, last_result.get_value("TMDD")) self.assertEqual(555.8507083333333, last_result.get_value("WEATHER","TMDD"))
def test_get_model_id(self): def test_get_model_id(self):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment