usgs-ruby 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +87 -0
  3. data/CHANGELOG.md +5 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +256 -0
  7. data/Rakefile +24 -0
  8. data/docs/Usgs/Client.html +563 -0
  9. data/docs/Usgs/DailyValues.html +338 -0
  10. data/docs/Usgs/InstantaneousValues.html +329 -0
  11. data/docs/Usgs/Models/Reading.html +1124 -0
  12. data/docs/Usgs/Models/Site.html +2030 -0
  13. data/docs/Usgs/Models/Statistic.html +3981 -0
  14. data/docs/Usgs/Models.html +117 -0
  15. data/docs/Usgs/Parser.html +346 -0
  16. data/docs/Usgs/Parsers/RdbParser.html +354 -0
  17. data/docs/Usgs/Parsers/SiteParser.html +174 -0
  18. data/docs/Usgs/Parsers/StatisticsParser.html +228 -0
  19. data/docs/Usgs/Parsers/TimeSeriesParser.html +189 -0
  20. data/docs/Usgs/Parsers.html +117 -0
  21. data/docs/Usgs/Site.html +445 -0
  22. data/docs/Usgs/Statistics.html +335 -0
  23. data/docs/Usgs/Utils.html +357 -0
  24. data/docs/Usgs.html +303 -0
  25. data/docs/_index.html +286 -0
  26. data/docs/class_list.html +54 -0
  27. data/docs/css/common.css +1 -0
  28. data/docs/css/full_list.css +58 -0
  29. data/docs/css/style.css +503 -0
  30. data/docs/file.README.html +111 -0
  31. data/docs/file_list.html +59 -0
  32. data/docs/frames.html +22 -0
  33. data/docs/index.html +111 -0
  34. data/docs/js/app.js +344 -0
  35. data/docs/js/full_list.js +242 -0
  36. data/docs/js/jquery.js +4 -0
  37. data/docs/method_list.html +598 -0
  38. data/docs/top-level-namespace.html +110 -0
  39. data/lib/usgs/client.rb +62 -0
  40. data/lib/usgs/daily_values.rb +38 -0
  41. data/lib/usgs/instantaneous_values.rb +35 -0
  42. data/lib/usgs/models/reading.rb +43 -0
  43. data/lib/usgs/models/site.rb +61 -0
  44. data/lib/usgs/models/statistic.rb +95 -0
  45. data/lib/usgs/parser.rb +23 -0
  46. data/lib/usgs/parsers/rdb_parser.rb +55 -0
  47. data/lib/usgs/parsers/site_parser.rb +13 -0
  48. data/lib/usgs/parsers/statistics_parser.rb +40 -0
  49. data/lib/usgs/parsers/time_series_parser.rb +54 -0
  50. data/lib/usgs/site.rb +50 -0
  51. data/lib/usgs/statistics.rb +42 -0
  52. data/lib/usgs/utils.rb +50 -0
  53. data/lib/usgs/version.rb +5 -0
  54. data/lib/usgs.rb +28 -0
  55. data/sig/usgs/ruby.rbs +6 -0
  56. data/usgs-ruby.gemspec +48 -0
  57. metadata +231 -0
