From c2a57cae1762ae0d04571803f487c2dfc5fec3d4 Mon Sep 17 00:00:00 2001 From: James McCreight Date: Thu, 30 Apr 2015 16:44:29 -0600 Subject: [PATCH] Final v1.0.0 local commit! --- NAMESPACE | 13 ---- README.Rmd | 2 +- man/MkDischargeVariance.Rd | 44 ----------- man/MkUsgsTimeSlice.Rd | 108 -------------------------- man/Model3SdErrClimTaper.Rd | 30 ------- man/Model3SdErrPctErrPlusQntlIncpt.Rd | 23 ------ man/ReadNcTimeSlice.Rd | 23 ------ man/RoundMinutes.Rd | 27 ------- man/WriteDischargeObsSeq.Rd | 40 ---------- man/WriteNcTimeSlice.Rd | 23 ------ 10 files changed, 1 insertion(+), 332 deletions(-) delete mode 100644 man/MkDischargeVariance.Rd delete mode 100644 man/MkUsgsTimeSlice.Rd delete mode 100644 man/Model3SdErrClimTaper.Rd delete mode 100644 man/Model3SdErrPctErrPlusQntlIncpt.Rd delete mode 100644 man/ReadNcTimeSlice.Rd delete mode 100644 man/RoundMinutes.Rd delete mode 100644 man/WriteDischargeObsSeq.Rd delete mode 100644 man/WriteNcTimeSlice.Rd diff --git a/NAMESPACE b/NAMESPACE index 381f778..43c6aa8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -30,7 +30,6 @@ export(CumsumNa) export(ExportGeogrid) export(FindUsgsStns) export(FormalsToDf) -export(GetActiveHucData) export(GetFileStat) export(GetGages2NwisMeta) export(GetMODIS) @@ -47,21 +46,14 @@ export(GetUsgsIvProduct) export(ImproveHucMeta) export(InsertRS) export(LoadMetaDB) -export(MkDischargeVariance) export(MkNcdf) -export(MkUsgsTimeSlice) -export(Model3SdErrClimTaper) -export(Model3SdErrPctErrPlusQntlIncpt) export(NamedList) export(Nse) export(NseLog) export(PadRange) -export(PlotCollectStats) export(PlotFdc) export(PlotFdcCompare) export(PlotFluxCompare) -export(PlotLatency) -export(PlotNStnSlice) export(PlotPrettyUsgs) export(PlotWatBudg) export(PrettyUsgs) @@ -78,7 +70,6 @@ export(ReadCoDwrGage) export(ReadFrxstPts) export(ReadGwOut) export(ReadLdasoutWb) -export(ReadNcTimeSlice) export(ReadRtout) export(ReadSnodasDepthSweDate) export(ReadUsgsGage) @@ -87,15 +78,11 @@ export(Rmse) export(RmseNorm) export(RotateCcw) export(RotateCw) -export(RoundMinutes) export(SaveHucData) export(SmoothStack) export(StdLon) export(TransTz) export(VisualizeChanNtwk) export(VisualizeDomain) -export(WriteDischargeObsSeq) -export(WriteNcPrettyUsgs) -export(WriteNcTimeSlice) export(github_GET) export(ncdump) diff --git a/README.Rmd b/README.Rmd index 8834cd9..d1d91bd 100644 --- a/README.Rmd +++ b/README.Rmd @@ -78,7 +78,7 @@ at http://www.ral.ucar.edu/projects/wrf_hydro/rwrfhydro.php. Package source: Git repositry available on github at https://github.com/mccreigh/rwrfhydro.
- See the README to contribute to the source code. + See the README to contribute to the source code. diff --git a/man/MkDischargeVariance.Rd b/man/MkDischargeVariance.Rd deleted file mode 100644 index a8c02a4..0000000 --- a/man/MkDischargeVariance.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/dart_prep_streamflow.R -\name{MkDischargeVariance} -\alias{MkDischargeVariance} -\title{Make variances for prettyUsgs discharge observations.} -\usage{ -MkDischargeVariance(prettyUsgs, error3SdFunc, retVariance = TRUE) -} -\arguments{ -\item{prettyUsgs}{The prettyUsgs discharge observations to which variances -are to be added.} - -\item{error3SdFunc}{Function which accepts the data and returns 3-sigma error -estimates.} - -\item{retVariance}{Logical Returns variance if TRUE, else returns 1-sigma -error.} -} -\description{ -\code{MkDischargeVariance} makes variances fr prettyUsgs discharge -observations. The formulation of the variances is subjective. Assuming -zero-mean Gaussian observation errors, the approach here is to supply a -function which estimates the 3-sigma (inner 99.5% error quantiles) around the -observations. This amount seems somewhat easier to conceptualize than -1-sigma, hence here we are. This function divides the error amounts by 3 and -either returns the standard deviation or squares the result to return the -variance (default). -} -\examples{ -\dontrun{ -dbPath <- '~/usgsDb/' -prettyOrodell <- - PrettySiteData(QuerySiteData(QuerySiteName("FOURMILE CREEK AT ORODELL, CO", path=dbPath), - product='00060', path=dbPath),metricOnly=FALSE, metric=TRUE) -prettyOro <- MkDischargeVariance(prettyOrodell, Model3SdErrClimTaper) -prettyO <- subset(prettyOro, dateTime < as.POSIXct('2012-01-01')) -oroPlot <- PlotPrettyData(prettyO) -} -} -\concept{ -DART dataMgmt -} -\keyword{manip} - diff --git a/man/MkUsgsTimeSlice.Rd b/man/MkUsgsTimeSlice.Rd deleted file mode 100644 index 3eb6191..0000000 --- a/man/MkUsgsTimeSlice.Rd +++ /dev/null @@ -1,108 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/usgs_time_slice.R -\name{MkUsgsTimeSlice} -\alias{MkUsgsTimeSlice} -\title{Make timeslices from active USGS discharge data files.} -\usage{ -MkUsgsTimeSlice(realTimeFiles, outPath, nearestMin = 5, oldestTime = NULL, - qcFunction, varianceFunction) -} -\arguments{ -\item{realTimeFiles}{Character vector of active RData format files to be -processed.} - -\item{outPath}{Character, the directory path where ncdf files are to be -written.} - -\item{nearestMin}{Numeric, the time resolution to which the observation times -are rounded and the netcdf timeslice files are to be written. Must evenly -divide 60.} - -\item{oldestTime}{POSIXct, the date BEFORE which data will be ignored.} - -\item{qcFunction}{Function, used to apply quality control procedures to the -timeslice in metric units. Note that this QC can only use information from -the current time. QC procedures involving the temporal domain will be -applied elsewhere.} - -\item{varianceFunction}{Function, used to derive the observation variance -from a dataframe with the following columns: \code{site_no}, -\code{dateTime}, \code{code}, \code{queryTime}, and \code{discharge.cms}. -The function accepts the dataframe and returns the data frame with the new -\code{variance} column.} -} -\value{ -A dataframe with two columns: \code{POSIXct} and \code{filename} - which given the time of the timeslice and the corresponding file name with - full path. -} -\description{ -Make timeslices from active USGS discharge data files. -} -\examples{ -\dontrun{ -realTimeFiles <- list.files(pattern='huc.*.RData', - path='~/usgsStreamData/realTimeData', - full.names=TRUE) -outPath = '~/usgsStreamData/timeSliceData/' -library(doMC) -registerDoMC(4) - -## A first test -ret1 <- MkUsgsTimeSlice( realTimeFiles[1:21], outPath=outPath, - oldest=as.POSIXct('2015-04-15 00:00:00', tz='UTC') ) -nrow(ret1) - -## delete the files and see how many more are created without the oldestTime set -unlink(ret1$file) -ret1 <- MkUsgsTimeSlice( realTimeFiles[1:21], outPath=outPath ) -nrow(ret1) ## quite a few more files. -ncdump(ret1$file[230]) ## 27 stations -ret2 <- MkUsgsTimeSlice( realTimeFiles[22:42], outPath=outPath ) -ncdump(ret1$file[230]) ## 58 stations - -## new experiment -unlink(unique(c(ret1$file, ret2$file))) -ret1 <- MkUsgsTimeSlice( realTimeFiles, outPath=outPath, nearest=60, - oldest=as.POSIXct('2015-04-15 00:00:00', tz='UTC')) -nStn <- - plyr::ldply(NamedList(ret1$file), - function(ff) { nc <- ncdump(ff, quiet=TRUE) - data.frame(nStn=nc$dim$stationId$len, - time=as.POSIXct('1970-01-01 00:00:00',tz='UTC') + - nc$dim$time$vals, - nUniqueStn = length(unique(nc$dim$stationId$vals)) )}, - .parallel=TRUE) -library(ggplot2) -ggplot(nStn, aes(x=time,y=nStn)) + geom_point(color='red') - - -############################### -## process on hydro-c1 -realTimeFiles <- list.files(pattern='huc.*.RData', - path='~/usgsStreamData/realTimeData', - full.names=TRUE) -outPath = '~/usgsStreamData/timeSliceData/' -library(doMC) -registerDoMC(12) - -## I'm worried about using too much memory, when I run this on all -## previously collected data, so break up the problem -chunkSize <- 1000 -chunkDf <- data.frame( ind = 0:(length(realTimeFiles) \%/\% chunkSize) ) -chunkDf <- within(chunkDf, { start = (ind)*chunkSize+1 - end = pmin( (ind+1)*chunkSize, length(realTimeFiles)) } ) - -for (ii in 1:nrow(chunkDf) ) { -ret1 <- MkUsgsTimeSlice( realTimeFiles[chunkDf$start[ii]:chunkDf$end[ii]], - outPath=outPath, nearest=60, - oldest=as.POSIXct('2015-04-15 00:00:00', tz='UTC') - ) -} - -## end dontrun } -} -\concept{ -usgs -} - diff --git a/man/Model3SdErrClimTaper.Rd b/man/Model3SdErrClimTaper.Rd deleted file mode 100644 index 5c234bf..0000000 --- a/man/Model3SdErrClimTaper.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/dart_prep_streamflow.R -\name{Model3SdErrClimTaper} -\alias{Model3SdErrClimTaper} -\title{Three-sigma error specification assuming errors are smaller near -climatological median (or other quantile).} -\usage{ -Model3SdErrClimTaper(data, qntlIncpt = 0.05, qntlClim = 0.5, - pctErr = 0.15) -} -\arguments{ -\item{data}{Numeric The values for which errors are to be modeled.} - -\item{qntlIncpt}{Numeric The quantile of historical observations to be used -as minimum error or intercept.} - -\item{qntlClim}{Numeric The quantile of historical observations to be used as -observation value of minimum error.} - -\item{pctErr}{Numeric The percent error associated with the observations.} -} -\description{ -\code{Model3SdErrClimTaper} models three-sigma errors (same units as input) -as smallest (\code{qntlIncpt} intercept is some climatological quantile) at -"climatological" observations (\code{qntlClim}, e.g. median = .5) and grow to -some maximum percent error (\code{pctErr}). This is expressed by \cr -\code{quantile(data, qntlIncpt) + pmin( pctErr*data, -pctErr*abs(data-quantile(data, qntlClim)) )} -} - diff --git a/man/Model3SdErrPctErrPlusQntlIncpt.Rd b/man/Model3SdErrPctErrPlusQntlIncpt.Rd deleted file mode 100644 index cc489ec..0000000 --- a/man/Model3SdErrPctErrPlusQntlIncpt.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/dart_prep_streamflow.R -\name{Model3SdErrPctErrPlusQntlIncpt} -\alias{Model3SdErrPctErrPlusQntlIncpt} -\title{Three-sigma errors specified as percent of observed plus some quantile of -historical flows.} -\usage{ -Model3SdErrPctErrPlusQntlIncpt(data, qntlIncpt = 0.005, pctErr = 0.1) -} -\arguments{ -\item{data,}{Numeric the values for which errors are to be modeled.} - -\item{qntlIncpt}{Numeric the quantile of historical observations to be used -as minimum error.} - -\item{pctErr}{Numeric the percent error associated with the observations.} -} -\description{ -\code{Model3SdErrPctErrPlusQntlIncpt} models three sigma (standard deviation) -errors (same units as input) as percent of observed plus some quantile of -historical record. -} - diff --git a/man/ReadNcTimeSlice.Rd b/man/ReadNcTimeSlice.Rd deleted file mode 100644 index e6a6e51..0000000 --- a/man/ReadNcTimeSlice.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/usgs_to_ncdf.R -\name{ReadNcTimeSlice} -\alias{ReadNcTimeSlice} -\title{Read a USGS discharge data timeslice from a netcdf file.} -\usage{ -ReadNcTimeSlice(file) -} -\arguments{ -\item{file,}{the ncdf file to read.} -} -\description{ -This is kind of the inverse of WriteNcTimeSlice to be used in extending existing -timeslices on file. -} -\examples{ -\dontrun{ -sliceFiles <- list.files('~/usgsStreamData/timeSliceData/','.*', full.names=TRUE) -ReadNcTimeSlice(tail(sliceFiles,1)) -} -} -\keyword{internal} - diff --git a/man/RoundMinutes.Rd b/man/RoundMinutes.Rd deleted file mode 100644 index c686cf0..0000000 --- a/man/RoundMinutes.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/usgs_time_slice.R -\name{RoundMinutes} -\alias{RoundMinutes} -\title{Round a POSIXct time to the nearest mth minute.} -\usage{ -RoundMinutes(POSIXct, nearest = 5) -} -\arguments{ -\item{POSIXct,}{POSIXct class vector.} - -\item{nearest,}{Numeric, the time resolution to which the passed times are -rounded. Must evenly divide 60.} -} -\value{ -A vector of POSIXct class corresponding to the input, rounded to the - nearest \code{nearest} minutes. -} -\description{ -Round a POSIXct time to the nearest mth minute. -} -\examples{ -print(time <- Sys.time()+lubridate::minutes(1:10)) -RoundMinutes(time, nearest=5) -} -\keyword{internal} - diff --git a/man/WriteDischargeObsSeq.Rd b/man/WriteDischargeObsSeq.Rd deleted file mode 100644 index 2c90757..0000000 --- a/man/WriteDischargeObsSeq.Rd +++ /dev/null @@ -1,40 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/dart_prep_streamflow.R -\name{WriteDischargeObsSeq} -\alias{WriteDischargeObsSeq} -\title{Writes an ascii obs_seq.in file for DART binary create_obs_sequence} -\usage{ -WriteDischargeObsSeq(pretty, outPath = ".", stationName, errorId, - typeQ = 20) -} -\arguments{ -\item{pretty}{The prettyUsgs discharge observations to which variances are to be added.} - -\item{outPath}{Character The directory where the file is to be written.} - -\item{stationName}{Character To help identify the outputfile and the station data in the file.} - -\item{errorId}{Character To help identify the outputfile and the error function used.} - -\item{typeQ}{Numeric Stream discharge obs type index in my pre-release version of DART. It could change. -DART/obs_kind/DEFAULT_obs_kind_mod.F90} -} -\description{ -\code{WriteDischargeObsSeq} makes variances for prettyUsgs discharge observations. The formulation -of the variances is subjective. Assuming zero-mean Gaussian observation errors, the approach -here is to supply a function which estimates the 3-sigma (inner 99.5% error quantiles) around -the observations. This amount seems somewhat easier to conceptualize than 1-sigma, hence here -we are. This function divides the error amounts by 3 and either returns the standard deviation -or squares the result to return the variance (default). -} -\examples{ -#Following on examples for MkDischargeVariance -\dontrun{ -WriteDischargeObsSeq(prettyOro, '~/.', 'orodell', 'climTaperDefault') -} -} -\concept{ -DART dataMgmt -} -\keyword{manip} - diff --git a/man/WriteNcTimeSlice.Rd b/man/WriteNcTimeSlice.Rd deleted file mode 100644 index 7287c92..0000000 --- a/man/WriteNcTimeSlice.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/usgs_to_ncdf.R -\name{WriteNcTimeSlice} -\alias{WriteNcTimeSlice} -\title{Write a USGS discharge timeslice to a netcdf file.} -\usage{ -WriteNcTimeSlice(dfByPosix, outPath) -} -\arguments{ -\item{dfByPosix}{Dataframe, a data frame with the following columns: -\code{site_no}, \code{dateTime}, \code{code}, \code{queryTime}, \code{discharge.cms}, -and \code{variance} where dateTime is the same for the entire dataframe.} - -\item{outPath}{Character, the file name with path for the output netcdf file.} -} -\description{ -Write a USGS discharge timeslice to a netcdf file. -} -\examples{ -## See \\link{MkUsgsTimeSlice}. -} -\keyword{internal} -