wylark
/
infoex-autowx.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
06d30e4
)
Clean up, add, and refine some comments
author
Alexander Vasarab <alexander@wylark.com>
Wed, 17 Jun 2020 19:37:27 +0000
(12:37 -0700)
committer
Alexander Vasarab <alexander@wylark.com>
Wed, 17 Jun 2020 19:37:27 +0000
(12:37 -0700)
infoex-autowx.py
patch
|
blob
|
history
diff --git
a/infoex-autowx.py
b/infoex-autowx.py
index f951c0d426355a4620b8eb6673fc5a31c8f4a30f..a953cec61be60386f4ebcce83bf4ea16073ce5ae 100755
(executable)
--- a/
infoex-autowx.py
+++ b/
infoex-autowx.py
@@
-61,7
+61,7
@@
try:
'uuid': config['ftp']['uuid'],
'api_key': config['ftp']['api_key'],
'location_uuid': config['wxsite']['location_uuid'],
'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']
}
'csv_filename': config['wxsite']['csv_filename']
}
@@
-172,6
+172,10
@@
for elementCd in desired_data:
values = tmp[0]['values']
# sort and isolate the most recent
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']
if values:
ordered = sorted(values, key=lambda t: t['dateTime'], reverse=True)
infoex['wx_data'][elementCd] = ordered[0]['value']
@@
-183,16
+187,12
@@
log.info("Time to get all elementCds : %.3f sec" % (time.time() -
log.debug("infoex[wx_data]: %s", str(infoex['wx_data']))
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['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))
for elementCd in infoex['wx_data']:
if elementCd not in iemap:
log.warning("BAD KEY wx_data['%s']" % (elementCd))