@@ -0,0 +1,335 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Usgs::Statistics
8
+
9
+ &mdash; Documentation by YARD 0.9.37
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Usgs::Statistics";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span>
41
+ &raquo;
42
+ <span class="title">Statistics</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Usgs::Statistics
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dl>
78
+ <dt>Included in:</dt>
79
+ <dd><span class='object_link'><a href="Client.html" title="Usgs::Client (class)">Client</a></span></dd>
80
+ </dl>
81
+
82
+
83
+
84
+ <dl>
85
+ <dt>Defined in:</dt>
86
+ <dd>lib/usgs/statistics.rb</dd>
87
+ </dl>
88
+
89
+ </div>
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ <h2>
100
+ Instance Method Summary
101
+ <small><a href="#" class="summary_toggle">collapse</a></small>
102
+ </h2>
103
+
104
+ <ul class="summary">
105
+
106
+ <li class="public ">
107
+ <span class="summary_signature">
108
+
109
+ <a href="#get_stats-instance_method" title="#get_stats (instance method)">#<strong>get_stats</strong>(sites:, parameter_cd: nil, report_type: :daily, stat_year_type: nil) &#x21d2; Array&lt;Usgs::Models::Statistic&gt; </a>
110
+
111
+
112
+
113
+ </span>
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <span class="summary_desc"><div class='inline'>
124
+ <p>Fetch statistics from USGS NWIS.</p>
125
+ </div></span>
126
+
127
+ </li>
128
+
129
+
130
+ </ul>
131
+
132
+
133
+
134
+
135
+ <div id="instance_method_details" class="method_details_list">
136
+ <h2>Instance Method Details</h2>
137
+
138
+
139
+ <div class="method_details first">
140
+ <h3 class="signature first" id="get_stats-instance_method">
141
+
142
+ #<strong>get_stats</strong>(sites:, parameter_cd: nil, report_type: :daily, stat_year_type: nil) &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Models/Statistic.html" title="Usgs::Models::Statistic (class)">Usgs::Models::Statistic</a></span>&gt;</tt>
143
+
144
+
145
+
146
+
147
+
148
+ </h3><div class="docstring">
149
+ <div class="discussion">
150
+
151
+ <p>Fetch statistics from USGS NWIS</p>
152
+
153
+
154
+ </div>
155
+ </div>
156
+ <div class="tags">
157
+
158
+ <div class="examples">
159
+ <h4 class="tag_title">Examples:</h4>
160
+
161
+
162
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_client'><span class='object_link'><a href="../Usgs.html#client-class_method" title="Usgs.client (method)">client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_stats'>get_stats</span><span class='lparen'>(</span><span class='label'>sites:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>06754000</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>report_type:</span> <span class='symbol'>:daily</span><span class='rparen'>)</span>
163
+ <span class='const'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_client'><span class='object_link'><a href="../Usgs.html#client-class_method" title="Usgs.client (method)">client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_stats'>get_stats</span><span class='lparen'>(</span><span class='label'>sites:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>06754000</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>report_type:</span> <span class='symbol'>:monthly</span><span class='comma'>,</span> <span class='label'>parameter_cd:</span> <span class='symbol'>:discharge</span><span class='rparen'>)</span>
164
+ <span class='const'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_client'><span class='object_link'><a href="../Usgs.html#client-class_method" title="Usgs.client (method)">client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_stats'>get_stats</span><span class='lparen'>(</span><span class='label'>sites:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>06754000</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>report_type:</span> <span class='symbol'>:annual</span><span class='comma'>,</span> <span class='label'>stat_year_type:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>water</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></code></pre>
165
+
166
+ </div>
167
+ <p class="tag_title">Parameters:</p>
168
+ <ul class="param">
169
+
170
+ <li>
171
+
172
+ <span class='name'>sites</span>
173
+
174
+
175
+ <span class='type'>(<tt>String</tt>, <tt>Array&lt;String&gt;</tt>)</span>
176
+
177
+
178
+
179
+ &mdash;
180
+ <div class='inline'>
181
+ <p>USGS site ID(s)</p>
182
+ </div>
183
+
184
+ </li>
185
+
186
+ <li>
187
+
188
+ <span class='name'>parameter_cd</span>
189
+
190
+
191
+ <span class='type'>(<tt>Symbol</tt>, <tt>String</tt>, <tt>Array</tt>)</span>
192
+
193
+
194
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
195
+
196
+
197
+ &mdash;
198
+ <div class='inline'>
199
+ <p>e.g. :discharge</p>
200
+ </div>
201
+
202
+ </li>
203
+
204
+ <li>
205
+
206
+ <span class='name'>report_type</span>
207
+
208
+
209
+ <span class='type'>(<tt>Symbol</tt>)</span>
210
+
211
+
212
+ <em class="default">(defaults to: <tt>:daily</tt>)</em>
213
+
214
+
215
+ &mdash;
216
+ <div class='inline'>
217
+ <p>:daily, :monthly, or :annual (default: :daily)</p>
218
+ </div>
219
+
220
+ </li>
221
+
222
+ <li>
223
+
224
+ <span class='name'>stat_year_type</span>
225
+
226
+
227
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
228
+
229
+
230
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
231
+
232
+
233
+ &mdash;
234
+ <div class='inline'>
235
+ <p>“water”, “calendar”, “all” — only for :annual</p>
236
+ </div>
237
+
238
+ </li>
239
+
240
+ </ul>
241
+
242
+ <p class="tag_title">Returns:</p>
243
+ <ul class="return">
244
+
245
+ <li>
246
+
247
+
248
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Models/Statistic.html" title="Usgs::Models::Statistic (class)">Usgs::Models::Statistic</a></span>&gt;</tt>)</span>
249
+
250
+
251
+
252
+ </li>
253
+
254
+ </ul>
255
+
256
+ </div><table class="source_code">
257
+ <tr>
258
+ <td>
259
+ <pre class="lines">
260
+
261
+
262
+ 19
263
+ 20
264
+ 21
265
+ 22
266
+ 23
267
+ 24
268
+ 25
269
+ 26
270
+ 27
271
+ 28
272
+ 29
273
+ 30
274
+ 31
275
+ 32
276
+ 33
277
+ 34
278
+ 35
279
+ 36
280
+ 37
281
+ 38
282
+ 39
283
+ 40
284
+ 41
285
+ 42
286
+ 43
287
+ 44</pre>
288
+ </td>
289
+ <td>
290
+ <pre class="code"><span class="info file"># File 'lib/usgs/statistics.rb', line 19</span>
291
+
292
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_stats'>get_stats</span><span class='lparen'>(</span><span class='label'>sites:</span><span class='comma'>,</span> <span class='label'>parameter_cd:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>report_type:</span> <span class='symbol'>:daily</span><span class='comma'>,</span> <span class='label'>stat_year_type:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
293
+ <span class='id identifier rubyid_site_list'>site_list</span> <span class='op'>=</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_sites'>sites</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
294
+ <span class='id identifier rubyid_param_list'>param_list</span> <span class='op'>=</span> <span class='id identifier rubyid_resolve_parameter_codes'>resolve_parameter_codes</span><span class='lparen'>(</span><span class='id identifier rubyid_parameter_cd'>parameter_cd</span><span class='rparen'>)</span>
295
+ <span class='id identifier rubyid_type_str'>type_str</span> <span class='op'>=</span> <span class='id identifier rubyid_report_type'>report_type</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
296
+
297
+ <span class='kw'>unless</span> <span class='qwords_beg'>%w[</span><span class='tstring_content'>daily</span><span class='words_sep'> </span><span class='tstring_content'>monthly</span><span class='words_sep'> </span><span class='tstring_content'>annual</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_type_str'>type_str</span><span class='rparen'>)</span>
298
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>report_type must be :daily, :monthly, or :annual</span><span class='tstring_end'>&quot;</span></span>
299
+ <span class='kw'>end</span>
300
+
301
+ <span class='kw'>if</span> <span class='id identifier rubyid_type_str'>type_str</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>annual</span><span class='tstring_end'>&quot;</span></span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_stat_year_type'>stat_year_type</span>
302
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>stat_year_type is only valid when report_type: :annual</span><span class='tstring_end'>&quot;</span></span>
303
+ <span class='kw'>end</span>
304
+
305
+ <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='lbrace'>{</span>
306
+ <span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>rdb,1.0</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
307
+ <span class='label'>sites:</span> <span class='id identifier rubyid_site_list'>site_list</span><span class='comma'>,</span>
308
+ <span class='label'>parameterCd:</span> <span class='id identifier rubyid_param_list'>param_list</span><span class='comma'>,</span>
309
+ <span class='label'>statReportType:</span> <span class='id identifier rubyid_type_str'>type_str</span><span class='comma'>,</span>
310
+ <span class='label'>statTypeCd:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>all</span><span class='tstring_end'>&quot;</span></span>
311
+ <span class='rbrace'>}</span>
312
+
313
+ <span class='id identifier rubyid_query'>query</span><span class='lbracket'>[</span><span class='symbol'>:statYearType</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_stat_year_type'>stat_year_type</span> <span class='kw'>if</span> <span class='id identifier rubyid_stat_year_type'>stat_year_type</span>
314
+
315
+ <span class='id identifier rubyid_raw'>raw</span> <span class='op'>=</span> <span class='id identifier rubyid_api_get'>api_get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/stat/</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
316
+ <span class='const'><span class='object_link'><a href="Parser.html" title="Usgs::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse_statistics'><span class='object_link'><a href="Parser.html#parse_statistics-class_method" title="Usgs::Parser.parse_statistics (method)">parse_statistics</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_raw'>raw</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span> <span class='const'><span class='object_link'><a href="Models.html" title="Usgs::Models (module)">Models</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Models/Statistic.html" title="Usgs::Models::Statistic (class)">Statistic</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Models/Statistic.html#initialize-instance_method" title="Usgs::Models::Statistic#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
317
+ <span class='kw'>end</span></pre>
318
+ </td>
319
+ </tr>
320
+ </table>
321
+ </div>
322
+
323
+ </div>
324
+
325
+ </div>
326
+
327
+ <div id="footer">
328
+ Generated on Mon Dec 15 21:52:18 2025 by
329
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
330
+ 0.9.37 (ruby-3.2.2).
331
+ </div>
332
+
333
+ </div>
334
+ </body>
335
+ </html>