Skip to content
Snippets Groups Projects
Commit 6e19aa1a authored by am0ebe's avatar am0ebe
Browse files

add time_of_day col to ecolux

parent 9c6a38f1
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
["ecotrack","./ecotrack/in","./ecotrack/out/II","2019-08-05","2019-09-27"],
["ecotrack","./ecotrack/in","./ecotrack/out/III","2019-09-27","2019-11-20"],
["ecotrack","./ecotrack/in","./ecotrack/out/all","2019-06-29","2019-11-01"],
["ecotrack","./ecotrack/in","./blatrack","2019-10-12","2019-10-15"],
["ecotrack","./ecotrack/in","./blatrack","2019-10-12","2019-10-13"],
["ecolux","./ecolux/I/01-raw","./blalux","2020-09-01","2020-09-02"]
],
"blox" :
......
......@@ -5,7 +5,7 @@
# output one huge table with all necessary fields for further processing/vizualization
#
############################
# TODO / MISC
# TODO / MISC / Q
############################
# rewrite conf.json structure to reflect projects > [conf, blox]
# > ecotrack time is in CEST (both track and temp) => UTC+2 => C'est une problème?
......@@ -30,8 +30,8 @@ from pprint import pp as p
from datetime import datetime as dt
import dataFilter
try:
scriptpath=os.path.dirname(os.path.realpath(__file__))
sys.path.append(scriptpath + os.sep + "skyglow")
scriptpath = os.path.dirname(os.path.realpath(__file__))
sys.path.append( scriptpath + os.sep + "skyglow" )
from skyglow import moon as moonMap
from skyglow import skyglowDict
except ModuleNotFoundError as e:
......@@ -50,7 +50,7 @@ NO_MERGE=False
# month, sunrise, sunset
# sa: https://www.laenderdaten.info/Europa/Deutschland/sonnenuntergang.php
suntimes = [
( datetime.time(8,7),datetime.time(16,24) ),
( datetime.time(8,7),datetime.time(16,24) ), #january
( datetime.time(7,20),datetime.time(17,20) ),
( datetime.time(6,18),datetime.time(18,12) ),
( datetime.time(6,5),datetime.time(20,6) ),
......@@ -61,7 +61,7 @@ suntimes = [
( datetime.time(6,39),datetime.time(19,23) ),
( datetime.time(7,30),datetime.time(18,13) ),
( datetime.time(7,26),datetime.time(16,15) ),
( datetime.time(8,8),datetime.time(15,54) ),
( datetime.time(8,8),datetime.time(15,54) ), #december
]
def isDay( cur ):
......@@ -358,7 +358,7 @@ class Data:
for daynight in [0,1]:
for uid in range(N_UNITS):
for block, temps in self.meanTemps[daynight][uid].items():
#Assert: temps is a list of floats
#Note: temps is a tuple of floats
# -> all temp-values for uid and block
tmin = min(temps)
tmax = max(temps)
......@@ -366,6 +366,7 @@ class Data:
self.meanTemps[daynight][uid][block] = tmean, tmin, tmax #replace list with tuple of mean, min, max
#add (night,day)*(mean,min,max) to tempData
for uid in range(N_UNITS):
for idx,lst in enumerate( self.tempData[uid] ):
time = lst[0]
......@@ -375,14 +376,13 @@ class Data:
else:
temps = self.meanTemps[0][uid][block] + self.meanTemps[1][uid][block]
# if isDay(time):
# temps += "day"
# else:
# temps += "night"
self.tempData[uid][idx].extend( temps )
if isDay(time):
self.tempData[uid][idx].append("day")
else:
self.tempData[uid][idx].append("night")
def calc_mean_for_sensor_values_for_uid_and_time(self,uid,prev_time):
# 4 sensor-values (usually)
mean = calc_mean(self.tempData[uid][-1][1:])
......@@ -556,8 +556,14 @@ class Data:
temp_indices[uid] += 1
# add cols (temp,mean_day_temp, mean_night_temp)
for temp in self.tempData[uid][temp_indices[uid]][1:]:
trackLine += DELIM + f"%.{temp_precision}f"%temp #fill up to temp_precision digits after comma
for temp in self.tempData[uid][temp_indices[uid]][1:-1]:
#fill up to temp_precision digits after comma
trackLine += DELIM + f"%.{temp_precision}f"%temp
# add daynight col
trackLine += DELIM + self.tempData[uid][temp_indices[uid]][-1]
self.trackData[track_idx] = trackLine
track_idx+=1
......@@ -616,7 +622,7 @@ class Data:
if hasLight():
h+=', moon_real[mLux], moon_eco[mLux], skyglow[Lux]'
if hasTemp():
h+=', temp[C°], mean_night_temp[C°], min_night_temp[C°], max_night_temp[C°], mean_day_temp[C°], min_day_temp[C°], max_day_temp[C°], is_day'
h+=', temp[C°], mean_night_temp[C°], min_night_temp[C°], max_night_temp[C°], mean_day_temp[C°], min_day_temp[C°], max_day_temp[C°], time_of_day'
h +="\n" + RULER + "\n"
return h
......
Subproject commit 4076189110e3cbd75146a335c8954923e3959d27
Subproject commit 04c1d61535d26a4590b37d0e5d888e83ac20a567
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment