[R-sig-Geo] Detect and summarize changes in categorical raster
Thiago V. dos Santos
thi_veloso at yahoo.com.br
Fri Jul 10 02:22:45 CEST 2015
Hi all,
I am trying to detect and summarize changes in categorical rasters.
I have two rasters. Each raster is a land use map, with values ranging from 1 to 15 and representing different land-use classes. r1 is my control scenario, and r2 is my climate change scenario where changes in climate induce changes in land use classes.
Here is some example data:
## scratch a raster brick with 120 timesteps (10 years)
r2 <- r1 <- brick(nrows=18, ncols=36, xmn=0, xmx=18, ymn=0, ymx=36, nl=120)
## fill some random values
set.seed(4)
r1[] <- round(runif(18 * 36 * 120, min=1, max=15), digits=0)
set.seed(5)
r2[] <- round(runif(18 * 36 * 120, min=1, max=15), digits=0)
What I would like to do is for each time step (brick layer), compare each cell of r2 relative to r1 in this way:
- is the value different? yes/no
- if yes, what was the change? for example 1 to 10, or 2 to 7 and so on.
By the end, I would like to be able to:
- plot a map showing the occurence of changes
- have a table with the frequency of changes in each class (i.e. 1 to 10, 2 to 7 etc)
Is there any tool to perform this analysis in R? Which one?
If no, what would be the best approach to implement that by myself?
Thanks in advance,
--
Thiago V. dos Santos
PhD student
Land and Atmospheric Science
University of Minnesota
http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm
Phone: (612) 323 9898
More information about the R-sig-Geo
mailing list