Displaying 10 results from an estimated 10 matches for "wyrs".
Did you mean:
wars
2017 Jun 07
4
Determining which.max() within groups
Using the dataset below, I got close to what I'm after, but not quite all
the way there. Any suggestions appreciated:
Daily <- read.table(textConnection(" Date wyr Q
1911-04-01 1990 4.530695
1911-04-02 1990 4.700596
1911-04-03 1990 4.898814
1911-04-04 1990 5.097032
1911-04-05 1991 5.295250
1911-04-06 1991 6.569508
1911-04-07 1991 5.861587
1911-04-08 1991 5.153666
2017 Jun 07
0
Determining which.max() within groups
cumsum() seems to be what you need.
This can probably be done more elegantly, but ...
out <- aggregate(Q ~ wyr, data = Daily, which.max)
tbl <- table(Daily$wyr)
out$Q <- out$Q + cumsum(c(0,tbl[-length(tbl)]))
out
## yields
wyr Q
1 1990 4
2 1991 6
3 1992 9
4 1993 15
5 1994 18
I leave the matter of Julian dates to you or others.
Cheers,
Bert
Bert Gunter
"The trouble
2017 Dec 18
2
Finding center of mass in a hydrologic time series
...ich
requires the library EGRET for pulling an example dataset) works, but
probably can be replaced with some version of the apply functionality? So
far, I've been unable to figure out how to enter the arguments to the apply
function. The idea is this: for each unique water year (variable 'wyrs' in
example below) in a 27 year continuous time series of daily values, find
the date of the 'center of mass', and build a vector of those dates.
Thanks, -Eric M
library(EGRET)
StartDate <- "1990-10-01"
EndDate <- "2017-09-30"
siteNumber <- "10310000&...
2017 Dec 18
0
Finding center of mass in a hydrologic time series
...EndDate <- "2017-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...
2012 Jun 11
2
Define a variable on a non-standard year interval (Water Years)
Hello,
I am trying to define a different interval for a "year". In hydrology,
a "water year" is defined as the period between October 1st and
September 30 of the following year. I was wondering how I might do
this in R. Say I have a data.frame like the following and I want to
extract a variable with the water year specs as defined above:
2004 Jun 10
3
Package installation
Hi all,
I'm very new to R.
I have installed R 1.9.0 on Linux (Fedora).
Now I got an self-made package comprising R functions as well as C-Code
which are used in several R functions.
I installed the package without any error (see install log below).
Then, I checked in /usr/lib/R/library if the package izbi exists and it
exists.
But whenever I try to load the library on the command line I
2011 Apr 22
1
Paste problem when looping variable assignments
...(yr)
for(n in 1:len){
WY[n]<-if(mo[n]>=10){
yr[n]+1
}else{
yr[n]}
}
partialpeakind<-which(round(q,2)>=round(pds_TD[i],2))
partialpeaksd<-dates[partialpeakind]
partialpeaksq<-q[partialpeakind]
partialpeaksWY<-WY[partialpeakind]
for(q in 1:length(partialpeaksWY)){
wyrs<-seq(min(partialpeaksWY),max(partialpeaksWY),by=1)
POTWY[[q]]<-sum(partialpeaksWY == wyrs[q])
POTWY_cut<-as.numeric(na.omit(POTWY))
paste(pds_gagehandles[[i]],"_pdswy",sep="")<-POTWY_cut}
pds_dropdates<-data.frame(partialpeaksWY,partialpeaksd,partialpeaksq)
w...
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 <-
2009 Jul 23
1
[PATCH server] changes required for fedora rawhide inclusion.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
AUTHORS | 17 ++++++
README | 10 +++
conf/ovirt-agent | 12 ++++
conf/ovirt-db-omatic | 12 ++++
conf/ovirt-host-browser | 12 ++++