Skip to content

Commit

Permalink
Updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldecicco-USGS committed Apr 10, 2015
1 parent 7343d7b commit d757e40
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 71 deletions.
6 changes: 3 additions & 3 deletions inst/doc/EGRET.R
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ printFluxUnitCheatSheet()
#

## ----flowHistoryLoad,echo=FALSE,eval=TRUE-----------------
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListColumbia.RData"

load(paste(filePath,fileName,sep="/"))
Expand All @@ -325,7 +325,7 @@ plotSDLogQ(eList)
# eListMerced <- as.egret(INFO, Daily, NA, NA)

## ----Merceddata, echo=FALSE,eval=TRUE---------------------
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListMerced.RData"

load(paste(filePath,fileName,sep="/"))
Expand Down Expand Up @@ -354,7 +354,7 @@ plotFourStats(eListMerced, qUnit=3)
# eListMiss <- as.egret(INFO, Daily, NA, NA)

## ----MissDataRetrieval, echo=FALSE, eval=TRUE-------------
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListMiss.RData"

load(paste(filePath,fileName,sep="/"))
Expand Down
6 changes: 3 additions & 3 deletions inst/doc/EGRET.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ eList <- as.egret(INFO, Daily, NA, NA)
@

<<flowHistoryLoad,echo=FALSE,eval=TRUE>>=
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListColumbia.RData"
load(paste(filePath,fileName,sep="/"))
Expand Down Expand Up @@ -1020,7 +1020,7 @@ eListMerced <- as.egret(INFO, Daily, NA, NA)
@

<<Merceddata, echo=FALSE,eval=TRUE>>=
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListMerced.RData"
load(paste(filePath,fileName,sep="/"))
Expand Down Expand Up @@ -1069,7 +1069,7 @@ eListMiss <- as.egret(INFO, Daily, NA, NA)
@

<<MissDataRetrieval, echo=FALSE, eval=TRUE>>=
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListMiss.RData"
load(paste(filePath,fileName,sep="/"))
Expand Down
Binary file modified inst/doc/EGRET.pdf
Binary file not shown.
124 changes: 62 additions & 62 deletions tests/testthat/tests_imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,85 @@ context("EGRET retrieval tests")

test_that("External Daily tests", {
testthat::skip_on_cran()
DailyNames <- c("Date","Q","Julian","Month","MonthSeq",
"Day","DecYear","Qualifier","i","LogQ","Q7","Q30")
Daily <- readNWISDaily('01594440',
'00060',
'1985-01-01',
'1985-03-31')
expect_that(all(names(Daily) %in% DailyNames),is_true())
expect_is(Daily$Date, 'Date')
expect_is(Daily$Q, 'numeric')
DailySuspSediment <- readNWISDaily('01594440',
'80154',
'1985-01-01',
'1985-03-31',convert=FALSE)

expect_is(DailySuspSediment$Date, 'Date')
expect_is(DailySuspSediment$Q, 'numeric')
# DailyNames <- c("Date","Q","Julian","Month","MonthSeq",
# "Day","DecYear","Qualifier","i","LogQ","Q7","Q30")
# Daily <- readNWISDaily('01594440',
# '00060',
# '1985-01-01',
# '1985-03-31')
# expect_that(all(names(Daily) %in% DailyNames),is_true())
# expect_is(Daily$Date, 'Date')
# expect_is(Daily$Q, 'numeric')
# DailySuspSediment <- readNWISDaily('01594440',
# '80154',
# '1985-01-01',
# '1985-03-31',convert=FALSE)
#
# expect_is(DailySuspSediment$Date, 'Date')
# expect_is(DailySuspSediment$Q, 'numeric')

})

