Uncomment FTP upload code
[infoex-autowx.git] / README
1 =============
2 InfoEx AutoWx (IEAW)
3 =============
4
5 This program fetches data from an NRCS SNOTEL site and pushes it into
6 the InfoEx system using the new automated weather system implementation.
7
8 License under the MIT license (see file: LICENSE).
9
10 Disclaimer
11 ==========
12
13 Your usage of the NRCS and InfoEx systems is bound by their respective
14 terms and this software makes no attempt or claim to abide by any such
15 terms.
16
17 Installation
18 ============
19
20 It's recommended to use venv and pip with this program. Here's a typical
21 sequence of commands for a new setup:
22
23 $ cd /path/to/src
24 $ python3 -m venv env
25 $ . env/bin/activate
26 $ pip install -r requirements.txt
27
28 How to use it
29 =============
30
31 This program is designed to be run from the command line (or via
32 cron(8)) and administered via a simple, concise configuration file.
33
34 This design allows you to run a separate program instance for each NRCS
35 weather station from which you'd like to automate the importation of
36 data into your InfoEx subscriber account.
37
38 To run ad-hoc (be sure to activate the virtual environment, as detailed in the
39 Installation section):
40
41 ./infoex-autowx.py --config <path/to/config-file.ini>
42
43 Here's an example of a crontab(5) with two SNOTEL sites, each of which
44 will run once per hour (note that this will activate the virtual environment
45 created earlier):
46
47 2 * * * * /usr/bin/env bash -c 'cd /home/user/infoex-autowx && source env/bin/activate && ./infoex-autowx.py --config laurance-lake.ini'
48 4 * * * * /usr/bin/env bash -c 'cd /home/user/infoex-autowx && source env/bin/activate && ./infoex-autowx.py --config mud-ridge.ini'
49
50 Configuration File
51 ==================
52
53 The configuration file is separated into two parts, the [wxsite]
54 portion, and the [ftp] portion.
55
56 The [wxsite] values describe which NRCS SNOTEL site's data you're after.
57 See the next section in this README for instructions on obtaining these
58 values.
59
60 The [ftp] values describe your credentials for the InfoEx automated
61 weather station FTP server.
62
63 [wxsite]
64 station_triplet = <The NRCS identifier for a particular SNOTEL site>
65 desired_data = <A comma-delimited list of NRCS elements you're interested in>
66 location_uuid = <The UUID used by InfoEx to identify your automated Wx site>
67 csv_filename = <Arbitrary name of the file that will be uploaded to InfoEx>
68
69 [ftp]
70 host = <InfoEx FTP host address>
71 uuid = <InfoEx-supplied UUID>
72 api_key = <InfoEx-supplied API Key>
73
74 Finding Your WXSITE values
75 ==========================
76
77 To complete the [wxsite] configuration section, you must fill in the
78 attributes of the NRCS SNOTEL site from which you want to import data.
79 Here are the steps to do that:
80
81 1. Find your station by clicking through this website:
82
83 https://www.wcc.nrcs.usda.gov/snow/sntllist.html
84
85 Or by using the interactive map:
86
87 https://www.nrcs.usda.gov/wps/portal/wcc/home/quicklinks/imap
88
89 2. Once you've found your station, look for the "Station ID" (a 3- or
90 4-digit number).
91
92 3. Combine your Station ID, state abbreviation, and the network type
93 "SNTL" to get your station triplet (station_triplet, in the
94 configuration file). For example:
95
96 655:OR:SNTL
97
98 would represent the Mud Ridge station (Station ID 655) in the state
99 of Oregon (OR). SNTL just represents that the station is in the
100 SNOTEL network and is used internally by NRCS.
101
102 Once you have your station triplet, fill in the field in your
103 configuration file. Now you must select which data you'd like to pull
104 from NRCS to push into InfoEx.
105
106 For that, visit the NRCS web service:
107
108 https://wcc.sc.egov.usda.gov/awdbWebService/webservice/testwebservice.jsf?webserviceName=/awdbWebService
109
110 Click "getElements" on the left, and then click, "Test Operation." This
111 will return a long list of elements to your web browser from which you
112 can choose. Each returned element has its identifier and a description.
113
114 Once you've chosen your elements, combine all of their respective
115 "elementCd" values into a comma-delimited string and put that into your
116 configuration file as the "desired_data" value.
117
118 For example:
119
120 station_triplet = 655:OR:SNTL
121 desired_data = TOBS,PREC
122
123 indicates that I'd like to import "AIR TEMPERATURE OBSERVED" and
124 "PRECIPITATION ACCUMULATION" from the NRCS SNOTEL site at Mud Ridge, OR,
125 into InfoEx.
126
127 Version History
128 ===============
129
130 1.0.0 (Jun 2020)
131 * First released version. Cleaned up the program and design.
132 Implemented configuration file, added LICENSE, README, docs, etc.
133
134 0.8.0 (Apr 2020)
135 * First finished (unreleased) version.
136
137 pre-0.8.0 (Apr 2020)
138 * First (private) finished implementation with successful NRCS ->
139 InfoEx importation.