From af237f26800adbe13b45b67643f7f1a3396df03c Mon Sep 17 00:00:00 2001 From: Laura DeCicco <ldecicco@usgs.gov> Date: Thu, 27 Jun 2013 15:53:30 -0500 Subject: [PATCH] Added a warning for neg flow. --- R/populateDaily.r | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/R/populateDaily.r b/R/populateDaily.r index d9359a5c..f1716351 100644 --- a/R/populateDaily.r +++ b/R/populateDaily.r @@ -38,7 +38,9 @@ populateDaily <- function(rawData,qConvert,interactive=TRUE){ # rawData is a da localDaily$i <- 1:nrow(localDaily) noDataValue <- -999999 - nd<-ifelse(localDaily$Q==noDataValue,T,F) + + nd <- localDaily$Q==noDataValue + localDaily$Q<-ifelse(nd,NA,localDaily$Q) zeros<-which(localDaily$Q<=0) @@ -49,8 +51,20 @@ populateDaily <- function(rawData,qConvert,interactive=TRUE){ # rawData is a da qshift<- 0.001*mean(localDaily$Q, na.rm=TRUE) if (interactive){ - cat("There were ", as.character(nz), " zero flow days \n") - cat("All days therefore had",as.character(qshift),"cms added to the discharge value.\n") + negNums <- length(which(localDaily$Q<0)) + zeroNums <- length(which(localDaily$Q == 0)) + + if (negNums > 0) { + cat("There were ", as.character(negNums), " negative flow days \n") + cat("Negative values are not supported in the EGRET package\n") + } + + if (zeroNums > 0){ + cat("There were ", as.character(zeroNums), " zero flow days \n") + } + + cat("All days had",as.character(qshift),"cms added to the discharge value.\n") + } } else { qshift<-0.0 -- GitLab