Skip to content
Snippets Groups Projects
Commit 61cf2351 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: bugged attempt at setting ice stats date

parent 36ed3f5b
No related branches found
No related tags found
1 merge request!16Clhp map into main
This diff is collapsed.
No preview for this file type
......@@ -112,7 +112,6 @@ def update_measurements(self, lake_name: str):
self.send_header("Content-type", "application/json")
self.end_headers()
print("Reached exception. Right before self")
self.wfile.write(f"Error in updating measurements: {e}".encode('utf-8'))
......@@ -144,10 +143,16 @@ def fill_remaining_subdivisions(lake_name: str, processed_ids: list):
# Fetch weather data for each subdivision from the NVE model
# NB hard coded date to december 2024 for testing, remove to_date param before use
# temp_date = datetime(2024, 12, 12)
#temp_date = [datetime(2023, 12, 12)]
ice_stats = get_raw_dates(ice_prognosis_raw_data(sub_div_id=sub_div_id, x=center_lat, y=center_lng))
total_ice_thickness = ice_stats[0]['Total ice (m)']
print("Came here: ", sub_div_id)
if len(ice_stats) > 0 and len(ice_stats[0]) > 0:
total_ice_thickness = ice_stats[0]['Total ice (m)']
else:
print("Total ice is none: ", sub_div_id)
total_ice_thickness = 0
# Create new subdivision object
sub_division = {
'SubdivID': sub_div_id,
......@@ -162,6 +167,7 @@ def fill_remaining_subdivisions(lake_name: str, processed_ids: list):
'Color': calculateColor(random.randint(0, 20)), # NB placeholder
'IceStats': ice_stats,
}
print("Came here 2: ", sub_div_id)
sub_divisions.append(sub_division)
return sub_divisions
......
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