diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py index 69f2576a..af4dd2e3 100644 --- a/cara/apps/calculator/model_generator.py +++ b/cara/apps/calculator/model_generator.py @@ -107,8 +107,8 @@ class FormData: 'infected_lunch_start': '12:30', 'infected_people': _NO_DEFAULT, 'infected_start': '08:30', - 'location': 'Geneva', - 'location_coordinates': '(46.2044, 6.1432)', + 'location': _NO_DEFAULT, + 'location_coordinates': _NO_DEFAULT, 'weather_station_location':'GENEVA COINTRIN', 'weather_station_ref': '067000-99999', 'mask_type': 'Type I', @@ -268,11 +268,10 @@ class FormData: datetime_object = datetime.datetime.strptime(self.event_month[:3], "%b") month = datetime_object.month - #set location + # set location self.weather_station_location = data.location_to_weather_stn(self.location_coordinates)[1] - print('wstn resolve location_', data.location_to_weather_stn(self.location_coordinates)[1]) data.local_temperatures = data.location_celcius_per_hour(self.location_coordinates) - print('inputcoords_', self.location_coordinates) + inside_temp = models.PiecewiseConstant((0, 24), (293,)) outside_temp = data.Temperatures[str(month)] diff --git a/cara/apps/calculator/templates/base/calculator.report.html.j2 b/cara/apps/calculator/templates/base/calculator.report.html.j2 index b0adb4f7..46e397a0 100644 --- a/cara/apps/calculator/templates/base/calculator.report.html.j2 +++ b/cara/apps/calculator/templates/base/calculator.report.html.j2 @@ -54,8 +54,9 @@
Room Volume: {{ model.concentration_model.room.volume }} m³
Room Central Heating: {{ "On" if form.room_heating_option else "Off" }}
Geographic Location: {{ form.location }}
Nearest weather station: {{ form.weather_station_location }}
Nearest weather station: {{ form.weather_station_location }}
Ventilation data:
diff --git a/cara/data.py b/cara/data.py index 57958b1b..ed46af81 100644 --- a/cara/data.py +++ b/cara/data.py @@ -2,32 +2,19 @@ import numpy as np from cara import models import json import urllib.request -import numpy as np from pathlib import Path from scipy.spatial import cKDTree import os -#items to pass into this module -calc_location = (46.2044, 6.1432) - -#items to return to model -#w_station - -weather_station = "" #"067000-99999" this is the Cointrin station for Geneva -weather_station_name = "" -weather_debug = True +weather_debug = False def location_to_weather_stn(location_loc): #expects a tuple (lat, long) #returns: weather station ID, weather station name, weather station lat, long - print('location_loc,', location_loc) - - search_coords = location_loc.split(',') #[location_loc[0], location_loc[1]] - print('location_searchcoords,', search_coords) - + search_coords = location_loc.split(',') lat=[] long=[] station_array=[] @@ -62,7 +49,6 @@ def location_celcius_per_hour(location): #expects a tuple (lat, long) #returns a json format set of weather data w_station = location_to_weather_stn(location) - print(os.getcwd()) with open(Path(os.getcwd()+"/cara/global_weather_set.json"), "r") as json_file: weather_dict = json.load(json_file) Location_hourly_temperatures_celsius_per_hour = weather_dict[w_station[0]] diff --git a/setup.py b/setup.py index a70d5237..0c32040f 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,8 @@ REQUIREMENTS: dict = { 'psutil', 'qrcode[pil]', 'scipy', + 'pathlib', + 'urllib.request', 'sklearn', 'tornado', 'voila >=0.2.4',