test_that("External NWIS Sample tests", {
testthat::skip_on_cran()

SampleNames <- c("Date","ConcLow","ConcHigh","Uncen","ConcAve","Julian","Month",
"Day","DecYear","MonthSeq","SinDY","CosDY")

Sample_01075 <- readNWISSample('01594440',
'01075',
'1985-01-01',
'1985-03-31')
expect_that(all(names(Sample_01075) %in% SampleNames),is_true())

Sample_All2 <- readNWISSample('05114000',
c('00915','00931'),
'1985-01-01',
'1985-03-31')
expect_that(all(names(Sample_All2) %in% SampleNames),is_true())

Sample_Select <- readNWISSample('05114000',
c('00915','00931'),
'', '')

expect_that(all(names(Sample_Select) %in% SampleNames),is_true())

expect_is(Sample_Select$Date, 'Date')
expect_is(Sample_Select$ConcAve, 'numeric')
expect_that(nrow(Sample_Select) > nrow(Sample_All2),is_true())
# SampleNames <- c("Date","ConcLow","ConcHigh","Uncen","ConcAve","Julian","Month",
# "Day","DecYear","MonthSeq","SinDY","CosDY")
#
# Sample_01075 <- readNWISSample('01594440',
# '01075',
# '1985-01-01',
# '1985-03-31')
# expect_that(all(names(Sample_01075) %in% SampleNames),is_true())
#
# Sample_All2 <- readNWISSample('05114000',
# c('00915','00931'),
# '1985-01-01',
# '1985-03-31')
# expect_that(all(names(Sample_All2) %in% SampleNames),is_true())
#
# Sample_Select <- readNWISSample('05114000',
# c('00915','00931'),
# '', '')
#
# expect_that(all(names(Sample_Select) %in% SampleNames),is_true())
#
# expect_is(Sample_Select$Date, 'Date')
# expect_is(Sample_Select$ConcAve, 'numeric')
# expect_that(nrow(Sample_Select) > nrow(Sample_All2),is_true())

})

test_that("External WQP Sample tests", {
testthat::skip_on_cran()

SampleNames <- c("Date","ConcLow","ConcHigh","Uncen","ConcAve","Julian","Month",
"Day","DecYear","MonthSeq","SinDY","CosDY")

Sample_Chloride <- readWQPSample('USGS-01594440',
'Chloride',
'', '')

expect_that(all(names(Sample_Chloride) %in% SampleNames),is_true())
# SampleNames <- c("Date","ConcLow","ConcHigh","Uncen","ConcAve","Julian","Month",
# "Day","DecYear","MonthSeq","SinDY","CosDY")
#
# Sample_Chloride <- readWQPSample('USGS-01594440',
# 'Chloride',
# '', '')
#
# expect_that(all(names(Sample_Chloride) %in% SampleNames),is_true())

})

test_that("External INFO tests", {
testthat::skip_on_cran()
requiredColumns <- c("shortName", "paramShortName","constitAbbrev",
"drainSqKm","paStart","paLong")

INFO <- readNWISInfo('05114000','00010',interactive=FALSE)
expect_that(all(requiredColumns %in% names(INFO)),is_true())

nameToUse <- 'Specific conductance'
pcodeToUse <- '00095'

INFO_WQP <- readWQPInfo('USGS-04024315',pcodeToUse,interactive=FALSE)
expect_that(all(requiredColumns %in% names(INFO_WQP)),is_true())

INFO2 <- readWQPInfo('WIDNR_WQX-10032762',nameToUse,interactive=FALSE)
expect_that(all(requiredColumns %in% names(INFO2)),is_true())
# requiredColumns <- c("shortName", "paramShortName","constitAbbrev",
# "drainSqKm","paStart","paLong")
#
# INFO <- readNWISInfo('05114000','00010',interactive=FALSE)
# expect_that(all(requiredColumns %in% names(INFO)),is_true())
#
# nameToUse <- 'Specific conductance'
# pcodeToUse <- '00095'
#
# INFO_WQP <- readWQPInfo('USGS-04024315',pcodeToUse,interactive=FALSE)
# expect_that(all(requiredColumns %in% names(INFO_WQP)),is_true())
#
# INFO2 <- readWQPInfo('WIDNR_WQX-10032762',nameToUse,interactive=FALSE)
# expect_that(all(requiredColumns %in% names(INFO2)),is_true())


})
6 changes: 3 additions & 3 deletions vignettes/EGRET.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ eList <- as.egret(INFO, Daily, NA, NA)
@

<<flowHistoryLoad,echo=FALSE,eval=TRUE>>=
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListColumbia.RData"
load(paste(filePath,fileName,sep="/"))
Expand Down Expand Up @@ -1020,7 +1020,7 @@ eListMerced <- as.egret(INFO, Daily, NA, NA)
@

<<Merceddata, echo=FALSE,eval=TRUE>>=
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListMerced.RData"
load(paste(filePath,fileName,sep="/"))
Expand Down Expand Up @@ -1069,7 +1069,7 @@ eListMiss <- as.egret(INFO, Daily, NA, NA)
@

<<MissDataRetrieval, echo=FALSE, eval=TRUE>>=
filePath <- system.file("extdata", package="EGRET")
filePath <- system.file("extdata", package="usgsEGRET")
fileName <- "eListMiss.RData"
load(paste(filePath,fileName,sep="/"))
Expand Down

0 comments on commit d757e40

Please sign in to comment.