[R] Resampling a grid to coarsen its resolution

Moshe Olshansky m_olshansky at yahoo.com
Wed Feb 10 04:55:47 CET 2010


One possibility I can see is to replace -9999 by NA and use mean with na.rm=TRUE.

--- On Wed, 10/2/10, Steve Murray <smurray444 at hotmail.com> wrote:

> From: Steve Murray <smurray444 at hotmail.com>
> Subject: [R] Resampling a grid to coarsen its resolution
> To: r-help at r-project.org
> Received: Wednesday, 10 February, 2010, 3:20 AM
> 
> Dear all,
> 
> I have a grid (data frame) dataset at 0.5 x 0.5 degrees
> spatial resolution (720 columns x 360 rows; regular spacing)
> and wish to coarsen this to a resolution of 2.5 x 2.5
> degrees. A simple calculation which takes the mean of a
> block of points to form the regridded values would do the
> trick. Values which should be excluded from the calculation
> are -9999 (unless all points within a block are -9999, in
> which case -9999 should be returned as the 'new' cell).
> 
> How would I go about achieving this in R?
> 
> Any help or guidelines would be very much appreciated.
> 
> Many thanks,
> 
> Steve
> 
> 
>     
>         
>           
>   
> _________________________________________________________________
> Got a cool Hotmail story? Tell us now
> 
> ______________________________________________
> R-help at r-project.org
> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>



More information about the R-help mailing list