forked from NOAA-OCM/SWMPrExtension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.html
632 lines (588 loc) · 16.3 KB
/
README.html
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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
<!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>
<p><a href="https://travis-ci.org/LimnoTech/SWMPrExtension"><img src="https://travis-ci.org/LimnoTech/SWMPrExtension.svg?branch=master" alt="Travis-CI Build Status" /></a><a href="https://cran.r-project.org/package=SWMPrExtension"><img src="http://www.r-pkg.org/badges/version/SWMPrExtension" alt="CRAN_Status_Badge" /></a><a href="http://cran.rstudio.com/package=SWMPrExtension"><img src="http://cranlogs.r-pkg.org/badges/grand-total/SWMPrExtension" alt="Downloads from the RStudio CRAN mirror" /></a></p>
<!-- README.md is generated from README.Rmd. Please edit that file -->
<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. SWMPrExtension (pronounced “swamper extension”) is an R package that provides additional functions to organize and analyze SWMP data and is intended as a companion package for <a href="https://github.com/fawda123/SWMPr">SWMPr</a> (pronounced “swamper”). Currently, there is no citation for SWMPrExtension.</p>
<p><a href="https://github.com/fawda123/SWMPr">SWMPr</a> is an R package for retrieving, organizing, and analyzing estuary monitoring data from SWMP. SWMPr can be cited 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:</p>
<pre class="r"><code>install.packages('SWMPrExtension')
library(SWMPrExtension)</code></pre>
<p>Install the development (unstable) version from Github:</p>
<pre class="r"><code>install.packages('devtools')
library(devtools)
install_github('NOAA-OCM/SWMPrExtension')
library(SWMPrExtension)</code></pre>
</div>
<div id="using-the-package" class="section level1">
<h1>Using the package</h1>
<p>Documentation for SWMPrExtension is currently in development.</p>
<p>A quick summary of the SWMPr package can be found <a href="https://github.com/fawda123/SWMPr">here</a>. A detailed manuscript describing full use of the SWMPr 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>.</p>
<p>SWMPrExtension adds several functions to existing concepts in SWMPr and introduces a new concept called “Reporting”.</p>
<h3>
Analyze
</h3>
<p>The core analyses available within the SWMPrExtension R package and used to create the reserve level annual report fall into four general categories: boxplots and barplots, range plots, threshold plots, and trend plots. There is also an additional category called “mapping” which contains functions that generate many of maps associated with the reserve-level reports. The analyses, methods, and maps in this section were selected by and approved by a technical advisory committee composed of NERR research coordinators, SWMP technicians and CDMO staff.</p>
<h4>
Core Analyses
</h4>
<table>
<tr>
<td>
<code>annual_range.swmpr</code>
</td>
<td>
For a user-specified year, calculate averages, average ranges, and min/max observed ranges the on a monthly or seasonal basis.
</td>
</tr>
<tr>
<td>
<code>historical_daily_range.swmpr</code>
</td>
<td>
Compare a user-specified year against historical data on a daily basis.
</td>
</tr>
<tr>
<td>
<code>historical_range.swmpr</code>
</td>
<td>
Compare a user-specified year against historical data on a monthly/seasonal basis.
</td>
</tr>
<tr>
<td>
<code>raw_boxplot.swmpr</code>
</td>
<td>
Generate a monthly/seasonal boxplots of raw data for a target year.
</td>
</tr>
<tr>
<td>
<code>seasonal_barplot.swmpr</code>
</td>
<td>
Generate monthly/seasonal barplot for parameters that are better viewed in on a cumulative basis (e.g. precipitation).
</td>
</tr>
<tr>
<td>
<code>seasonal_boxplot.swmpr</code>
</td>
<td>
Generate monthly/seasonal boxplots for daily average statistics (min/average/max) across a user-specified time period.Includes the option to calculate a median value for a target year and include a line for a water quality threshold.
</td>
</tr>
<tr>
<td>
<code>seasonal_dot.swmpr</code>
</td>
<td>
Plot average/min/max seasonal values faceted by season.
</td>
</tr>
<tr>
<td>
<code>sk_seasonal.swmpr</code>
</td>
<td>
Seasonal Kendall non-parametric test for monotonic seasonal trends.
</td>
</tr>
<tr>
<td>
<code>threshold_criteria_plot.swmpr</code>
</td>
<td>
Compare raw data against user-specified water quality thresholds
</td>
</tr>
<tr>
<td>
<code>threshold_identification.swmpr</code>
</td>
<td>
Identify dates and times that a user-specified water quality threshold is exceeded. For continuous monitoring data, the user can also specify the length of time the threshold must be exceeded for the event to be included (e.g. DO must be < 2 mg/L for at least 2 hours).
</td>
</tr>
<tr>
<td>
<code>threshold_percentile_plot.swmpr</code>
</td>
<td>
Compare raw data against user-specified percentiles calculated from historical data. User has the option to calculate percentiles on a monthly basis.
</td>
</tr>
<tr>
<td>
<code>threshold_summary.swmpr</code>
</td>
<td>
Summarize the results from <code>threshold_identification</code> in either a plot or tabular format. Results can be aggregated on a monthly, seasonal, or annual basis.
</td>
</tr>
</table>
<h4>
Mapping
</h4>
<table>
<tr>
<td>
<code>national_sk_map</code>
</td>
<td>
Create a base map for NERRS reserves in ggplot with seasonal kendall results.
</td>
</tr>
<tr>
<td>
<code>res_custom_map</code>
</td>
<td>
Create a stylized reserve-level map of custom station locations for use with the reserve level reporting template.
</td>
</tr>
<tr>
<td>
<code>res_custom_sk_map</code>
</td>
<td>
Create a stylized reserve-level map of seasonal kendall results from custom station locations for use with the reserve level reporting template.
</td>
</tr>
<tr>
<td>
<code>res_local_map</code>
</td>
<td>
Create a stylized reserve-level map for use with the reserve level reporting template.
</td>
</tr>
<tr>
<td>
<code>res_national_map</code>
</td>
<td>
Create a base map for NERRS reserves in ggplot.
</td>
</tr>
<tr>
<td>
<code>res_sk_map</code>
</td>
<td>
Create a stylized reserve-level map of seasonal kendall results for use with the reserve level reporting template.
</td>
</tr>
</table>
<h3>
Retrieve
</h3>
<p>in the <code>SWMPr</code> package, retrieve functions help the user load SWMP data into R. </br></p>
<table>
<tr>
<td>
<code>import_local_nut</code>
</td>
<td>
A modified version of <code>import_local</code> from the <code>SWMPr</code> package. This version allows the user to specify the collection method (<code>CollMethd</code>) argument to separate monthly nutrient sampling data from monthly 24-hr nutrient sampling data.
</td>
</tr>
</table>
<h3>
Reporting
</h3>
<p>The new concept of reporting refers to functions that were specifically developed for use with NERRS reserve-level & national-level reporting scripts that are used to generate the reserve-level and national-level annual reports. They are included as part of this package in case users find them useful for their own purposes.</p>
<h4>
Reserve Level Template
</h4>
<table>
<tr>
<td>
<code>create_sk_flextable_list</code>
</td>
<td>
Create a list of <code>flextable</code> objects to display Seasonal Kendall results in the NERRS reserve level template.
</td>
</tr>
<tr>
<td>
<code>geographic_unique_stations</code>
</td>
<td>
Creates an alphabetically sorted, vector of geographically unique stations for mapping. Intended for use with <code>res_local_map</code>.
</td>
</tr>
<tr>
<td>
<code>get_reserve</code>
</td>
<td>
Return the full name of the reserve associated with the data files in the ‘data’ folder of the reserve level template.
</td>
</tr>
<tr>
<td>
<code>get_shp_name</code>
</td>
<td>
Return the name of the shape file associated with the data files in the ‘data’ folder of the reserve level template.
</td>
</tr>
<tr>
<td>
<code>get_site_code</code>
</td>
<td>
Return the 3 letter reserve code associated with the reserve.
</td>
</tr>
<tr>
<td>
<code>get_site_coordinates</code>
</td>
<td>
Return the station coordinates for stations associated with the data files in the ‘data’ folder of the reserve level template.
</td>
</tr>
<tr>
<td>
<code>get_sites</code>
</td>
<td>
Return the stations associated with the data files in ‘data’ folder of the reserve level template.
</td>
</tr>
<tr>
<td>
<code>load_shp_file</code>
</td>
<td>
Load and format shapefile for use with res_local_map.
</td>
</tr>
</table>
<h4>
National Level Template
</h4>
<table>
<tr>
<td>
<code>create_sk_national_ft_reserves</code>
</td>
<td>
Create a <code>flextable</code> of reserve names for use with the NERRS national level template.
</td>
</tr>
<tr>
<td>
<code>create_sk_national_ft_results</code>
</td>
<td>
Create a <code>flextable</code> object to display Seasonal Kendall results for each reserve in the NERRS national level template.
</td>
</tr>
<tr>
<td>
<code>summarise_handoff_files</code>
</td>
<td>
Summarise the seasonal kendall results from reserve level report hand-off files.
</td>
</tr>
</table>
<h3>
Miscellaneous
</h3>
<p>Miscellaneous functions are generally helper functions that are called internally by other analysis functions.</p>
<h4>
Analyze
</h4>
<table>
<tr>
<td>
<code>assign_season</code>
</td>
<td>
Assign seasons to SWMPr sampling data on a monthly basis or user-defined basis. Used by multiple analysis functions to group sampling data into user-defined seasons.
</td>
</tr>
<tr>
<td>
<code>lm_p_labs</code>
</td>
<td>
Generate a dataframe of p-value labels based on p-values from linear regression. Used internally by <code>seasonal_dot.swmpr</code> to add linear regression results to the plot.
</td>
</tr>
<tr>
<td>
<code>set_date_break_labs</code>
</td>
<td>
Select reasonable labels for breaks used in <code>scale_x_datetime</code>. Used internally by several analysis functions.
</td>
</tr>
<tr>
<td>
<code>set_date_breaks</code>
</td>
<td>
A helper function to select reasonable breaks for <code>scale_x_datetime</code>. Used internally by several analysis functions.
</td>
</tr>
<tr>
<td>
<code>sk_tidy</code>
</td>
<td>
Tidy results from <code>EnvStats::kendallSeasonalTrendTest</code>. Used by <code>sk_seasonal.swmpr</code> to tidy seasonal kendall test results.
</td>
</tr>
<tr>
<td>
<code>std_param_check</code>
</td>
<td>
Determine if a parameter is one of the standard SWMP parameters.
</td>
</tr>
<tr>
<td>
<code>title_labeler</code>
</td>
<td>
Generate a plot title based on SWMP station abbreviation. Used internally by several analysis functions.
</td>
</tr>
<tr>
<td>
<code>y_count_labeler</code>
</td>
<td>
Generate a y-axis label based on SWMP parameter abbreviation. Used internally by several analysis functions.
</td>
</tr>
<tr>
<td>
<code>y_labeler</code>
</td>
<td>
Generate a y-axis label based on SWMP parameter abbreviation and threshold criteria. Used internally by several analysis functions.
</td>
</tr>
</table>
<h4>
Mapping
</h4>
<table>
<tr>
<td>
<code>reserve_locs</code>
</td>
<td>
Create a dataframe of selected NERRS locations for plotting with <code>res_national_map</code>.
</td>
</tr>
</table>
<h4>
Reporting
</h4>
<table>
<tr>
<td>
<code>ft_col_names</code>
</td>
<td>
Convert <code>SWMPr</code> parameter abbreviations into formats appropriate for use with NERRS reserve level template <code>flextable</code>. Used internally by <code>create_sk_flextable_list</code>.
</td>
</tr>
<tr>
<td>
<code>generate_results_table</code>
</td>
<td>
Filters a <code>data.frame</code> of user-specified results for display in the NERRS reserve level report. Used internally by <code>create_sk_flextable_list</code>.
</td>
</tr>
<tr>
<td>
<code>generate_station_table</code>
</td>
<td>
Filters a <code>data.frame</code> of user-specified results for display in the NERRS reserve level report. Used internally by <code>create_sk_flextable_list</code>.
</td>
</tr>
</table>
<h3>
Datasets
</h3>
The following data sets are included within the <code>SWMPrExtension</code> package. They are used for examples and for mapping. </br>
<table>
<tr>
<td>
<code>cbm_spatial</code>
</td>
<td>
A shapefile of the reserve boundary for Chesapeake Bay-Maryland NERR. Available from: <code><a href="http://cdmo.baruch.sc.edu/" class="uri">http://cdmo.baruch.sc.edu/</a></code>.
</td>
</tr>
<tr>
<td>
<code>elk_spatial</code>
</td>
<td>
A shapefile of the reserve boundary for Elkhorn Slough NERR. Available from: <code><a href="http://cdmo.baruch.sc.edu/" class="uri">http://cdmo.baruch.sc.edu/</a></code>.
</td>
</tr>
<tr>
<td>
<code>elknmnut</code>
</td>
<td>
Nutrient data (2007-2016) from North Marsh station at Elkhorn Slough NERR.
</td>
</tr>
<tr>
<td>
<code>elksmwq</code>
</td>
<td>
Water quality data (2007-2016) from South Marsh station at Elkhorn Slough NERR.
</td>
</tr>
<tr>
<td>
<code>sampling_stations</code>
</td>
<td>
Metadata on NERRS stations provided by the Central Data Management Office (CDMO) when data is downloaded. Additional formatting applied in order to make the dataset useful to several <code>SWMPrExtension</code> functions.
</td>
</tr>
<tr>
<td>
<code>us_aea</code>
</td>
<td>
US County boundaries from the US Census Bureau’s MAF/TIGER geographic database, modified to remove non-ASCII characters. Reprojected using Albers Equal Area. Used to create national-level maps.
</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>