[R-sig-Geo] Create a mask with 1 deg latitudinal bands

Michael Sumner mdsumner at gmail.com
Tue Jun 18 02:41:46 CEST 2013


How about this?

library(raster)

## quick way to get 1-degree raster with your extents
r <- crop(raster(), extent(-58,-48,-17,-2))
r2 <- setValues(r, rowFromCell(r, 1:ncell(r)))
plot(r2)



On Tue, Jun 18, 2013 at 1:10 AM, ppanday <ppanday at clarku.edu> wrote:
> Hi, I am trying to create a mask within a specified extent [ext <-
> extent(-58,-48,-17,-2)] that has 1 degree latitudinal band masks. So every 1
> degree is a different number category. Eventually, I want to use it in zonal
> (as a mask) to obtain zonal statistics.
>
> I have a way that is a bit roundabout and I was trying to see if there is a
> more straightforward option.
>
> Sincerely
> Prajjwal
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Create-a-mask-with-1-deg-latitudinal-bands-tp7583803.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Michael Sumner
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-sig-Geo mailing list