diff --git a/server/map_handler/add_new_lake.py b/server/map_handler/add_new_lake.py index 6588cd11b9ac954b3374b691c9a61921be5cef74..aa6b9c8b5b814d029e6b980279465ba496a335d3 100644 --- a/server/map_handler/add_new_lake.py +++ b/server/map_handler/add_new_lake.py @@ -98,7 +98,7 @@ def cut_map(self, cursor, lake_name: str, cell_size_in_km: float = 0.5): 'features': features } - # Add lake name to database + # Check if the name exists in the database cursor.execute(''' SELECT Name FROM BodyOfWater WHERE Name = ?; ''', (lake_name,)) @@ -195,8 +195,8 @@ def write_json_to_file(lake_name: str, map_data: dict): # Plotting the map can take a considerable amount of time, especially when creating maps with many -# subdivisions. Removing calls to plot_map will speed up the process, but it is recommended to plot the map -# after each division to ensure that the map was divided as intended. +# subdivisions. Removing calls to plot_map will speed up the process, but it is highly recommended +# to plot the map after each division to ensure that the map was divided as intended. def plot_map(divided_map): """ Plots a divided map using matplotlib. diff --git a/server/map_handler/unit_tests/__init__.py b/server/map_handler/unit_tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/server/map_handler/unit_tests/test_add_new_lake.py b/server/map_handler/unit_tests/test_add_new_lake.py new file mode 100644 index 0000000000000000000000000000000000000000..cc2442a5f511e2be80b77ff2a8ea91bf97972991 --- /dev/null +++ b/server/map_handler/unit_tests/test_add_new_lake.py @@ -0,0 +1,5 @@ +from server.map_handler.add_new_lake import create_grid + +#def tes_create_grid_default(): + #grid = create_grid(0.2, 0.3) + #assert \ No newline at end of file diff --git a/server/map_handler/update_measurements.py b/server/map_handler/update_measurements.py index 44a5f10f9a31067b1ef374431d78ffbebe706b7f..2e07a875b4a54dd1f90a44049a65895423083ca7 100644 --- a/server/map_handler/update_measurements.py +++ b/server/map_handler/update_measurements.py @@ -55,9 +55,6 @@ def update_measurements(self, lake_name: str): avg_thickness = sub_division['AvgThickness'] # Retrieve ice statistics for current subdivision - temp_to_date = "2024-10-12" - temp_from_date = "2024-10-19" - #ice_stats = get_raw_dates(ice_prognosis_raw_data(sub_div_id=subdiv_id, x=center_lat, y=center_lng), to_date=temp_to_date,from_date=temp_from_date) ice_stats = get_raw_dates(ice_prognosis_raw_data(sub_div_id=subdiv_id, x=center_lat, y=center_lng)) # Ice statistics were retrieved successfully @@ -169,9 +166,6 @@ def fill_remaining_subdivisions(lake_name: str, processed_ids: list): center_lng = round(sub_div['properties']['sub_div_center'][1], 4) # 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_to_date = "2024-10-12" - # temp_from_date = "2024-10-19" ice_stats = get_raw_dates(ice_prognosis_raw_data(sub_div_id=sub_div_id, x=center_lat, y=center_lng)) if len(ice_stats) > 0 and len(ice_stats[0]) > 0: