diff --git a/docs/CONDUCT.html b/docs/CONDUCT.html index 7640460..5048159 100644 --- a/docs/CONDUCT.html +++ b/docs/CONDUCT.html @@ -55,7 +55,7 @@ dbhydroR - 0.2.6 + 0.2.7 diff --git a/docs/articles/dbhydroR.html b/docs/articles/dbhydroR.html index d7e4265..32b4ee0 100644 --- a/docs/articles/dbhydroR.html +++ b/docs/articles/dbhydroR.html @@ -29,7 +29,7 @@ dbhydroR - 0.2.6 + 0.2.7 @@ -73,7 +73,7 @@

dbhydroR: An R package to access the DBHYDRO Environmental Database

Joseph Stachelek

-

2018-07-19

+

2019-02-15

Source: vignettes/dbhydroR.Rmd @@ -94,15 +94,16 @@

Stable version from CRAN

-
install.packages("dbhydroR")
+

Otherwise, the dbhydroR can be installed by running the following command in the R console:

or development version from Github

-
devtools::install_github("ropensci/dbhydroR")
-

Once installed, the package can be loaded using the following command:

-
library(dbhydroR)
+
devtools::install_github("ropensci/dbhydroR")
+ +

Once installed, the package can be loaded using the following command:

+
@@ -112,50 +113,68 @@

Water quality data

Water quality data can be retrieved using the get_wq function which takes four required arguments. The user must specify a station ID, a test name, and a date range. Station IDs can be located on the SFWMD Station Maps or the Google Earth kmz file. An abbreviated list of available test names can be found in the appendix to this document while a full listing can be found at the DBHYDRO metadata page. Dates must be specified in YYYY-MM-DD format (e.g. 2015-02-26). The following set of examples retrieve measurements between March 2011 and May 2012. They can be run from the R console by issuing the command:

-
example(get_wq)
+ +\begin{itemize} + +

One variable at one station

+
get_wq(station_id = "FLAB08", date_min = "2011-03-01", 
+      date_max = "2012-05-01", test_name = "CHLOROPHYLLA-SALINE")
+ +

One variable at multiple stations

+
get_wq(station_id = c("FLAB08","FLAB09"), date_min = "2011-03-01",
+      date_max = "2012-05-01", test_name = "CHLOROPHYLLA-SALINE")
+ +

One variable at a wildcard station

+
get_wq(station_id = c("FLAB0%"), date_min = "2011-03-01", 
+      date_max = "2012-05-01", test_name = "CHLOROPHYLLA-SALINE")
+

Multiple variables at multiple stations

+
get_wq(station_id = c("FLAB08","FLAB09"), date_min = "2011-03-01",
+      date_max = "2012-05-01", test_name = c("CHLOROPHYLLA-SALINE",
+      "SALINITY"))
+

\end{itemize}

By default, get_wq returns a cleaned output. First, the cleaning function converts the raw output from native DBHYDRO long format (each piece of data on its own row) to wide format (each site x variable combination in its own column) using the reshape2 package (Wickham 2007). Next, the extra columns associated with QA flags, LIMS, and District receiving are removed. Finally, row entries associated with QA field blanks, which are used to check on potential sources of contamination, are removed. Setting the raw flag to TRUE will force to retain information on QA field blanks as well as the other QA fields. An example query that retains this information and the original long formatting is shown below.

-
raw_wq <- get_wq(station_id = "FLAB08", date_min = "2011-03-01", 
-      date_max = "2011-05-01", test_name = "CHLOROPHYLLA-SALINE",
-      raw = TRUE)
+

This raw data can then be cleaned using the function:

-
clean_wq(raw_wq)
+
clean_wq(raw_wq)

Hydrologic data

