2
# Tests the support module of space time datasets
4
# We need to set a specific region in the
5
# @preprocess step of this test.
6
# The region setting should work for UTM and LL test locations
7
g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
10
r.mapcalc --o expr="prec_1 = rand(0, 550)" -s
11
r.mapcalc --o expr="prec_2 = rand(0, 450)" -s
12
r.mapcalc --o expr="prec_3 = rand(0, 320)" -s
13
r.mapcalc --o expr="prec_4 = rand(0, 510)" -s
14
r.mapcalc --o expr="prec_5 = rand(0, 300)" -s
15
r.mapcalc --o expr="prec_6 = rand(0, 650)" -s
16
# We create several space time raster datasets
18
# @test Register the maps in two space time datasets
19
t.create --v --o type=strds temporaltype=absolute output=precip_abs1 title="Test" descr="This is the 1 test strds" semantictype=sum
20
t.register -i --o input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="1 seconds"
22
t.create --v --o type=strds temporaltype=absolute output=precip_abs2 title="Test" descr="This is the 2 test strds" semantictype=sum
23
t.register -i --o input=precip_abs2 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
25
t.create --v --o type=strds temporaltype=relative output=precip_rel1 title="Test" descr="This is the 1 test strds" semantictype=min
27
# Check metadata update
28
t.info type=strds input=precip_rel1
29
t.support --v type=strds input=precip_rel1 title="Test support" descr="This is the support test strds" semantictype=max
30
t.info type=strds input=precip_rel1
33
# Check metadata update
34
t.info type=strds input=precip_abs1
35
t.support --v type=strds input=precip_abs1 title="Test support" descr="This is the support test strds" semantictype=mean
36
t.info type=strds input=precip_abs1
39
# @test the map update function
40
g.region s=0 n=80 w=0 e=120 b=0 t=50 res=20 res3=20
43
r.mapcalc --o expr="prec_1 = rand(0, 55)" -s
44
r.mapcalc --o expr="prec_2 = rand(0, 45)" -s
45
r.mapcalc --o expr="prec_3 = rand(0, 32)" -s
46
r.mapcalc --o expr="prec_4 = rand(0, 51)" -s
47
r.mapcalc --o expr="prec_5 = rand(0, 30)" -s
48
r.mapcalc --o expr="prec_6 = rand(0, 65)" -s
50
# The map dependent metadata should have been updated
51
t.support --v -m type=strds input=precip_abs1
52
t.info type=strds input=precip_abs1
53
t.support --v -m type=strds input=precip_abs2
54
t.info type=strds input=precip_abs2
57
g.remove -f type=raster name=prec_1,prec_2,prec_3
59
# Booth space time datasets should be updated and 3 maps must have been unregistered
60
t.support --v -m type=strds input=precip_abs1
61
t.info type=strds input=precip_abs1
62
t.info type=strds input=precip_abs2
64
t.remove --v type=strds input=precip_abs1,precip_rel1
65
t.unregister type=raster maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
66
g.remove -f type=raster name=prec_4,prec_5,prec_6