'uuid': config['ftp']['uuid'],
'api_key': config['ftp']['api_key'],
'location_uuid': config['wxsite']['location_uuid'],
- 'wx_data': {},
+ 'wx_data': {}, # placeholder key, values to come later
'csv_filename': config['wxsite']['csv_filename']
}
values = tmp[0]['values']
# sort and isolate the most recent
+ #
+ # NOTE: we do this because sometimes there are gaps in hourly data
+ # in NRCS; yes, we may end up with slightly inaccurate data,
+ # so perhaps this decision will be re-evaluated in the future
if values:
ordered = sorted(values, key=lambda t: t['dateTime'], reverse=True)
infoex['wx_data'][elementCd] = ordered[0]['value']
log.debug("infoex[wx_data]: %s", str(infoex['wx_data']))
-# Only need to add in what we want to change thanks to that abomination
-# of a variable declaration earlier
+# Now we only need to add in what we want to change thanks to that
+# abomination of a variable declaration earlier
final_data[fmap['Location UUID']] = infoex['location_uuid']
final_data[fmap['obDate']] = end_date.strftime('%m/%d/%Y')
final_data[fmap['obTime']] = end_date.strftime('%H:%M')
-#final_data[fmap['tempPres']] = float(infoex['wx_data']['TOBS'])
-#final_data[fmap['precipitationGauge']] = float(infoex['wx_data']['PREC'])
-#final_data[fmap['hS']] = float(infoex['wx_data']['SNWD'])
-
for elementCd in infoex['wx_data']:
if elementCd not in iemap:
log.warning("BAD KEY wx_data['%s']" % (elementCd))