From: Alexander Vasarab Date: Wed, 17 Jun 2020 19:37:27 +0000 (-0700) Subject: Clean up, add, and refine some comments X-Git-Tag: v1.0.0^2~8 X-Git-Url: https://wylark.com/src/infoex-autowx.git/commitdiff_plain/2423f448cf625a9dcd980faa32c83bbdef1c7da2?ds=sidebyside Clean up, add, and refine some comments --- diff --git a/infoex-autowx.py b/infoex-autowx.py index f951c0d..a953cec 100755 --- 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'], - 'wx_data': {}, + 'wx_data': {}, # placeholder key, values to come later '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 + # + # 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'] @@ -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'])) -# 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))