Hydrologic time series data can be retrieved using the get_hydro function. The first task to accomplish prior to running get_hydro is to identify one or more dbkeys which correspond to unique site x variable time-series. This can be done before-hand using the get_dbkey function, the SFWMD Station Maps or the DBHYDRO Browser. One useful strategy for finding desired dbkeys is to run the get_dbkey function interactively using progressively narrower search terms. For example, suppose we are interested in daily average wind data at Joe Bay but we have no alphanumeric dbkey. Initially we could run get_dbkey with the detail.level set to “summary”.

-
get_dbkey(stationid = "JBTS", category = "WEATHER", param = "WNDS",
-         detail.level = "summary")
+
get_dbkey(stationid = "JBTS", category = "WEATHER", param = "WNDS",
+         detail.level = "summary")

Our search returns two results but only one of them has a daily average (DA) measurement frequency. We can verify the remaining attributes of our likely dbkey by setting the freq parameter to “DA” and the detail.level parameter to “full”.

-
get_dbkey(stationid = "JBTS", category = "WEATHER", param = "WNDS",
-         freq = "DA", detail.level = "full")
+
get_dbkey(stationid = "JBTS", category = "WEATHER", param = "WNDS",
+         freq = "DA", detail.level = "full")

This exact dbkey can only be returned reliably by specifying all of the get_dbkey parameters applicable to the “WEATHER” category.

-
get_dbkey(stationid = "JBTS", category = "WEATHER", param = "WNDS",
-         freq = "DA", stat = "MEAN", recorder = "CR10", agency = "WMD",
-         detail.level = "dbkey")
+

Now that we have our dbkey in hand, we can use is as input to get_hydro. In addition to a dbkey, we must specify a date range. Dates must be entered in YYYY-MM-DD format (e.g. 2015-02-26).

-
get_hydro(dbkey = "15081",
-         date_min = "2013-01-01", date_max = "2013-02-02")
+

Alternatively, we can specify a set of arguments in our call to get_hydro that will be passed to get_dbkey on-the-fly. Use caution when using this strategy as complex stationid/category/parameter combinations can easily cause errors or return unexpected results. It is good practice to pre-screen your parameter values using get_dbkey.

-
get_hydro(date_min = "2013-01-01", date_max = "2013-02-02",
-         stationid = "JBTS", category = "WEATHER", param = "WNDS",
-         freq = "DA", stat = "MEAN", recorder = "CR10", agency = "WMD")
+

The contents of multiple data streams can be returned by specifying multiple dbkeys or entering on-the-fly get_dbkey queries that return multiple dbkeys.

-
get_hydro(dbkey = c("15081", "15069"), date_min = "2013-01-01",
-         date_max = "2013-02-02")
-
get_hydro(date_min = "2013-01-01", date_max = "2013-02-02",
-         category = "WEATHER", stationid = c("JBTS", "MBTS"),
-         param = "WNDS", freq = "DA", stat = "MEAN")
+
get_hydro(dbkey = c("15081", "15069"), date_min = "2013-01-01",
+         date_max = "2013-02-02")
+

More get_hydro examples including queries of other category values (“SW”, “GW”, and “WQ”) can be viewed by issuing the following commands from the R console:

-
example(get_dbkey)
-example(get_hydro)
+

By default, get_hydro returns a cleaned output. First, the cleaning function clean_hydro converts the raw output from native DBHYDRO long format (each piece of data on its own row) to wide format (each site x variable combination in its own column) using the reshape2 package (Wickham 2007). Next, some extra columns are removed that are associated with measurement location (longitude/latitude), frequency, and QA flags are removed. Setting the raw flag to TRUE will force get_hydro to retain the original formatting and metadata fields. An example query that retains this information and the original long formatting is shown below.

-
raw_data <- get_hydro(date_min = "2013-01-01", date_max = "2013-02-02",
-         stationid = "JBTS", category = "WEATHER", param = "WNDS",
-         freq = "DA", stat = "MEAN", recorder = "CR10", agency = "WMD", raw = TRUE)
-         
-clean_hydro(raw_data)
+
@@ -238,7 +257,7 @@

