Skip to content

Create a mask with 1 deg latitudinal bands

2 messages · ppanday, Michael Sumner

#
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.
#
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: