local weather function added
This commit is contained in:
parent
278bef064c
commit
a2bb733b05
2 changed files with 17 additions and 8 deletions
|
|
@ -20,6 +20,8 @@ LOG = logging.getLogger(__name__)
|
|||
minutes_since_midnight = typing.NewType('minutes_since_midnight', int)
|
||||
|
||||
|
||||
|
||||
|
||||
# Used to declare when an attribute of a class must have a value provided, and
|
||||
# there should be no default value used.
|
||||
_NO_DEFAULT = object()
|
||||
|
|
@ -263,7 +265,7 @@ class FormData:
|
|||
month = datetime_object.month
|
||||
|
||||
inside_temp = models.PiecewiseConstant((0, 24), (293,))
|
||||
outside_temp = data.GenevaTemperatures[month]
|
||||
outside_temp = data.Temperatures[str(month)]
|
||||
|
||||
ventilation: models.Ventilation
|
||||
if self.window_type == 'window_sliding':
|
||||
|
|
|
|||
21
cara/data.py
21
cara/data.py
|
|
@ -1,8 +1,15 @@
|
|||
import numpy as np
|
||||
from cara import models
|
||||
import json
|
||||
|
||||
def location_celcius_per_hour (lat, long):
|
||||
pass
|
||||
weather_station = "067000-99999" #this is the Cointrin station for Geneva
|
||||
|
||||
def location_celcius_per_hour(w_station):
|
||||
with open("/Users/jdevine/cara_rep/cara/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]
|
||||
print(Location_hourly_temperatures_celsius_per_hour)
|
||||
return Location_hourly_temperatures_celsius_per_hour
|
||||
|
||||
|
||||
# average temperature of each month, hour per hour (from midnight to 11 pm)
|
||||
|
|
@ -37,14 +44,14 @@ Geneva_hourly_temperatures_celsius_per_hour = {
|
|||
|
||||
|
||||
# Geneva hourly temperatures as piecewise constant function (in Kelvin)
|
||||
GenevaTemperatures_hourly = {
|
||||
Temperatures_hourly = {
|
||||
month: models.PiecewiseConstant(tuple(np.arange(25.)),
|
||||
tuple(273.15+np.array(temperatures)))
|
||||
for month,temperatures in Geneva_hourly_temperatures_celsius_per_hour.items()
|
||||
for month,temperatures in location_celcius_per_hour(weather_station).items()
|
||||
}
|
||||
# same temperatures on a finer temperature mesh
|
||||
GenevaTemperatures = {
|
||||
month: GenevaTemperatures_hourly[month].refine(refine_factor=4)
|
||||
for month,temperatures in Geneva_hourly_temperatures_celsius_per_hour.items()
|
||||
Temperatures = {
|
||||
month: Temperatures_hourly[month].refine(refine_factor=4)
|
||||
for month,temperatures in location_celcius_per_hour(weather_station).items()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue