def make_svv_plots(run_all=False): months = [] month = dt.date(2015,11,1) while month < dt.date.today(): months.append(month) almost_next = month + dt.timedelta(days=35) month = dt.date(almost_next.year, almost_next.month, 1) if not run_all: if dt.date.today().day < 5 and len(months) > 1: months = months[-2:] else: months = [months[-1]] observer_list = [1090, 79, 43, 1084, 33, 119, 67, 101, 952, 41, 34, 125, 126, 8, 384, 955, 14, 841, 50, 175, 1123, 199, 1068, 1598, 1646, 637, 1664, 1307, 135, 307, 1212, 1279, 1310] region_ids = [108,109,131,133,117,118,119,121,122,123,124,127,128] for id in region_ids: region_name = gkdv.get_name('ForecastRegionKDV', id) data_description="svv_i_{0}".format(region_name) for m in months: dates = step1_get_data(m.year, m.month, observer_id=observer_list, region_id=id, make_pickle=False, get_new=True, data_description=data_description) step2_plot(dates, region_name=region_name, data_description=data_description) step3_make_html(dates, region_name=region_name, data_description=data_description) return
def make_region_plots(region_ids, months): for id in region_ids: for m in months: dates = step1_get_data(m.year, m.month, region_id=id, get_new=True) region_name = gkdv.get_name('ForecastRegionKDV', id) step2_plot(dates, region_name=region_name) step3_make_html(dates, region_name=region_name)
def __init__(self, d): self.TripID = int(d["TripID"]) self.ObserverID = int(d["ObserverID"]) self.ObsLocationID = int(d["ObsLocationID"]) self.GeoHazardTID = int(d["GeoHazardTID"]) self.TripTypeTID = int(d["TripTypeTID"]) self.ObservationExpectedTime = fe.unix_time_2_normal( int(d["ObservationExpectedTime"][6:-2]) ) self.Comment = fe.remove_norwegian_letters(d["Comment"]) self.IsFinished = bool(d["IsFinished"]) self.TripRegistrationTime = fe.unix_time_2_normal( int(d["TripRegistrationTime"][6:-2]) ) if d["TripFinishedTime"] is not None: self.TripFinishedTime = fe.unix_time_2_normal( int(d["TripFinishedTime"][6:-2]) ) else: self.TripFinishedTime = None self.DeviceID = d["DeviceID"] self.TripTypeName = kdv.get_name("TripTypeKDV", self.TripTypeTID)