Skip to content

Commit 7c723c6

Browse files
Merge pull request DOI-USGS#867 from ldecicco-USGS/develop
Getting ready for CRAN submission
2 parents cf9196c + 9aa8153 commit 7c723c6

123 files changed

Lines changed: 4323 additions & 1018 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.Rbuildignore

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
^Temp$
33
^doc$
44
.Rhistory
5-
vignettes/figures
65
.gitignore
7-
dataRetrieval.Rproj
8-
dataRetrieval-concordance.tex
96
README.md
107
^.*\.Rproj$
118
^\.Rproj\.user$
129
^\.Rproj\.gitignore
1310
^\.Rproj\.RData
14-
^\.Rproj\dataRetrieval.Rproj
1511
^\.Rproj\.Rhistory
1612
CONDUCT.md
1713
DISCLAIMER.md
@@ -21,15 +17,11 @@ pkgdown
2117
_pkgdown.yml
2218
vignettes/earthquake.Rmd
2319
vignettes/statsServiceMap.Rmd
24-
vignettes/usMaps.Rmd
25-
vignettes/usMaps_cache
2620
vignettes/movingAverages.Rmd
2721
vignettes/tutorial_slides.Rmd
2822
vignettes/nldi*
2923
vignettes/phWI.rds
3024
vignettes/az_data.rds
31-
vignettes/atascadero-creek-nldi.png
32-
vignettes/ucsb.png
3325
man/figures/highrezlogo-01.png
3426
man/figures/USGS_R.png
3527
^CRAN-RELEASE$
@@ -46,46 +38,10 @@ vignettes/phosData.rds
4638
vignettes/waterservices.png
4739
vignettes/wqp_large_pull_targets.Rmd
4840
vignettes/wqp_large_pull_script.Rmd
49-
vignettes/full_pipeline.png
50-
vignettes/pipeline_snap_char_names.png
51-
vignettes/map_original_grid_cells.png
52-
vignettes/log_file.png
53-
vignettes/pipeline_snap_check_inventory.png
54-
vignettes/map_updated_grid_cells.png
55-
vignettes/pipeline_snap_update_inventory.png
5641
.gitlab-ci.yml
57-
deploy_simple.R
5842
.lintr
59-
vignettes/back_to_main.png
60-
vignettes/delete_branch.png
61-
vignettes/pipeline.png
62-
vignettes/merge_request.png
63-
vignettes/create_merge.png
64-
vignettes/doc_all.png
65-
vignettes/commit2.png
66-
vignettes/commit1.png
67-
vignettes/test.png
68-
vignettes/check.png
69-
vignettes/new_branch.png
70-
vignettes/pull.png
71-
vignettes/roxygen.png
72-
vignettes/install.png
73-
vignettes/git_repository.png
74-
vignettes/https_clone.png
75-
vignettes/new_project.png
7643
vignettes/Contributing.Rmd
77-
vignettes/no_manual.png
78-
vignettes/install_error.png
79-
vignettes/git_login.png
80-
vignettes/login.png
81-
vignettes/git_repository.png
82-
vignettes/https_clone.png
83-
vignettes/test_included.png
8444
vignettes/troubleshooting.Rmd
85-
vignettes/pat.png
86-
vignettes/github_code.png
87-
vignettes/save_pat.png
88-
vignettes/more_tests.png
8945
vignettes/stylesSlides.css
9046
vignettes/Status.Rmd
9147
vignettes/long_to_wide.Rmd
@@ -94,7 +50,7 @@ vignettes/wqx3_development_plan.Rmd
9450
vignettes/read_waterdata_functions.Rmd
9551
vignettes/dataretrieval_discrete_changes_images/*
9652
vignettes/Wide_data_example.xlsx
97-
vignettes/messyData.png
53+
^vignettes/images$
9854
^ci$
9955
^public$
10056
^tutorials$
@@ -108,3 +64,6 @@ vignettes/wqpData.rds
10864
_quarto.yml
10965
vignettes/basic_slides.Rmd
11066
vignettes/changes_slides.Rmd
67+
vignettes/daily_data_statistics.Rmd
68+
vignettes/continuous_pr.Rmd
69+
vignettes/quick_slides.Rmd

.github/workflows/R-CMD-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
- uses: r-lib/actions/setup-pandoc@6012817847b5f064d0882d67a7b5e2ca6639afb2
3636

37-
- uses: r-lib/actions/setup-r@473c68190595b311a74f208fba61a8d8c0d4c247
37+
- uses: r-lib/actions/setup-r@cdfe59f7d9ed0bc33451d5e5d5d9dde04246fa59
3838
with:
3939
r-version: ${{ matrix.config.r }}
4040
http-user-agent: ${{ matrix.config.http-user-agent }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ vignettes/*.R
1717

1818

1919
/.quarto/
20+
21+
**/*.quarto_ipynb

DESCRIPTION

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: dataRetrieval
22
Type: Package
33
Title: Retrieval Functions for USGS and EPA Hydrology and Water Quality Data
4-
Version: 2.7.22
4+
Version: 2.7.23
55
Authors@R: c(
66
person("Laura", "DeCicco", role = c("aut","cre"),
77
email = "ldecicco@usgs.gov",
@@ -26,7 +26,7 @@ Authors@R: c(
2626
comment=c(ORCID = "0000-0003-2521-5043")),
2727
person("Lee", "Stanish", role="ctb",
2828
comment=c(ORCID = "0000-0002-9775-6861")),
29-
person("Joeseph", "Zemmels", role="ctb",
29+
person("Joseph", "Zemmels", role="aut",
3030
email = "jzemmels@usgs.gov",
3131
comment=c(ORCID = "0009-0008-1463-6313")),
3232
person("Elise", "Hinman", role="aut",
@@ -55,7 +55,8 @@ Imports:
5555
jsonlite,
5656
httr2,
5757
whisker,
58-
sf
58+
sf,
59+
data.table
5960
Suggests:
6061
covr,
6162
dplyr,

NAMESPACE

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ export(readNGWMNlevels)
3232
export(readNGWMNsites)
3333
export(readNWISdata)
3434
export(readNWISdv)
35-
export(readNWISgwl)
36-
export(readNWISmeas)
3735
export(readNWISpCode)
3836
export(readNWISpeak)
3937
export(readNWISrating)
@@ -46,15 +44,20 @@ export(readWQPqw)
4644
export(readWQPsummary)
4745
export(read_USGS_samples)
4846
export(read_waterdata)
47+
export(read_waterdata_channel)
48+
export(read_waterdata_combined_meta)
4949
export(read_waterdata_continuous)
5050
export(read_waterdata_daily)
5151
export(read_waterdata_field_measurements)
52+
export(read_waterdata_field_meta)
5253
export(read_waterdata_latest_continuous)
5354
export(read_waterdata_latest_daily)
5455
export(read_waterdata_metadata)
5556
export(read_waterdata_monitoring_location)
5657
export(read_waterdata_parameter_codes)
5758
export(read_waterdata_samples)
59+
export(read_waterdata_stats_daterange)
60+
export(read_waterdata_stats_por)
5861
export(read_waterdata_ts_meta)
5962
export(renameNWISColumns)
6063
export(setAccess)
@@ -70,3 +73,12 @@ export(whatWQPsamples)
7073
export(whatWQPsites)
7174
export(wqp_check_status)
7275
export(zeroPad)
76+
importFrom(data.table,":=")
77+
importFrom(data.table,.BY)
78+
importFrom(data.table,.EACHI)
79+
importFrom(data.table,.GRP)
80+
importFrom(data.table,.I)
81+
importFrom(data.table,.N)
82+
importFrom(data.table,.NGRP)
83+
importFrom(data.table,.SD)
84+
importFrom(data.table,data.table)

NEWS

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
dataRetrieval 2.7.23
2+
===================
3+
* Added data.table to Imports
4+
* Added read_waterdata_stats_por and read_waterdata_stats_daterange to access USGS daily data statistics.
5+
* Updated vignettes, examples, and README to reflect new stats functions.
6+
* Added tests for read_waterdata_stats functions
7+
* Updated next_req_url to allow paging through /statistics API output
8+
* Added deprecation message to readNWISstat function
9+
* Specify "UTC" attribute for returned time
10+
* Added options("dataRetrieval.attach_request" = TRUE) as default to attach the
11+
request object as an attribute to the returned data frames. Setting
12+
options("dataRetrieval.attach_request" = FALSE) will return a data frame without
13+
the request attribute
14+
* Improved time documentation
15+
* Improved error handling in WQP functions
16+
* Added read_waterdata_field_meta, read_waterdata_combine_meta,
17+
and read_waterdata_channel
18+
* Removed readNWISgwl and readNWISmeas as services have been turned off
19+
* Updated CQL2 templates to allow HUC queries specifically to use a wildcard
20+
to get multiple inclusive HUCs.
21+
* Add deprecation message to readNGWMN functions. read_ngwmn will be coming soon.
22+
23+
124
dataRetrieval 2.7.22
225
===================
326
* Added read_waterdata_latest_daily to access latest daily USGS water data.

R/AAA.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ pkg.env <- new.env()
44
suppressMessages(setAccess("public"))
55
pkg.env$nldi_base <- "https://api.water.usgs.gov/nldi/linked-data/"
66
pkg.env$local_sf <- requireNamespace("sf", quietly = TRUE)
7-
options("dataRetrieval" = list("api_version" = "v0"))
7+
options("dataRetrieval.api_version" = "v0")
8+
options("dataRetrieval.api_version_stat" = "v0")
9+
options("dataRetrieval.attach_request" = TRUE)
810

911
services <- c("server", "daily", "time-series-metadata",
1012
"monitoring-locations", "latest-continuous",
1113
"field-measurements", "latest-daily",
12-
"continuous")
14+
"continuous", "field-measurements-metadata",
15+
"combined-metadata", "channel-measurements")
1316
collections <- c("parameter-codes", "agency-codes", "altitude-datums", "aquifer-codes",
1417
"aquifer-types", "coordinate-accuracy-codes", "coordinate-datum-codes",
1518
"coordinate-method-codes", "medium-codes", "counties",

R/citations.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
#'
1414
#' @examples
1515
#' \donttest{
16-
#' nwisData <- readNWISdv("04085427", "00060", "2012-01-01", "2012-06-30")
16+
#' nwisData <- read_waterdata_daily(monitoring_location_id = "USGS-04085427",
17+
#' parameter_code = "00060",
18+
#' time = c("2012-01-01", "2012-06-30"))
1719
#' nwis_citation <- create_NWIS_bib(nwisData)
1820
#' nwis_citation
1921
#'
@@ -24,16 +26,14 @@ create_NWIS_bib <- function(x){
2426

2527
textVersion <- paste0("U.S. Geological Survey, ",
2628
format(attr(x, "queryTime"), "%Y"),
27-
", National Water Information System data available on the World Wide Web (USGS Water Data for the Nation), accessed ",
29+
", USGS Water Data for the Nation: U.S. Geological Survey National Water Information System database, accessed ",
2830
format(attr(x, "queryTime"), "%b %d, %Y"),
29-
", at ",
30-
attr(x, "url"),
31-
", https://dx.doi.org/10.5066/F7P55KJN")
31+
", at https://dx.doi.org/10.5066/F7P55KJN")
3232

3333
ref <- utils::bibentry(
3434
bibtype = "Manual",
3535
textVersion = textVersion,
36-
title = "National Water Information System data available on the World Wide Web (USGS Water Data for the Nation)",
36+
title = "USGS Water Data for the Nation: U.S. Geological Survey National Water Information System database",
3737
author = utils::person("U.S. Geological Survey"),
3838
doi = "10.5066/F7P55KJN",
3939
note = paste("Accessed", format(attr(x, "queryTime"), "%b %d, %Y")),

R/constructNWISURL.R

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
#' @param statCd string or vector USGS statistic code only used for daily value service.
1212
#' This is usually 5 digits. Daily mean (00003) is the default.
1313
#' @param service string USGS service to call. Possible values are "dv" (daily values),
14-
#' "uv" (unit/instantaneous values),
15-
#' "gwlevels" (groundwater),and "rating" (rating curve),
16-
#' "peak", "meas" (discrete streamflow measurements),
17-
#' "stat" (statistics web service BETA).
14+
#' "uv" (unit/instantaneous values), and "rating" (rating curve),
15+
#' "peak", "stat" (statistics web service BETA).
1816
#' @param format string, can be "tsv" or "xml", and is only applicable for daily
1917
#' and unit value requests. "tsv" returns results faster, but there is a possibility
2018
#' that an incomplete file is returned without warning. XML is slower,
@@ -55,9 +53,6 @@
5553
#' )
5654
#' url_rating <- constructNWISURL(site_id, service = "rating", ratingType = "base")
5755
#' url_peak <- constructNWISURL(site_id, service = "peak")
58-
#' url_meas <- constructNWISURL(site_id, service = "meas")
59-
#' url_gwl <- constructNWISURL(site_id, service = "gwlevels",
60-
#' startDate = "2024-05-01", endDate = "2024-05-30")
6156
constructNWISURL <- function(siteNumbers,
6257
parameterCd = "00060",
6358
startDate = "",
@@ -71,8 +66,8 @@ constructNWISURL <- function(siteNumbers,
7166
statType = "mean") {
7267

7368
service <- match.arg(service, c(
74-
"dv", "uv", "iv", "iv_recent", "gwlevels",
75-
"rating", "peak", "meas", "stat"))
69+
"dv", "uv", "iv", "iv_recent",
70+
"rating", "peak", "stat"))
7671

7772
service[service == "meas"] <- "measurements"
7873
service[service == "uv"] <- "iv"
@@ -212,31 +207,7 @@ constructNWISURL <- function(siteNumbers,
212207
missingData = "off")
213208
}
214209
},
215-
gwlevels = {
216-
url <- get_or_post(baseURL,
217-
POST = POST,
218-
site_no = siteNumbers,
219-
.multi = "comma")
220-
url <- get_or_post(url,
221-
POST = POST,
222-
format = "rdb")
223-
if (nzchar(startDate)) {
224-
url <- get_or_post(url,
225-
POST = POST,
226-
begin_date = startDate)
227-
}
228-
if (nzchar(endDate)) {
229-
url <- get_or_post(url,
230-
POST = POST,
231-
end_date = endDate)
232-
}
233-
url <- get_or_post(url,
234-
POST = POST,
235-
group_key = "NONE",
236-
date_format = "YYYY-MM-DD",
237-
rdb_compression = "value")
238-
},
239-
{ # this will be either dv, uv, groundwater
210+
{ # this will be either dv, uv
240211

241212
format <- match.arg(format, c("xml", "tsv", "wml1", "wml2", "rdb"))
242213

0 commit comments

Comments
 (0)