References

-

Wickham, Hadley. 2007. “Reshaping Data with the reshape Package.” Journal of Statistical Software 21 (12): 1–20. http://www.jstatsoft.org/v21/i12/.

+

Wickham, Hadley. 2007. “Reshaping Data with the reshape Package.” Journal of Statistical Software 21 (12): 1–20. http://www.jstatsoft.org/v21/i12/.

diff --git a/docs/articles/index.html b/docs/articles/index.html index 15796a8..784cdc9 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -55,7 +55,7 @@ dbhydroR - 0.2.6 + 0.2.7 diff --git a/docs/authors.html b/docs/authors.html index 3afd217..d6d560d 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -55,7 +55,7 @@ dbhydroR - 0.2.6 + 0.2.7 diff --git a/docs/index.html b/docs/index.html index e586bb9..6c75f68 100644 --- a/docs/index.html +++ b/docs/index.html @@ -32,7 +32,7 @@ dbhydroR - 0.2.6 + 0.2.7 @@ -77,14 +77,12 @@ -
- -
+

- +

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Travis-CI Build Status CRAN_Status_Badge CRAN RStudio mirror downloads DOI

dbhydroR provides scripted access to the South Florida Water Management District’s DBHYDRO database which holds over 35 million hydrologic and water quality records from the Florida Everglades and surrounding areas.

@@ -98,7 +96,7 @@

or development version from Github

install.packages("devtools") # Requires RTools if using Windows

-

devtools::install_github("ropensci/dbhydroR")

+

devtools::install_github("ropensci/dbhydroR")

@@ -225,18 +223,7 @@

Developers

-
-

Dev status

- -
- + diff --git a/docs/news/index.html b/docs/news/index.html index 3069e6f..e4d67c4 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -55,7 +55,7 @@ dbhydroR - 0.2.6 + 0.2.7 @@ -101,14 +101,26 @@

Changelog

Source: NEWS.md -
+

-dbhydroR 0.2-6 (2018-07-19) 2018-07-19 +dbhydroR 0.2-7 (2019-02-15) Unreleased

