def init_data_for_day(date_time): for i in range(24): index_data.append(i) for sensor_id in sensors: # process hours for i in index_data: dt = datetime(date_time.year, date_time.month, date_time.day, i) value_data.append(bco.hour_object(dt, sensor_id, i)) label_data.append(get_time_label(i)) # process day for sum values dt = datetime(date_time.year, date_time.month, date_time.day) sum_data.append(bco.day_object(dt, sensor_id))
def init_data_for_month(date_time): for i in range(get_days(date_time.year, date_time.month)): index_data.append(i) for sensor_id in sensors: # process days for i in index_data: dt = datetime(date_time.year, date_time.month, i+1) value_data.append(bco.day_object(dt, sensor_id, i)) label_data.append("%d.%d.%d" % (i+1, date_time.month, date_time.year)) # process month for sum values dt = datetime(date_time.year, date_time.month, 1) sum_data.append(bco.month_object(dt, sensor_id))
def init_data_for_day(self): for i in range(24): self.index_data.append(i) self.label_data.append(self.get_time_label(i)) self.chart_label.append(str(i)) for sensor_id in self.sensors: # process hours for i in self.index_data: dt = datetime(self.date_time.year, self.date_time.month, self.date_time.day, i) self.value_data.append(bco.hour_object(dt, sensor_id, i)) # process day for sum values dt = datetime(self.date_time.year, self.date_time.month, self.date_time.day) self.sum_data.append(bco.day_object(dt, sensor_id))
def init_data_for_month(date_time): for i in range(get_days(date_time.year, date_time.month)): index_data.append(i) for sensor_id in sensors: # process days for i in index_data: dt = datetime(date_time.year, date_time.month, i + 1) value_data.append(bco.day_object(dt, sensor_id, i)) label_data.append("%d.%d.%d" % (i + 1, date_time.month, date_time.year)) # process month for sum values dt = datetime(date_time.year, date_time.month, 1) sum_data.append(bco.month_object(dt, sensor_id))
def init_data_for_month(self): for i in range(self.get_days(self.date_time.year, self.date_time.month)): self.index_data.append(i) self.label_data.append(self.get_day_label(i+1)) self.chart_label.append(str(i+1)) self.url_data.append(self.get_day_url(i+1)) #print self.chart_label for sensor_id in self.sensors: # process days for i in self.index_data: dt = datetime(self.date_time.year, self.date_time.month, i+1) self.value_data.append(bco.day_object(dt, sensor_id, i)) # process month for sum values dt = datetime(self.date_time.year, self.date_time.month, 1) self.sum_data.append(bco.month_object(dt, sensor_id))
def init_data_for_month(self): for i in range(self.get_days(self.date_time.year, self.date_time.month)): self.index_data.append(i) self.label_data.append(self.get_day_label(i + 1)) self.chart_label.append(str(i + 1)) self.url_data.append(self.get_day_url(i + 1)) # print self.chart_label for sensor_id in self.sensors: # process days for i in self.index_data: dt = datetime(self.date_time.year, self.date_time.month, i + 1) self.value_data.append(bco.day_object(dt, sensor_id, i)) # process month for sum values dt = datetime(self.date_time.year, self.date_time.month, 1) self.sum_data.append(bco.month_object(dt, sensor_id))
def init_data_for_last24(self): new_dt = datetime.now()-timedelta(days=1, hours=1) for i in range(24): new_dt = new_dt + timedelta(hours=1) hour = new_dt.hour self.index_data.append(hour) self.label_data.append(self.get_time_label(hour)) self.chart_label.append(str(hour)) print new_dt for sensor_id in self.sensors: # process hours for i in self.index_data: dt = datetime(new_dt.year, new_dt.month, new_dt.day, i) print dt self.value_data.append(bco.hour_object(dt, sensor_id, i)) # process day for sum values dt = datetime(self.date_time.year, self.date_time.month, self.date_time.day) self.sum_data.append(bco.day_object(dt, sensor_id))
def init_data_for_last24(self): new_dt = datetime.now() - timedelta(days=1, hours=1) for i in range(24): new_dt = new_dt + timedelta(hours=1) hour = new_dt.hour self.index_data.append(hour) self.label_data.append(self.get_time_label(hour)) self.chart_label.append(str(hour)) print new_dt for sensor_id in self.sensors: # process hours for i in self.index_data: dt = datetime(new_dt.year, new_dt.month, new_dt.day, i) print dt self.value_data.append(bco.hour_object(dt, sensor_id, i)) # process day for sum values dt = datetime(self.date_time.year, self.date_time.month, self.date_time.day) self.sum_data.append(bco.day_object(dt, sensor_id))
def init_day_data(date_time, sensor_id): day_data.append(bco.day_object(date_time, sensor_id))