The value defaults to "3" but should be bumped to "24" if the user wants
HN24 or wind averaging.
LOG.critical("%s is not a valid timezone", tz)
sys.exit(1)
LOG.critical("%s is not a valid timezone", tz)
sys.exit(1)
+ # By default, fetch three hours of data
+ #
+ # If user wants hn24 or wind averaging, then
+ # we need more.
+ station['num_hrs_to_fetch'] = 3
+
# HN24
if 'hn24' in config['station']:
if config['station']['hn24'] not in ['true', 'false']:
# HN24
if 'hn24' in config['station']:
if config['station']['hn24'] not in ['true', 'false']:
if config['station']['hn24'] == "true":
station['hn24'] = True
if config['station']['hn24'] == "true":
station['hn24'] = True
+ station['num_hrs_to_fetch'] = 24
else:
station['hn24'] = False
else:
else:
station['hn24'] = False
else:
raise ValueError("wind_mode must be either 'normal' or 'average'")
station['wind_mode'] = config['station']['wind_mode']
raise ValueError("wind_mode must be either 'normal' or 'average'")
station['wind_mode'] = config['station']['wind_mode']
+
+ if station['wind_mode'] == "average":
+ station['num_hrs_to_fetch'] = 24
else:
# default to False
station['wind_mode'] = "normal"
else:
# default to False
station['wind_mode'] = "normal"
end_date = date_time - datetime.timedelta(minutes=date_time.minute % 60,
seconds=date_time.second,
microseconds=date_time.microsecond)
end_date = date_time - datetime.timedelta(minutes=date_time.minute % 60,
seconds=date_time.second,
microseconds=date_time.microsecond)
- begin_date = end_date - datetime.timedelta(hours=3)
+ begin_date = end_date - datetime.timedelta(hours=station['num_hrs_to_fetch'])
return (begin_date, end_date)
def f_to_c(f):
return (begin_date, end_date)
def f_to_c(f):