Bug fixes

    +
  • Fixed critical bug in get_hydro causing data parsing failure in all cases (#16)
  • +
+
+
+
+

+dbhydroR 0.2-6 (2018-07-19) 2018-07-19 +

+
+

+Bug fixes

+
  • Fixed critical bug in get_hydro causing data parsing failure in all cases
@@ -117,9 +129,9 @@

dbhydroR 0.2-5 (2018-05-21) 2018-05-22

-
+

-Bug fixes

+Bug fixes
  • get_dbkey was incorrectly processing data headers
  • @@ -138,9 +150,9 @@

    dbhydroR 0.2-4 (2017-10-30) 2017-10-30

    -
    +

    -Bug fixes

    +Bug fixes
    • The ArcGIS online station map no longer resolves. Links have been updated.
    • Sweave sty files are excluded in CRAN build.
    • @@ -151,9 +163,9 @@

      dbhydroR 0.2-3 (2017-08-02) 2017-08-02

      -
      +

      -Bug fixes

      +Bug fixes
      • get_hydro() now resolves multiple matching of on-the-fly dbkeys to the one with the longest period of record.
      • @@ -172,9 +184,9 @@

        dbhydroR 0.2-2 (2017-02-03) 2017-02-03

        -
        +

        -Bug fixes

        +Bug fixes

        get_hydro() now works if a dbkey contains leading zeros

        @@ -204,9 +216,9 @@

      • The package API has been changed to underscored function names. getwq(), gethydro(), and getdbkey() are now deprecated in favor of get_wq(), get_hydro(), get_dbkey().
      -
      +

      -Bug fixes

      +Bug fixes
      • getdbkey() is no longer limited to < 100 results
      • @@ -272,9 +284,9 @@

        dbhydroR 0.1-4 Unreleased

        -
        +

        -Bug fixes

        +Bug fixes
        • Improvements to gethydro() to guess missing column names of instantaneous data
        @@ -286,6 +298,7 @@

        Contents

        diff --git a/docs/reference/clean_wq.html b/docs/reference/clean_wq.html index 0cfaedb..1b005d5 100644 --- a/docs/reference/clean_wq.html +++ b/docs/reference/clean_wq.html @@ -62,7 +62,7 @@ dbhydroR - 0.2.6 + 0.2.7

        diff --git a/docs/reference/dbhydroR-package.html b/docs/reference/dbhydroR-package.html index 2e94aaa..be2f541 100644 --- a/docs/reference/dbhydroR-package.html +++ b/docs/reference/dbhydroR-package.html @@ -58,7 +58,7 @@ dbhydroR - 0.2.6 + 0.2.7
        diff --git a/docs/reference/get_dbkey.html b/docs/reference/get_dbkey.html index e77e086..f75f1c9 100644 --- a/docs/reference/get_dbkey.html +++ b/docs/reference/get_dbkey.html @@ -59,7 +59,7 @@ dbhydroR - 0.2.6 + 0.2.7
      @@ -114,8 +114,8 @@

      Query dbkey information

      get_dbkey(category, stationid = NA, param = NA, freq = NA,
      -  longest = FALSE, stat = NA, recorder = NA, agency = NA, strata = NA,
      -  detail.level = "summary", ...)
      + longest = FALSE, stat = NA, recorder = NA, agency = NA, + strata = NA, detail.level = "summary", ...)

      Arguments

      diff --git a/docs/reference/get_hydro.html b/docs/reference/get_hydro.html index 20c448b..eaa3db8 100644 --- a/docs/reference/get_hydro.html +++ b/docs/reference/get_hydro.html @@ -58,7 +58,7 @@ dbhydroR - 0.2.6 + 0.2.7 @@ -111,7 +111,8 @@

      Retrieve hydrologic data from the DBHYDRO Environmental Database

      -
      get_hydro(dbkey = NA, date_min = NA, date_max = NA, raw = FALSE, ...)
      +
      get_hydro(dbkey = NA, date_min = NA, date_max = NA, raw = FALSE,
      +  ...)

      Arguments

      diff --git a/docs/reference/get_wq.html b/docs/reference/get_wq.html index af762a4..f3032ab 100644 --- a/docs/reference/get_wq.html +++ b/docs/reference/get_wq.html @@ -59,7 +59,7 @@ dbhydroR - 0.2.6 + 0.2.7 @@ -113,10 +113,10 @@

      Retrieve water quality data from the DBHYDRO Environmental Database

      -
      get_wq(station_id = NA, date_min = NA, date_max = NA, test_name = NA,
      -  mdl_handling = "raw", raw = FALSE, qc_strip = "N", qc_field = "N",
      -  test_number = NA, v_target_code = "file_csv", sample_id = NA,
      -  project_code = NA)
      +
      get_wq(station_id = NA, date_min = NA, date_max = NA,
      +  test_name = NA, mdl_handling = "raw", raw = FALSE,
      +  qc_strip = "N", qc_field = "N", test_number = NA,
      +  v_target_code = "file_csv", sample_id = NA, project_code = NA)

      Arguments

      diff --git a/docs/reference/index.html b/docs/reference/index.html index f7582c9..76108ee 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -55,7 +55,7 @@ dbhydroR - 0.2.6 + 0.2.7 diff --git a/docs/review.html b/docs/review.html index 3b2616f..b02ec88 100644 --- a/docs/review.html +++ b/docs/review.html @@ -55,7 +55,7 @@ dbhydroR - 0.2.6 + 0.2.7 @@ -361,7 +361,7 @@

      Good suggestion. I made this change.

      https://github.com/SFWMD/dbhydroR/commit/3df0ad17f4e1b4f78f765b5bd182b1b3d4d34446