From: Alexander Vasarab Date: Thu, 2 Jul 2020 19:28:48 +0000 (-0700) Subject: Remove default override for desired_data X-Git-Tag: v2.0.2^2~1^2~2 X-Git-Url: https://wylark.com/src/infoex-autowx.git/commitdiff_plain/87aca64501da63577349e9f810a3f1521094fbd0?hp=--cc Remove default override for desired_data We shouldn't be overriding anything implicitly, simply error out and inform the user, and let them deal with it. --- 87aca64501da63577349e9f810a3f1521094fbd0 diff --git a/infoex-autowx.py b/infoex-autowx.py index 823885c..a16b7e6 100755 --- a/infoex-autowx.py +++ b/infoex-autowx.py @@ -88,16 +88,7 @@ def setup_config(config): if station['provider'] == 'nrcs': station['source'] = 'https://www.wcc.nrcs.usda.gov/awdbWebService/services?WSDL' station['station_id'] = config['station']['station_id'] - - try: - station['desired_data'] = config['station']['desired_data'].split(',') - except: - # desired_data malformed or missing, setting default - station['desired_data'] = [ - 'TOBS', # AIR TEMPERATURE OBSERVED (degF) - 'SNWD', # SNOW DEPTH (in) - 'PREC' # PRECIPITATION ACCUMULATION (in) - ] + station['desired_data'] = config['station']['desired_data'].split(',') # XXX: For NRCS, we're manually overriding units for now! Once # unit conversion is supported for NRCS, REMOVE THIS! @@ -108,12 +99,7 @@ def setup_config(config): station['source'] = 'https://api.synopticdata.com/v2/stations/timeseries' station['station_id'] = config['station']['station_id'] station['units'] = config['station']['units'] - - try: - station['desired_data'] = config['station']['desired_data'] - except: - # desired_data malformed or missing, setting default - station['desired_data'] = 'air_temp,snow_depth' + station['desired_data'] = config['station']['desired_data'] # construct full API URL (sans start/end time, added later) station['source'] = station['source'] + '?token=' + config['station']['token'] + '&within=60&units=' + station['units'] + '&stid=' + station['station_id'] + '&vars=' + station['desired_data']