Displaying 14 results from an estimated 14 matches for "morway".
Did you mean:
norway
2017 Dec 18
2
Finding center of mass in a hydrologic time series
...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 Science Center
U.S. Geological Survey
2730 N. Deer Run Rd.
Carson City, NV 89701
(775) 887-7668
*orcid*: 0000-0002-8553-6140 <http://orcid.org/0000-0002-8553-6140>
On Sat, Dec 16, 2017 at 5:32 AM, Eric Berger <ericjberger at gmail.com> wrote:
>...
2017 Dec 18
0
Finding center of mass in a hydrologic time series
...ter 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 I was
> hoping for (appears as the function com below). However, I once again
> failed to take advantage of the power of R and have reverted back to using
> a for loo...
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 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 the area under
>...
2017 Jun 07
0
Determining which.max() within groups
...e the matter of Julian dates to you or others.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Jun 6, 2017 at 6:30 PM, Morway, Eric <emorway at usgs.gov> wrote:
> 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 1...
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 Sep 07
1
spplot modifications
...linear scale. Second, at the top of the legend there is a
random green bar that shouldn't be there. If you know what causes this or
more importantly, how to get rid of it, please help. I've included the code
and text files necessary to create this figure in the zip file.
Thank you,
Eric Morway
http://www.nabble.com/file/p25336596/Morway_R_Qs.zip Morway_R_Qs.zip
--
View this message in context: http://www.nabble.com/spplot-modifications-tp25336596p25336596.html
Sent from the R help mailing list archive at Nabble.com.
2017 Dec 13
3
inefficient for loop, is there a better way?
The code below is a small reproducible example of a much larger problem.
While the script below works, it is really slow on the true dataset with
many more rows and columns. I'm hoping to get the same result to examp,
but with significant time savings.
The example below is setting up a data.frame for an ensuing regression
analysis. The purpose of the script below is to appends columns to
2012 Nov 02
2
override date in xts time series
Using the following bit of R, I'm wondering if there is a way to
override/manipulate/replace the date in one xts time series with the date of
another xts time series while not affecting/changing the times of the xts
time series?
library(xts)
x.Date <- rep("1/1/2004",times=5)
x.Times<- c("00:00:00", "00:15:00", "00:30:00",
2017 Sep 13
0
compounding precipitation based on whether falls within a day
...you like. I leave those pleasures to you.
HTH.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Wed, Sep 13, 2017 at 9:52 AM, Morway, Eric <emorway at usgs.gov> wrote:
> Using the small reproducible example below, I'm wondering how best to
> complete the following task:
>
> In the small reproducible example below, the 3D array prec has indexes that
> correspond to time, x, y (i.e., prec[time, x, y]). I...
2017 Sep 13
2
compounding precipitation based on whether falls within a day
Using the small reproducible example below, I'm wondering how best to
complete the following task:
In the small reproducible example below, the 3D array prec has indexes that
correspond to time, x, y (i.e., prec[time, x, y]). In this case, the time
index is hours since some predefined start time. I'd like to add up all
the time indexes in 'prec' based on whether or not the
2017 Dec 20
1
outlining (highlighting) pixels in ggplot2
I apprecaite the guidance Eik, that works great! I'm also wondering if you
have any pointers for how I might stretch the color scale so that the max
and min values are the same? Right now, the min is -0.064 and the max is
something closer to 0.04. As you can see in what I sent, I tried adding:
zmax1 = max(abs(m1))
ggplot(..., autoscale = FALSE, zmin = -1 * zmax1, zmax = zmax1) + ...
to
2017 Dec 20
0
outlining (highlighting) pixels in ggplot2
...ot;darkblue",
midpoint = 0)
+annotate("rect",ymin=ind[,"row"]-.5,ymax=.5+ind[,"row"],
xmin=-.5+ind[,"col"],xmax=.5+ind[,"col"],colour="red", size=.5,
linetype=1, fill=NA)
Cheers
Am 20.12.2017 um 01:32 schrieb Morway, Eric:
> library(ggplot2)
> library(RColorBrewer)
> library(reshape2)
>
> m1 <- matrix(c(
> -0.0024, -0.0031, -0.0021, -0.0034, -0.0060, -1.00e-02, -8.47e-03, -0.0117,
> -0.0075, -0.0043, -0.0026, -0.0021,
> -0.0015, -0.0076, -0.0032, -0.0105, -0.0107, -2.73e-02, -3.37e-...
2017 Dec 20
2
outlining (highlighting) pixels in ggplot2
Using the small reproducible example below, I'd like to know if one can
somehow use the matrix "sig" (defined below) to add a black outline (with
lwd=2) to all pixels with a corresponding value of 1 in the matrix 'sig'?
So for example, in the ggplot2 plot below, the pixel located at [1,3] would
be outlined by a black square since the value at sig[1,3] == 1. This is my
first