~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to raster3d/r3.cross.rast/test.r3.cross.rast.sh

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This script tests the r3.cross.rast to compute
 
2
# cross section raster maps based on a raster3d and elevation map
 
3
 
 
4
# We need to set a specific region in the
 
5
# @preprocess step of this test. We generate
 
6
# raster and voxel data with r.mapcalc and r3.mapcalc
 
7
# The region setting should work for UTM and LL test locations
 
8
g.region s=0 n=80 w=0 e=100 b=0 t=50 res=10 res3=10 -p3
 
9
# We create several evlevation maps to create slices of the voxel map
 
10
# We start from bottom and raise to the top
 
11
r.mapcalc --o expr="elev_0 = 0"
 
12
r.mapcalc --o expr="elev_1 = 5"
 
13
r.mapcalc --o expr="elev_2 = 15"
 
14
r.mapcalc --o expr="elev_3 = 25"
 
15
r.mapcalc --o expr="elev_4 = 35"
 
16
r.mapcalc --o expr="elev_5 = 45"
 
17
r.mapcalc --o expr="elev_NAN = 50"
 
18
r.mapcalc --o expr="elev_cross = float(col()* 5)"
 
19
# Now create a voxel map with value = col + row + depth. 
 
20
r3.mapcalc --o expr="volume = col() + row() + depth()"
 
21
# Add null value information
 
22
r3.mapcalc --o expr="volume_null = if(row() == 1 || row() == 5, null(), volume)"
 
23
 
 
24
# We @test the creation of slices and a cross section of the voxel map. Reference data
 
25
# for @raster map validation is located in the r3.cross.rast source directory.
 
26
# Slice 0 and 1 should be identical. The last slice should be NAN.
 
27
r3.cross.rast --o input=volume_null elevation=elev_0 output=test_cross_section_slice_0
 
28
r3.cross.rast --o input=volume_null elevation=elev_1 output=test_cross_section_slice_1
 
29
r3.cross.rast --o input=volume_null elevation=elev_2 output=test_cross_section_slice_2
 
30
r3.cross.rast --o input=volume_null elevation=elev_3 output=test_cross_section_slice_3
 
31
r3.cross.rast --o input=volume_null elevation=elev_4 output=test_cross_section_slice_4
 
32
r3.cross.rast --o input=volume_null elevation=elev_5 output=test_cross_section_slice_5
 
33
r3.cross.rast --o input=volume_null elevation=elev_NAN output=test_cross_section_slice_NAN
 
34
r3.cross.rast --o input=volume_null elevation=elev_cross output=test_cross_section_result
 
35
 
 
36
# Export of the text files
 
37
for i in `g.list type=raster pattern=test_cross_section_*` ; do 
 
38
    r.out.ascii input=$i output=${i}.txt; 
 
39
done
 
40
 
 
41
# Comparison of references and text files
 
42
for i in `ls *.ref` ; do 
 
43
    diff $i "`basename $i .ref`.txt" ; 
 
44
done
 
45
rm *.txt