[GRASS-user] Comparing 2 large Corine Land Cover maps
Hermann Peifer
peifer at gmx.eu
Fri Jul 22 06:41:55 EDT 2011
Hi,
I have 2 Corine Land Cover (CLC) raster maps, from 2000 and 2006. Both
maps have the same extent, the same resolution (100m) and use the same
44 CLC categories. The maps are pretty large: 67 000 cols x 58 000 rows
= 3 886 000 000 cells.
I'd like to categorise the changes between the 2 layers, according to a
decision matrix which I pasted below [1]. Row headers indicate the
clc2000 category, column headers represent the clc2006 category. I only
pasted the "left half" of the table in order to avoid ugly line breaks.
Question:
Is there a better (and faster) way than doing this comparison by using
r.mapcalc with a (nearly) endless if/else chain [2] ?
I also noted that in 99+ % of the cases, both maps are NULL or have an
identical CLC category, so I wouldn't need the if/else chain at all. I
guess I can use this fact to shortcut the comparison?
Thanks in advance, Hermann
(using GRASS 6.4 on 64-bit Debian Linux)
[1]
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ..
1 NA 12 31 32 33 34 35 36 37 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
2 11 NA 31 32 33 34 35 36 37 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
3 12 12 NA 32 33 34 35 36 37 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
4 12 12 31 NA 33 34 35 36 37 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
5 12 12 31 32 NA 34 35 36 37 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
6 12 12 31 32 33 NA 35 36 37 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
7 12 12 31 32 33 34 NA 36 37 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
8 12 12 31 32 33 34 35 NA 37 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
9 12 12 31 32 33 34 35 36 NA 13 38 56 56 56 56 56 56 56 56 56 56 56 ..
10 11 11 31 32 33 34 35 36 37 NA 38 56 56 56 56 56 56 56 56 56 56 56 ..
11 11 11 31 32 33 34 35 36 37 13 NA 56 56 56 56 56 56 56 56 56 56 56 ..
12 21 22 31 32 33 34 35 36 37 13 38 NA 45 43 42 42 42 41 42 41 83 61 ..
13 21 22 31 32 33 34 35 36 37 13 38 43 NA 43 42 42 42 41 42 41 83 61 ..
14 21 22 31 32 33 34 35 36 37 13 38 43 43 NA 42 42 42 41 42 41 83 61 ..
15 21 22 31 32 33 34 35 36 37 13 38 45 45 45 NA 44 44 41 45 45 83 61 ..
16 21 22 31 32 33 34 35 36 37 13 38 45 45 45 44 NA 44 41 45 45 83 61 ..
17 21 22 31 32 33 34 35 36 37 13 38 45 45 45 44 44 NA 41 45 45 83 61 ..
18 21 22 31 32 33 34 35 36 37 13 38 45 45 45 42 42 42 NA 45 45 83 61 ..
19 21 22 31 32 33 34 35 36 37 13 38 45 45 45 42 42 42 41 NA 41 83 61 ..
20 21 22 31 32 33 34 35 36 37 13 38 45 45 45 42 42 42 41 45 NA 83 61 ..
21 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 41 52 54 NA 54 ..
22 21 22 31 32 33 34 35 36 37 13 38 45 45 45 42 42 42 41 45 45 83 NA ..
23 21 22 31 32 33 34 35 36 37 13 38 51 51 51 51 51 51 53 51 53 53 53 ..
24 21 22 31 32 33 34 35 36 37 13 38 51 51 51 51 51 51 53 51 53 53 53 ..
25 21 22 31 32 33 34 35 36 37 13 38 51 51 51 51 51 51 53 51 53 53 53 ..
26 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 54 52 54 54 54 ..
27 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 54 52 54 54 54 ..
28 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 54 52 54 54 54 ..
29 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 54 52 54 54 54 ..
30 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 54 52 54 54 53 ..
31 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 54 52 54 54 53 ..
32 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 54 52 54 54 53 ..
33 21 22 31 32 33 34 35 36 37 13 38 52 52 52 52 52 52 54 52 54 54 53 ..
34 NA NA NA NA NA NA NA NA NA NA 38 NA NA NA NA NA NA NA NA NA NA NA ..
35 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
36 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
37 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
38 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
39 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
40 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
41 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
42 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
43 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
44 21 22 31 32 33 34 35 36 37 13 38 55 55 55 55 55 55 55 55 55 55 55 ..
[2]
change = \
clc2000 == 1 && clc2006 == 2 ? 12 : \
clc2000 == 1 && clc2006 == 3 ? 31 : \
clc2000 == 1 && clc2006 == 4 ? 32 : \
clc2000 == 1 && clc2006 == 5 ? 33 : \
clc2000 == 1 && clc2006 == 6 ? 34 : \
clc2000 == 1 && clc2006 == 7 ? 35 : \
clc2000 == 1 && clc2006 == 8 ? 36 : \
clc2000 == 1 && clc2006 == 9 ? 37 : \
clc2000 == 1 && clc2006 == 10 ? 13 : \
... (snip away some 1700 if/else rules)
clc2000 == 44 && clc2006 == 30 ? 89 : \
clc2000 == 44 && clc2006 == 31 ? 89 : \
clc2000 == 44 && clc2006 == 32 ? 89 : \
clc2000 == 44 && clc2006 == 35 ? 82 : \
clc2000 == 44 && clc2006 == 36 ? 82 : \
clc2000 == 44 && clc2006 == 37 ? 82 : \
clc2000 == 44 && clc2006 == 38 ? 89 : \
clc2000 == 44 && clc2006 == 39 ? 89 : \
clc2000 == 44 && clc2006 == 42 ? 82 : \
clc2000 == 44 && clc2006 == 43 ? 82 : 0
More information about the grass-user
mailing list