3
# We set up a specific region in the
4
# @preprocess step of this test. We generate
5
# voxel data with r3.mapcalc. The region setting
6
# 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
8
# We create several (float, double, null value) voxel map
9
# with value = col + row + depth.
10
r3.mapcalc --o expr="volume_float = float(col() + row() + depth())"
11
r3.mapcalc --o expr="volume_double = double(col() + row() + depth())"
12
# Add null value information to test correct null value handling
13
r3.mapcalc --o expr="volume_float_null = if(row() == 1 || row() == 5, null(), volume_float)"
14
r3.mapcalc --o expr="volume_double_null = if(row() == 2 || row() == 6, null(), volume_double)"
16
# @test r3.stats with float maps and @file validation.
17
# The module output on stdout is piped into text files
18
r3.stats input=volume_float_null nsteps=1 > test_volume_float_stats_1.txt
19
r3.stats input=volume_float_null nsteps=2 > test_volume_float_stats_2.txt
20
r3.stats input=volume_float_null nsteps=7 > test_volume_float_stats_7.txt
21
r3.stats input=volume_float_null nsteps=14 > test_volume_float_stats_14.txt
22
r3.stats input=volume_float_null nsteps=21 > test_volume_float_stats_21.txt
23
r3.stats -e input=volume_float_null > test_volume_float_stats_e.txt
25
r3.stats input=volume_double_null nsteps=1 > test_volume_double_stats_1.txt
26
r3.stats input=volume_double_null nsteps=3 > test_volume_double_stats_3.txt
27
r3.stats input=volume_double_null nsteps=9 > test_volume_double_stats_9.txt
28
r3.stats input=volume_double_null nsteps=18 > test_volume_double_stats_18.txt
29
r3.stats input=volume_double_null nsteps=22 > test_volume_double_stats_22.txt
30
r3.stats -e input=volume_double_null > test_volume_double_stats_e.txt
32
# Comparison of references and text files
33
for i in `ls *.ref` ; do
34
diff $i "`basename $i .ref`.txt" ;