From: Alexander Vasarab Date: Sun, 29 Nov 2020 21:16:52 +0000 (-0800) Subject: Add examples/ dir and add a custom Wx example X-Git-Tag: v3.0.0^2~1^2~2 X-Git-Url: https://wylark.com/src/infoex-autowx.git/commitdiff_plain/8048b2995f83e3a148fcd86e60801927b87b4a65?ds=sidebyside Add examples/ dir and add a custom Wx example --- diff --git a/config.ini.example b/config.ini.example deleted file mode 100644 index 17544ae..0000000 --- a/config.ini.example +++ /dev/null @@ -1,14 +0,0 @@ -[station] -type = # (mesowest|nrcs) # -token = # MesoWest API token (ignored for NRCS) # -station_id = # NRCS/MesoWest Station ID # -desired_data = # Comma-separated list of values # -units = # (english|metric) (ignored for NRCS) # - -[infoex] -host = # InfoEx FTP host address # -uuid = # InfoEx-supplied UUID # -api_key = # InfoEx-supplied API Key # -csv_filename = # Name of file to upload to InfoEx FTP # -location_uuid = # InfoEx-supplied Location UUID # - diff --git a/examples/config.example.ini b/examples/config.example.ini new file mode 100644 index 0000000..17544ae --- /dev/null +++ b/examples/config.example.ini @@ -0,0 +1,14 @@ +[station] +type = # (mesowest|nrcs) # +token = # MesoWest API token (ignored for NRCS) # +station_id = # NRCS/MesoWest Station ID # +desired_data = # Comma-separated list of values # +units = # (english|metric) (ignored for NRCS) # + +[infoex] +host = # InfoEx FTP host address # +uuid = # InfoEx-supplied UUID # +api_key = # InfoEx-supplied API Key # +csv_filename = # Name of file to upload to InfoEx FTP # +location_uuid = # InfoEx-supplied Location UUID # + diff --git a/examples/custom-wx.example.py b/examples/custom-wx.example.py new file mode 100644 index 0000000..565e71f --- /dev/null +++ b/examples/custom-wx.example.py @@ -0,0 +1,31 @@ +# reference implementation for an infoex-autowx custom Wx data provider + +# global variable which will hold the Wx data to be uploaded to InfoEx +wx_data = {} + +# the following data types are supported by infoex-autowx +wx_data['precipitationGauge'] = None +wx_data['tempPres'] = None +wx_data['tempMaxHour'] = None +wx_data['tempMinHour'] = None +wx_data['hS'] = None +wx_data['baro'] = None +wx_data['rH'] = None +wx_data['windSpeedNum'] = None +wx_data['windDirectionNum'] = None +wx_data['windGustSpeedNum'] = None + +def get_custom_data(): + # This function will be called by infoex-autowx, and the `wx_data` + # variable (a global variable within this program) will be returned. + # + # For example, maybe you will `import psycopg2` and grab your data + # from a local PostgreSQL database. Or maybe you will use the + # requests library to fetch a remote web page and parse out the data + # that's meaningful to your operation. + # + # Whatever your program needs to do to get its data can be done + # either here in this function directly, or elsewhere with + # modification to the global variable `wx_data`. + + return wx_data