Re: [R-sig-Geo] gridded time series analysis

2010-11-26 Thread Jacob van Etten
you could try this approach (use calc whenever you can): (supposing your bricks have 12 layers) br3 <- stack(brick1, brick2) lmS <- function(x) lm(x[1:12] ~ x[13:24)$coefficients[2] r <- calc(br3, lmS) Jacob. --- On Fri, 26/11/10, steven mosher wrote: From: steven mosher Subject: Re: [R-sig-

Re: [R-sig-Geo] Archives Search Suggestion

2010-11-25 Thread Jacob van Etten
Using www.rseek.org is one way to reduce your carbon foodprint. --- On Thu, 25/11/10, Brian Oney wrote: From: Brian Oney Subject: [R-sig-Geo] Archives Search Suggestion To: r-sig-geo@stat.math.ethz.ch Date: Thursday, 25 November, 2010, 15:52 Hello List, Sorry if this is just spam. Maybe I coul

Re: [R-sig-Geo] Anyone attempted to "animate" multi-layered rasters?

2010-11-15 Thread Jacob van Etten
, making an external install unnecessary. Jacob. --- On Mon, 15/11/10, Kevin Ummel wrote: From: Kevin Ummel Subject: Re: [R-sig-Geo] Anyone attempted to "animate" multi-layered rasters? To: "steven mosher" Cc: "Jacob van Etten" , R-sig-Geo@stat.math.ethz.ch, x.

Re: [R-sig-Geo] Anyone attempted to "animate" multi-layered rasters?

2010-11-15 Thread Jacob van Etten
A function is not really necessary. It´s actually quite simple. library(raster) library(animation) setwd("c:/empty") logo <- raster(system.file("external/rlogo.grd", package="raster"), values=TRUE) saveMovie( for(i in 1:250) {     logo1 <- logo     logo1[logo1 wrote: From: Kevin Ummel Subject

Re: [R-sig-Geo] Bioclimatic variables - wettest quarter

2010-11-09 Thread Jacob van Etten
om: Brian Oney Subject: Re: [R-sig-Geo] Bioclimatic variables - wettest quarter To: "Jacob van Etten" Cc: r-sig-geo@stat.math.ethz.ch Date: Tuesday, 9 November, 2010, 2:11 Hi Jacob, You are right it does produce a stack. I did not know that calc can handle a co

Re: [R-sig-Geo] Bioclimatic variables - wettest quarter

2010-11-08 Thread Jacob van Etten
Oops, the function should of course be something like this: func <- function(x) {   from <- c(12,1:11)[x[13]]   to <- c(2:12,1)[x[13]]   return(sum(x[c(from,x[13],to)])) } --- On Mon, 8/11/10, Jacob van Etten wrote: From: Jacob van Etten Subject: Re: [R-sig-Geo] Bi

Re: [R-sig-Geo] Bioclimatic variables - wettest quarter

2010-11-08 Thread Jacob van Etten
ney Subject: Re: [R-sig-Geo] Bioclimatic variables - wettest quarter To: "Jacob van Etten" Cc: r-sig-geo@stat.math.ethz.ch Date: Monday, 8 November, 2010, 14:48 Hi Jacob, Thanks for the suggestion. So... func <- function(X) {x <- movingFun(c(X), n=3, su

Re: [R-sig-Geo] Bioclimatic variables - wettest quarter

2010-11-08 Thread Jacob van Etten
I don´t know what the problem is with overlay(), but you could use an alternative approach, using calc() instead. Something like this (not tried) library(raster) library(dismo) func <- function(x, ...) movingFun(x, n=3, sum, circular=TRUE) wetness_quarters <- calc(mon_stac, func) wettest_quarte

Re: [R-sig-Geo] Apply a look-up table using Raster package

2010-09-13 Thread Jacob van Etten
Hi Ned, Function reclass() does this. Jacob. --- On Mon, 13/9/10, Ned Horning wrote: From: Ned Horning Subject: [R-sig-Geo] Apply a look-up table using Raster package To: r-sig-geo@stat.math.ethz.ch Date: Monday, 13 September, 2010, 22:16 Hi - Is it possible to modify a Raster layer using a

Re: [R-sig-Geo] how to do randomly sampling in raster layer

2010-08-03 Thread Jacob van Etten
Dear Mao, This is an alternative approach, using only package raster and working with a lonlat grid. In a lonlat grid, cells represent different areas. Therefore, I randomly draw cells with probabilities relative to their area. I simply use the function sample() from base to do the sampling. l

Re: [R-sig-Geo] Bug in rasterToPoints() ?

2010-07-14 Thread Jacob van Etten
Strange. It looks as if the projection slot holds something that is not of class CRS. Could you make a reproducible example (a small raster with the same projection)? Using show (= just the name of the raster) gives more useful information about the raster than summary(). Jacob. --- On Wed,

Re: [R-sig-Geo] getValues() question

2010-07-09 Thread Jacob van Etten
You might try cellValues(). Argument "cells" should be the indices of the non-masked cells. Something like this: cellInd <- which(getValues(r1) != mask.value) valueVector <- cellValues(r2, cells = cellInd) Jacob. --- On Fri, 9/7/10, Jonathan Greenberg wrote: From: Jonathan Greenberg Subje

Re: [R-sig-Geo] Raster:memory or disk?

2010-06-30 Thread Jacob van Etten
r1 <- raster(system.file("external/test.grd", package="raster")) r2 <- r1 dataSource(r1) dataSource(r2) r2 has its data on disk. --- On Wed, 30/6/10, Agustin Lobo wrote: From: Agustin Lobo Subject: [R-sig-Geo] Raster:memory or disk? To: "r-sig-geo" Cc: agustin.l...@ija.csic.es Date: Wednesd

Re: [R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Jacob van Etten
Hi Roman, Nice picture. The help file says: "Distances are calculated by summing local distances between cells, which are connected with their neighbours in 8 directions." Hence, you get a hexagonal shape if the grid doesn´t have any "islands" the shortest routes have to avoid. Perhaps dist

Re: [R-sig-Geo] projection() and proj4string()

2010-05-29 Thread Jacob van Etten
Hi Barry, What do you mean with a broken OO model? Best, Jacob. --- On Sat, 5/29/10, Barry Rowlingson wrote: From: Barry Rowlingson Subject: Re: [R-sig-Geo] projection() and proj4string() To: "Agustin Lobo" Cc: r-sig-geo@stat.math.ethz.ch Date: Saturday, May 29, 2010, 7:10 PM On Sat, May

Re: [R-sig-Geo] Creating non-overlapping polygons from centroid with known size

2010-05-23 Thread Jacob van Etten
programme. ArcGis has this extension: http://www.geog.unt.edu/~pdong/software/VoronoiHelp.pdf I also found this document, which discusses free programmes (there are more!): http://giswin.geo.tsukuba.ac.jp/sis/tutorial/GISHint,fatemeh.pdf Good luck! Jacob van Etten --- On Sun, 5/23/10, Jens

Re: [R-sig-Geo] Region raster

2010-05-14 Thread Jacob van Etten
One way of doing this is by using the package raster. Take a look at: ?zonal Jacob. --- On Fri, 5/14/10, Raphael Saldanha wrote: From: Raphael Saldanha Subject: [R-sig-Geo] Region raster To: "r-sig-geo" Date: Friday, May 14, 2010, 2:53 PM Dear list, I'm completely newbie with working with

Re: [R-sig-Geo] trying to plot listed RasterLayers

2010-05-14 Thread Jacob van Etten
This should work: plot(list.of.rasters[[1]]) You could also make a RasterStack instead of a list: r <- raster(nrows=36, ncols=18) r <- setValues(r, runif(ncell(r))) r4 <- stack(r,r,r,r) plot(r4) #extract first layer and plot plot(raster(r4,1)) See also: ?addLayer Best, Jacob. --- On Fri, 5/

Re: [R-sig-Geo] raster sizes

2010-04-28 Thread Jacob van Etten
Dear Roman,   raster can deal with rasters that don´t fit in RAM.  A 1 million cell raster fits in RAM, so I would consider this small.   Jacob. --- On Wed, 4/28/10, Roman Luštrik wrote: From: Roman Luštrik Subject: [R-sig-Geo] raster sizes To: "r-sig-geo" Date: Wednesday, April 28, 2

Re: [R-sig-Geo] Suggestion to build a Special Filter for a Raster classification

2010-04-13 Thread Jacob van Etten
The function focal() does these types of operations. Raster algebra and boolean operations do the rest. library(raster) va <- c(0,0,0,0,0,0,0,0,0,0,0,1,0,0, 0,1,0,0,0,0,     0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,     0,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,     0,0,1,1,1,1,1,1,1,1,

Re: [R-sig-Geo] kriging as fish swim, not as crows fly

2010-01-29 Thread Jacob van Etten
With package gdistance, currently under development on R-Forge, it is possible to calculate a number of "non-Euclidean" distances, including the least-cost distance (based on package igraph), resistance distance, and (soon) randomised shortest paths. Jacob van Etten --- On Wed, 1/27

Re: [R-sig-Geo] Best way to calculate distance between geographicalpoints

2010-01-14 Thread Jacob van Etten
As the Wikipedia article on great-circle distances explains very well, there is a trade-off between local accuracy, long-distance accuracy, and computational effort. Therefore, I don´t think it is a simple matter of better or worse, but what formula/function is fit for your purpose. Jacob. ---