Add examples/ dir and add a custom Wx example
authorAlexander Vasarab <alexander@wylark.com>
Sun, 29 Nov 2020 21:16:52 +0000 (13:16 -0800)
committerAlexander Vasarab <alexander@wylark.com>
Sun, 29 Nov 2020 21:16:52 +0000 (13:16 -0800)
config.ini.example [deleted file]
examples/config.example.ini [new file with mode: 0644]
examples/custom-wx.example.py [new file with mode: 0644]

diff --git a/config.ini.example b/config.ini.example
deleted file mode 100644 (file)
index 17544ae..0000000
+++ /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 (file)
index 0000000..17544ae
--- /dev/null
@@ -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 (file)
index 0000000..565e71f
--- /dev/null
@@ -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