[R-sig-Geo] Calculate percent cover in a raster
Thiago V. dos Santos
thi_veloso at yahoo.com.br
Wed Feb 17 02:51:48 CET 2016
I have a raster at 0.5 degree resolution with monthly totals of rainfall, which range from 50 mm to 600 mm:
## scratch a raster and fill some random values
r <- raster(nrows=22, ncols=20, xmn=-58, xmx=-48, ymn=-33, ymx=-22)
r <- round(runif(22 * 20, min=50, max=600), digits=0)
How can I calculate the percentage area of the raster covered with some rainfall ranges?
Let's say for example 0 to 100, 101 to 200, 201 to 300, 301 to 400, 401 to 500 and finally 501 to 600 mm?
Thanks in advance,
-- Thiago V. dos Santos
Land and Atmospheric Science
University of Minnesota
More information about the R-sig-Geo