Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Water
dataRetrieval
Commits
32665fd2
Commit
32665fd2
authored
Jul 29, 2021
by
Laura A DeCicco
Browse files
Getting ready for a CRAN release
parent
8f30e833
Changes
6
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
32665fd2
Package: dataRetrieval
Type: Package
Title: Retrieval Functions for USGS and EPA Hydrologic and Water Quality Data
Version: 2.7.9
.0002
Version: 2.7.9
Authors@R: c(
person("Laura", "DeCicco", role = c("aut","cre"),
email = "ldecicco@usgs.gov",
...
...
R/readNWISdata.r
View file @
32665fd2
...
...
@@ -139,7 +139,12 @@ readNWISdata <- function(..., asDateTime=TRUE,convertType=TRUE,tz="UTC"){
valuesList
<-
readNWISdots
(
...
)
service
<-
valuesList
$
service
if
(
service
%in%
c
(
"qw"
,
"qwdata"
)){
if
(
length
(
service
)
>
1
){
warning
(
"Only one service value is allowed. Service: "
,
service
[
1
],
" will be used."
)
service
<-
service
[
1
]
}
if
(
any
(
service
%in%
c
(
"qw"
,
"qwdata"
))){
.Deprecated
(
old
=
"readNWISdata"
,
package
=
"dataRetrieval"
,
new
=
"readWQPdata"
,
msg
=
"NWIS qw web services are being retired. Please see the vignette
...
...
R/whatNWISData.r
View file @
32665fd2
...
...
@@ -65,7 +65,7 @@ whatNWISdata <- function(..., convertType=TRUE){
if
(
"service"
%in%
names
(
matchReturn
)){
service
<-
matchReturn
$
service
if
(
service
%in%
c
(
"qw"
,
"qwdata"
)){
if
(
any
(
service
%in%
c
(
"qw"
,
"qwdata"
))
)
{
.Deprecated
(
old
=
"whatNWISdata"
,
package
=
"dataRetrieval"
,
new
=
"whatWQPdata"
,
msg
=
"NWIS qw web services are being retired. Please see the vignette
...
...
README.md
View file @
32665fd2
# dataRetrieval <img src="man/figures/logo.png" alt="dataRetrieval" height="150px" align="right" />
[

](https://github.com/USGS-R/dataRetrieval/actions)
[

](https://coveralls.io/github/USGS-R/dataRetrieval?branch=master)
[

](https://owi.usgs.gov/R/packages.html#core)
[

](https://cran.r-project.org/package=dataRetrieval)
[

](https://cran.r-project.org/package=dataRetrieval)
[

](https://cran.r-project.org/package=dataRetrieval)
Retrieval functions for USGS and EPA hydrologic and water quality data.
...
...
tests/testthat/tests_general.R
View file @
32665fd2
...
...
@@ -33,19 +33,10 @@ test_that("General NWIS retrievals working", {
service
=
"site"
)
expect_is
(
siteInfo
$
station_nm
,
"character"
)
qwData
<-
readNWISdata
(
bBox
=
c
(
-82.5
,
41.52
,
-81
,
41
),
startDate
=
as.Date
(
"2000-01-01"
),
drain_area_va_min
=
50
,
qw_count_nu
=
50
,
qw_attributes
=
"expanded"
,
qw_sample_wide
=
"wide"
,
list_of_search_criteria
=
c
(
"lat_long_bounding_box"
,
"drain_area_va"
,
"obs_count_nu"
),
service
=
"qw"
)
expect_is
(
qwData
$
startDateTime
,
"POSIXct"
)
url
<-
"https://waterservices.usgs.gov/nwis/dv/?site=09037500&format=rdb&ParameterCd=00060&StatCd=00003&startDT=1985-10-02&endDT=2012-09-06"
dv
<-
importRDB1
(
url
,
asDateTime
=
FALSE
)
urlEmpty
<-
"https://nwis.waterdata.usgs.gov/nwis/qwdata?multiple_site_no=413437087150601&sort_key=site_no&group_key=NONE&inventory_output=0&begin_date=&end_date=&TZoutput=0¶m_group=NUT,INN&qw_attributes=0&format=rdb&qw_sample_wide=0&rdb_qw_attributes=expanded&date_format=YYYY-MM-DD&rdb_compression=value&list_of_search_criteria=multiple_site_no"
dv
<-
importRDB1
(
urlEmpty
,
asDateTime
=
FALSE
)
expect_true
(
nrow
(
dv
)
==
0
)
dailyStat
<-
readNWISdata
(
site
=
c
(
"03112500"
,
"03111520"
,
"02319394"
),
service
=
"stat"
,
statReportType
=
"daily"
,
statType
=
c
(
"p25"
,
"p50"
,
"p75"
,
"min"
,
"max"
),
parameterCd
=
"00065"
,
convertType
=
FALSE
)
...
...
tests/testthat/tests_userFriendly_fxns.R
View file @
32665fd2
...
...
@@ -97,49 +97,6 @@ test_that("peak, rating curves, surface-water measurements", {
context
(
"qw"
)
test_that
(
"NWIS qw tests"
,
{
testthat
::
skip_on_cran
()
siteNumbers
<-
c
(
'04024430'
,
'04024000'
)
startDate
<-
'2010-01-01'
endDate
<-
''
parameterCd
<-
c
(
'34247'
,
'30234'
,
'32104'
,
'34220'
)
rawNWISqwData
<-
readNWISqw
(
siteNumbers
,
parameterCd
,
startDate
,
endDate
)
expect_is
(
rawNWISqwData
$
startDateTime
,
'POSIXct'
)
rawNWISqwDataReshaped
<-
readNWISqw
(
siteNumbers
,
parameterCd
,
startDate
,
endDate
,
reshape
=
TRUE
)
expect_is
(
rawNWISqwDataReshaped
$
startDateTime
,
'POSIXct'
)
expect_gt
(
ncol
(
rawNWISqwDataReshaped
),
ncol
(
rawNWISqwData
))
expect_lt
(
nrow
(
rawNWISqwDataReshaped
),
nrow
(
rawNWISqwData
))
parameterCd
<-
"all"
rawNWISall
<-
readNWISqw
(
siteNumbers
,
parameterCd
,
startDate
,
"2011-01-01"
,
reshape
=
TRUE
)
expect_is
(
rawNWISall
$
startDateTime
,
'POSIXct'
)
pgroup
<-
c
(
"NUT"
)
rawNWISNutrients
<-
readNWISqw
(
siteNumbers
,
pgroup
,
startDate
,
endDate
)
expect_is
(
rawNWISNutrients
$
startDateTime
,
'POSIXct'
)
qwret
<-
readNWISqw
(
"413437087150601"
,
parameterCd
=
c
(
"NUT"
,
"INN"
),
startDate
=
""
,
endDate
=
""
)
expect_true
(
nrow
(
qwret
)
==
0
)
siteNumber
<-
'455638089034501'
wy_start
<-
paste0
(
2014
,
"-10-01"
)
wy_end
<-
paste0
(
2015
,
"-09-30"
)
#No data test:
no.data
<-
readNWISqw
(
siteNumbers
=
siteNumber
,
parameterCd
=
'00060'
,
startDate
=
wy_start
,
endDat
=
wy_end
)
expect_true
(
nrow
(
no.data
)
==
0
)
})
context
(
"dv"
)
test_that
(
"NWIS dv tests"
,
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment