source: grass/trunk/temporal/t.topology/test.t.topology.reltime.sh

Last change on this file was 63619, checked in by neteler, 10 years ago

update shell scripts to use new element names (#2409)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:mime-type set to text/x-sh
File size: 2.4 KB
Line 
1#!/bin/sh
2# Tests the temporal topology module of space time datasets
3
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
7g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
8
9# Generate data
10r.mapcalc --o expr="prec_1 = rand(0, 550)" -s
11r.mapcalc --o expr="prec_2 = rand(0, 450)" -s
12r.mapcalc --o expr="prec_3 = rand(0, 320)" -s
13r.mapcalc --o expr="prec_4 = rand(0, 510)" -s
14r.mapcalc --o expr="prec_5 = rand(0, 300)" -s
15r.mapcalc --o expr="prec_6 = rand(0, 650)" -s
16
17n1=`g.tempfile pid=1 -d`
18n2=`g.tempfile pid=2 -d`
19n3=`g.tempfile pid=3 -d`
20n4=`g.tempfile pid=4 -d`
21n5=`g.tempfile pid=5 -d`
22
23cat > "${n1}" << EOF
24prec_1
25prec_2
26prec_3
27prec_4
28prec_5
29prec_6
30EOF
31
32cat > "${n2}" << EOF
33prec_1|1
34prec_2|2
35prec_3|3
36prec_4|4
37prec_5|5
38prec_6|6
39EOF
40
41cat > "${n3}" << EOF
42prec_1|1|4
43prec_2|5|7
44prec_3|8|10
45prec_4|11|12
46prec_5|13|14
47prec_6|15|25
48EOF
49
50cat > "${n4}" << EOF
51prec_1|2001|2007
52prec_2|2002|2004
53prec_3|2003|2004
54prec_4|2004|2006
55prec_5|2005|2006
56prec_6|2006|2007
57EOF
58
59cat > "${n5}" << EOF
60prec_1|2001|2003
61prec_2|2002|2004
62prec_3|2003|2006
63prec_4|2004|2004
64prec_5|2005|2005
65prec_6|2006|2007
66EOF
67
68
69# The first @test
70# We create the space time raster inputs and register the raster maps with relolute time interval
71t.create --o type=strds temporaltype=relative output=precip_rel_d title="A test with input files of unti days" descr="A test with input files"
72t.create --o type=strds temporaltype=relative output=precip_rel_y title="A test with input files of unit years" descr="A test with input files"
73
74t.register --o type=raster -i --v input=precip_rel_d file="${n1}" start=0 increment=1 unit=days
75cat "${n1}"
76t.topology input=precip_rel_d
77t.topology -m input=precip_rel_d
78
79t.register --o type=raster -i input=precip_rel_d file="${n2}" unit=days
80cat "${n2}"
81t.topology input=precip_rel_d
82t.topology -m input=precip_rel_d
83
84t.register --o type=raster -i input=precip_rel_d file="${n3}" unit=days
85cat "${n3}"
86t.topology input=precip_rel_d
87t.topology -m input=precip_rel_d
88
89t.register --o type=raster -i input=precip_rel_y file="${n4}" unit=years
90cat "${n4}"
91t.topology input=precip_rel_y
92t.topology -m input=precip_rel_y
93
94t.register --o type=raster -i input=precip_rel_y file="${n5}" unit=years
95cat "${n5}"
96t.topology input=precip_rel_y
97t.topology -m input=precip_rel_y
98
99t.remove type=strds input=precip_rel_d
100t.remove type=strds input=precip_rel_y
101t.unregister type=raster file="${n1}"
Note: See TracBrowser for help on using the repository browser.