1
# This script tests r.colors and r.colors.out
2
# Color rules are set with r.colors and exported using r.colors.out
4
# We specific a small region in the
5
# @preprocess step and generate
6
# raster data with r.mapcalc
7
# The region setting should work for UTM and LL test locations
8
g.region s=0 n=90 w=0 e=100 b=0 t=50 res=10 res3=10 -p3
9
# To test r.colors, we need several maps of different types
10
r.mapcalc --o expr="test_elev_double_1 = double(rand(-15.0, 5.0))"
11
r.mapcalc --o expr="test_elev_double_2 = double(rand(0.0, 10.0))"
12
r.mapcalc --o expr="test_elev_double_3 = double(rand(5.0, 15.0))"
14
r.mapcalc --o expr="test_elev_int_1 = int(rand(-15.0, 5.0))"
15
r.mapcalc --o expr="test_elev_int_2 = int(rand(0.0, 10.0))"
16
r.mapcalc --o expr="test_elev_int_3 = int(rand(5.0, 15.0))"
19
# First we @test the integer maps
20
# We use the examples to test the import, export and setting of color tables with different options
21
# the validation is based on raster map color rules @files.txterence files created with r.colors.out
22
r.colors map=test_elev_int_1,test_elev_int_2,test_elev_int_3 \
23
color=difference && r.colors.out --o map=test_elev_int_3 \
24
rules=test_elev_int_maps_difference_1.txt
26
r.colors -e map=test_elev_int_1,test_elev_int_2,test_elev_int_3 \
27
color=difference && r.colors.out --o map=test_elev_int_3 \
28
rules=test_elev_int_maps_difference_hist.txt
30
r.colors -n map=test_elev_int_1,test_elev_int_2,test_elev_int_3 \
31
color=difference && r.colors.out --o map=test_elev_int_3 \
32
rules=test_elev_int_maps_difference_invert.txt
34
r.colors -a map=test_elev_int_1,test_elev_int_2,test_elev_int_3 \
35
color=difference && r.colors.out --o map=test_elev_int_3 \
36
rules=test_elev_int_maps_difference_logabsscale.txt
38
r.colors -g map=test_elev_int_2,test_elev_int_3 \
39
color=difference && r.colors.out --o map=test_elev_int_3 \
40
rules=test_elev_int_maps_difference_logscale.txt
42
r.colors map=test_elev_int_1,test_elev_int_2,test_elev_int_3 \
43
color=random && r.colors.out --o map=test_elev_int_3 \
44
rules=test_elev_int_maps_random.txt
46
r.colors map=test_elev_int_1,test_elev_int_2,test_elev_int_3 \
47
color=grey.eq && r.colors.out --o map=test_elev_int_3 \
48
rules=test_elev_int_maps_grey_eq.txt
50
r.colors map=test_elev_int_2,test_elev_int_3 \
51
color=grey.log && r.colors.out --o map=test_elev_int_3 \
52
rules=test_elev_int_maps_grey_log.txt
54
# Tests with floating point maps
55
r.colors map=test_elev_double_1,test_elev_double_2,test_elev_double_3 \
56
color=difference && r.colors.out --o map=test_elev_double_3 \
57
rules=test_elev_double_maps_difference_1.txt
59
r.colors -e map=test_elev_double_1,test_elev_double_2,test_elev_double_3 \
60
color=difference && r.colors.out --o map=test_elev_double_3 \
61
rules=test_elev_double_maps_difference_hist.txt
63
r.colors -n map=test_elev_double_1,test_elev_double_2,test_elev_double_3 \
64
color=difference && r.colors.out --o map=test_elev_double_3 \
65
rules=test_elev_double_maps_difference_invert.txt
67
r.colors -a map=test_elev_double_1,test_elev_double_2,test_elev_double_3 \
68
color=difference && r.colors.out --o map=test_elev_double_3 \
69
rules=test_elev_double_maps_difference_logabsscale.txt
71
r.colors -g map=test_elev_double_2,test_elev_double_3 \
72
color=difference && r.colors.out --o map=test_elev_double_3 \
73
rules=test_elev_double_maps_difference_logscale.txt