search for: wateryear

Displaying 4 results from an estimated 4 matches for "wateryear".

2017 Dec 18
2
Finding center of mass in a hydrologic time series
...30" siteNumber <- "10310000" QParameterCd <- "00060" Daily <- readNWISDaily(siteNumber, QParameterCd, StartDate, EndDate) # Define 'center of mass' function com <- function(x) { match(TRUE, cumsum(x/sum(x)) > 0.5) - 1 } wyrs <- unique(Daily$waterYear) for(i in (1:length(wyrs))){ OneYr <- Daily[Daily$waterYear==wyrs[i], ] mid <- com(OneYr$Q) if(i==1){ midPts <- as.Date(OneYr$Date[mid]) } else { midPts <- c(midPts, as.Date(OneYr$Date[mid])) } } Eric Morway Research Hydrologist Nevada Water Scienc...
2017 Dec 18
0
Finding center of mass in a hydrologic time series
...-09-30" siteNumber <- "10310000" QParameterCd <- "00060" Daily <- readNWISDaily(siteNumber, QParameterCd, StartDate, EndDate) # Define 'center of mass' function com <- function(x) { match(TRUE, cumsum(x/sum(x)) > 0.5) - 1 } wyrs <- unique(Daily$waterYear) x <- as.Date(sapply( wyrs, function(yr) { Df <- Daily[Daily$waterYear==yr,]; Df$Date[com(Df$Q)] } ), "1970-01-01") On Mon, Dec 18, 2017 at 4:47 PM, Morway, Eric <emorway at usgs.gov> wrote: > Eric B's response provided just the kind of quick & simple solution...
2017 Dec 16
0
Finding center of mass in a hydrologic time series
Hi Eric, How about match( TRUE, cumsum(hyd/sum(hyd)) > .5 ) - 1 HTH, Eric On Sat, Dec 16, 2017 at 3:18 PM, Morway, Eric <emorway at usgs.gov> wrote: > The small bit of script below is an example of what I'm attempting to do - > find the day on which the 'center of mass' occurs. In case that is the > wrong term, I'd like to know the day that essentially cuts
2017 Dec 16
3
Finding center of mass in a hydrologic time series
The small bit of script below is an example of what I'm attempting to do - find the day on which the 'center of mass' occurs. In case that is the wrong term, I'd like to know the day that essentially cuts the area under the curve in to two equal parts: set.seed(4004) Date <- seq(as.Date('2000-09-01'), as.Date('2000-09-30'), by='day') hyd <-