Re: [R-sig-Geo] Best raster of raster stack

2014-03-08 Thread Jonathan Greenberg
Small mod: the above works with version 1.3.4 or later of spatial.tools (on R-forge, at the time of this email) -- if you are using an earlier version (e.g. the one on CRAN at the time of this email), you need to slightly modify the function headers to include ellipses: max_of_rasters <- function(

Re: [R-sig-Geo] Best raster of raster stack

2014-03-08 Thread Jonathan Greenberg
Just to throw yet another solution into the pot, here's how to do this with rasterEngine (which will allow for parallel processing of your input to potentially speed your process up): # Individual rasters as inputs approach: library(spatial.tools) raster1 <- raster(system.file("external/tahoe_lida

Re: [R-sig-Geo] Best raster of raster stack

2014-03-08 Thread Maurizio Marchi
Tanks a lot for your suggestions. maybe there will be a lot of different ways to do that but merging your scripts I found exactly what I wanted to do: # beginning library(raster) r1 <- raster(matrix(c(1,1,1,2,2,2,4,4,4), ncol = 3)) r2 <- raster(matrix(c(2,2,2,3,3,3,1,1,1), ncol = 3)) r3 <- raster(

Re: [R-sig-Geo] Spplot: Specifying individual point symbols

2014-03-08 Thread Mark Payne
Hi Oscar, Thanks for the reply. Unfortunately your example doesn't work for me. What version of sp and lattice do you have installed? Package: sp Version: 1.0-14 Date: 2013-10-15 Package: lattice Version: 0.20-15 Date: 2013/03/24 Mark On 7 March 2014 16:25, Oscar Perpiñan wrote: > Use group

Re: [R-sig-Geo] Best raster of raster stack

2014-03-08 Thread Ahmadou Dicko
You can use the calc function too, based on the same example Roman gave library(raster) set.seed(1) r1 <- raster(matrix(runif(9), ncol = 3)) r2 <- raster(matrix(runif(9), ncol = 3)) r3 <- raster(matrix(runif(9), ncol = 3)) r <- stack(r1, r2, r3) res1 <- calc(r, fun = max) ## maximum value of all

Re: [R-sig-Geo] Best raster of raster stack

2014-03-08 Thread Roman Luštrik
You mean something like this? Basically I just wrapped a function around extract. library(raster) r1 <- raster(matrix(runif(9), ncol = 3)) r2 <- raster(matrix(runif(9), ncol = 3)) r3 <- raster(matrix(runif(9), ncol = 3)) r <- stack(r1, r2, r3) cellvals <- extract(r, 3) which(cellvals == max(cell

[R-sig-Geo] Best raster of raster stack

2014-03-08 Thread Maurizio Marchi
Hallo everybody. Is there a way to see in a rasterstack with the raster package which layer has the higer value for a selected pixel? I have a rasterstack with 22 raster layers and I would like to have an unique raster with, for each pixel, the maximum value of 22 rasters. For example: Pixel number

Re: [R-sig-Geo] Error fitting separable space-time variogram model

2014-03-08 Thread Benedikt Gräler
The error occurs when the internally used optim function tries a non-positive range. You can either try to use different start values for your model or provide boundary arguments as in optim to fit.StVariogram. These are passed on to optim via ..., see the help page of optim for details. The dem

[R-sig-Geo] Error fitting separable space-time variogram model

2014-03-08 Thread d.g.rossiter
I am developing a tutorial on space-time geostatistics, expanding on the nice st.pdf vignette. I can successfully fit a metric variogram model to an s-t empirical variogram, but when I try to fit a separable model I get an error which I can't solve nor interpret: "Error in vgm(1 - par[4], as.ch