forked from fawda123/SWMPr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.html
More file actions
485 lines (441 loc) · 12.1 KB
/
Copy pathREADME.html
File metadata and controls
485 lines (441 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<title></title>
<script src="README_files/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="README_files/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="README_files/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="README_files/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="README_files/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="README_files/navigation-1.1/tabsets.js"></script>
<link href="README_files/highlightjs-1.1/default.css" rel="stylesheet" />
<script src="README_files/highlightjs-1.1/highlight.js"></script>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
pre:not([class]) {
background-color: white;
}
</style>
<script type="text/javascript">
if (window.hljs && document.readyState && document.readyState === "complete") {
window.setTimeout(function() {
hljs.initHighlighting();
}, 0);
}
</script>
<style type="text/css">
h1 {
font-size: 34px;
}
h1.title {
font-size: 38px;
}
h2 {
font-size: 30px;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 16px;
}
h6 {
font-size: 12px;
}
.table th:not([align]) {
text-align: left;
}
</style>
</head>
<body>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
img {
max-width:100%;
height: auto;
}
.tabbed-pane {
padding-top: 12px;
}
button.code-folding-btn:focus {
outline: none;
}
</style>
<div class="container-fluid main-container">
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
</script>
<!-- code folding -->
<div class="fluid-row" id="header">
</div>
<div class="figure">
<img src="swmpr_logo.png" />
</div>
<div id="marcus-w.-beck-marcusbsccwrp.org" class="section level4">
<h4><em>Marcus W. Beck, <a href="mailto:marcusb@sccwrp.org">marcusb@sccwrp.org</a></em></h4>
<p>Linux and OS X: <a href="https://travis-ci.org/fawda123/SWMPr"><img src="https://travis-ci.org/fawda123/SWMPr.png?branch=development" alt="Travis-CI Build Status" /></a></p>
<p>Windows: <a href="https://ci.appveyor.com/project/fawda123/SWMPr"><img src="https://ci.appveyor.com/api/projects/status/github/fawda123/SWMPr?branch=development" alt="AppVeyor Build Status" /></a></p>
<p><a href="http://cran.rstudio.com/package=SWMPr"><img src="http://cranlogs.r-pkg.org/badges/grand-total/SWMPr" alt="Downloads from the RStudio CRAN mirror" /></a></p>
</div>
<div id="overview" class="section level1">
<h1>Overview</h1>
<p>The System Wide Monitoring Program (<a href="http://nerrs.noaa.gov/RCDefault.aspx?ID=18">SWMP</a>) was implemented by the National Estuarine Research Reserve System (<a href="http://nerrs.noaa.gov/">NERRS</a>) in 1995 to provide continuous monitoring data at over 140 continuous monitoring stations in 28 estuaries across the United States. SWMPr (pronounced “swamper”) is an R package for retrieving, organizing, and analyzing estuary monitoring data from SWMP. Please cite the package as follows:</p>
<p>*Beck MW. 2016. SWMPr: An R package for retrieving, organizing, and analyzing environmental data for estuaries. The R Journal. 8(1):219-232. <a href="https://journal.r-project.org/archive/2016-1/beck.pdf*" class="uri">https://journal.r-project.org/archive/2016-1/beck.pdf*</a></p>
</div>
<div id="installing-the-package" class="section level1">
<h1>Installing the package</h1>
<p>Install the package from CRAN as follows:</p>
<pre class="r"><code>install.packages('SWMPr')
library(SWMPr)</code></pre>
<p>The development (unstable) version of this package can be installed from Github:</p>
<pre class="r"><code>install.packages('devtools')
library(devtools)
install_github('fawda123/SWMPr', ref = 'development')
library(SWMPr)</code></pre>
</div>
<div id="using-the-package" class="section level1">
<h1>Using the package</h1>
<p>A detailed manuscript describing full use of the package is available from the <a href="https://journal.r-project.org/archive/accepted/beck.pdf">R Journal</a>. All source materials for the manuscript are available <a href="https://github.com/fawda123/swmpr_manu">here</a>. A brief description of the available functions is provided below. See help documentation for more details on each function (e.g., <code>?all_params</code>). All functions are grouped into respective categories that describe their use: retrieve, organize, and analyze. Help files for functions in each category can be viewed as follows:</p>
<pre class="r"><code>help.search('retrieve', package = 'SWMPr')
help.search('organize', package = 'SWMPr')
help.search('analyze', package = 'SWMPr')</code></pre>
<h3>
Retrieve
</h3>
<table>
<tr>
<td>
<code>all_params</code>
</td>
<td>
Retrieve any number of records starting with the most recent at a given station, all parameters. Wrapper to <code>exportAllParamsXMLNew</code> function on web services.
</td>
</tr>
<tr>
<td>
<code>all_params_dtrng</code>
</td>
<td>
Retrieve records of all parameters within a given date range for a station. Optional argument for a single parameter. Wrapper to <code>exportAllParamsDateRangeXMLNew</code>.
</td>
</tr>
<tr>
<td>
<code>import_local</code>
</td>
<td>
Import files from a local path. The files must be in a specific format, specifically those returned from the CDMO using the <a href="http://cdmo.baruch.sc.edu/aqs/zips.cfm">zip downloads</a> option for a reserve.
</td>
</tr>
<tr>
<td>
<code>import_remote</code>
</td>
<td>
Import SWMP site data from a remote independent server. These files have been downloaded from CDMO, processed using functions in this package, and uploaded to an Amazon server for quicker import into R.
</td>
</tr>
<tr>
<td>
<code>single_param</code>
</td>
<td>
Retrieve any number of records for a single parameter starting with the most recent at a given station. Wrapper to <code>exportSingleParamXMLNew</code> function on web services.
</td>
</tr>
<tr>
<td>
<code>site_codes</code>
</td>
<td>
Metadata for all stations, wrapper to <code>exportStationCodesXMLNew</code> function on web services.
</td>
</tr>
<tr>
<td>
<code>site_codes_ind</code>
</td>
<td>
Metadata for all stations at a single site, wrapper to <code>NERRFilterStationCodesXMLNew</code> function on web services.
</td>
</tr>
</table>
<h3>
Organize
</h3>
<table>
<tr>
<td>
<code>cens_id</code>
</td>
<td>
Creates additional columns in a swmpr object that identify observations below, within, or above the detection limit.
</td>
</tr>
<tr>
<td>
<code>comb</code>
</td>
<td>
Combines swmpr objects to a common time series using setstep, such as combining the weather, nutrients, and water quality data for a single station. Only different data types can be combined.
</td>
</tr>
<tr>
<td>
<code>qaqc</code>
</td>
<td>
Remove QAQC columns and remove data based on QAQC flag values for a swmpr object. Only applies if QAQC columns are present.
</td>
</tr>
<tr>
<td>
<code>qaqcchk</code>
</td>
<td>
View a summary of the number of observations in a swmpr object that are assigned to different QAQC flags used by CDMO. The output is used to inform further processing but is not used explicitly.
</td>
</tr>
<tr>
<td>
<code>rem_reps</code>
</td>
<td>
Remove replicate nutrient data that occur on the same day. The default is to average replicates.
</td>
</tr>
<tr>
<td>
<code>setstep</code>
</td>
<td>
Format data from a swmpr object to a continuous time series at a given timestep. The function is used in <code>comb</code> and can also be used with individual stations.
</td>
</tr>
<tr>
<td>
<code>subset</code>
</td>
<td>
Subset by dates and/or columns for a swmpr object. This is a method passed to the generic `subset’ function provided in the base package.
</td>
</tr>
</table>
<h3>
Analyze
</h3>
<table>
<tr>
<td>
<code>aggreswmp</code>
</td>
<td>
Aggregate swmpr objects for different time periods - years, quarters, months, weeks, days, or hours. Aggregation function is user-supplied but defaults to mean.
</td>
</tr>
<tr>
<td>
<code>aggremetab</code>
</td>
<td>
Aggregate metabolism data from a swmpr object. This is primarily used within <code>plot_metab</code> but may be useful for simple summaries of raw daily data.
</td>
</tr>
<tr>
<td>
<code>ecometab</code>
</td>
<td>
Estimate ecosystem metabolism for a combined water quality and weather dataset using the open-water method.
</td>
</tr>
<tr>
<td>
<code>decomp</code>
</td>
<td>
Decompose a swmpr time series into trend, seasonal, and residual components. This is a simple wrapper to <code>decompose</code>. Decomposition of monthly or daily trends is possible.
</td>
</tr>
<tr>
<td>
<code>decomp_cj</code>
</td>
<td>
Decompose a swmpr time series into grandmean, annual, seasonal, and events components. This is a simple wrapper to <code>decompTs</code> in the wq package. Only monthly decomposition is possible.
</td>
</tr>
<tr>
<td>
<code>hist</code>
</td>
<td>
Plot a histogram for a swmpr object.
</td>
</tr>
<tr>
<td>
<code>lines</code>
</td>
<td>
Add lines to an existing swmpr plot.
</td>
</tr>
<tr>
<td>
<code>map_reserve</code>
</td>
<td>
Create a map of all stations in a reserve using the ggmap package.
</td>
</tr>
<tr>
<td>
<code>na.approx</code>
</td>
<td>
Linearly interpolate missing data (<code>NA</code> values) in a swmpr object. The maximum gap size that is interpolated is defined as a maximum number of records with missing data.
</td>
</tr>
<tr>
<td>
<code>overplot</code>
</td>
<td>
Plot multiple SWMP time series on the same y-axis.
</td>
</tr>
<tr>
<td>
<code>plot</code>
</td>
<td>
Plot a univariate time series for a swmpr object. The parameter name must be specified.
</td>
</tr>
<tr>
<td>
<code>plot_metab </code>
</td>
<td>
Plot ecosystem metabolism estimates after running <code>ecometab</code> on a swmpr object.
</td>
</tr>
<tr>
<td>
<code>plot_summary</code>
</td>
<td>
Create summary plots of seasonal/annual trends and anomalies for a water quality or weather parameter.
</td>
</tr>
<tr>
<td>
<code>plot_wind</code>
</td>
<td>
Create a wind rose using weather data.
</td>
</tr>
<tr>
<td>
<code>smoother</code>
</td>
<td>
Smooth swmpr objects with a moving window average. Window size and sides can be specified, passed to <code>filter</code>.
</td>
</tr>
</table>
<h3>
Miscellaneous
</h3>
<table>
<tr>
<td>
<code>calcKL</code>
</td>
<td>
Estimate the reaeration coefficient for air-sea gas exchange. This is only used within the <code>ecometab</code> function.
</td>
</tr>
<tr>
<td>
<code>metab_day</code>
</td>
<td>
Identify the metabolic day for each approximate 24 period in an hourly time series. This is only used within the <code>ecometab</code> function.
</td>
</tr>
<tr>
<td>
<code>param_names</code>
</td>
<td>
Returns column names as a list for the parameter type(s) (nutrients, weather, or water quality). Includes QAQC columns with ‘f_’ prefix. Used internally in other functions.
</td>
</tr>
<tr>
<td>
<code>parser</code>
</td>
<td>
Parses html returned from CDMO web services, used internally in retrieval functions.
</td>
</tr>
<tr>
<td>
<code>swmpr</code>
</td>
<td>
Creates object of swmpr class, used internally in retrieval functions.
</td>
</tr>
<tr>
<td>
<code>time_vec</code>
</td>
<td>
Converts time vectors to POSIX objects with correct time zone for a site/station, used internally in retrieval functions.
</td>
</tr>
</table>
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>