Tidied up outputs. Core functionality now working.

This commit is contained in:
jdevine 2021-08-10 18:28:42 +02:00
parent 82ef77fc22
commit f61a41deb7
4 changed files with 11 additions and 23 deletions

View file

@ -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)]

View file

@ -54,8 +54,9 @@
<li><p class="data_text">Room Volume: {{ model.concentration_model.room.volume }} m³</p></li>
<li><p class="data_text">Room Central Heating: {{ "On" if form.room_heating_option else "Off" }}</p></li>
<li><p class="data_text">Geographic Location: {{ form.location }}</p></li>
<li><p class="data_text">Nearest weather station: {{ form.weather_station_location }}</p></li>
{% if form.ventilation_type == "natural_ventilation"%}
<li><p class="data_text">Nearest weather station: {{ form.weather_station_location }}</p></li>
{% endif %}
</ul>
<p class="data_title">Ventilation data:</p>

View file

@ -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]]

View file

@ -31,6 +31,8 @@ REQUIREMENTS: dict = {
'psutil',
'qrcode[pil]',
'scipy',
'pathlib',
'urllib.request',
'sklearn',
'tornado',
'voila >=0.2.4',