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

« back to all changes in this revision

Viewing changes to raster3d/r3.to.rast/test.r3.to.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 conversion of voxel data
 
2
# into raster data slices. Validation data for each test
 
3
# is located in the module source directory
 
4
 
 
5
# We need to set a specific region in the
 
6
# @preprocess step of this test. We generate
 
7
# voxel data with r3.mapcalc. The region setting 
 
8
# should work for UTM and LL test locations
 
9
g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 
10
# Now create a voxel map with value = col + row + depth. 
 
11
r3.mapcalc --o expr="volume = double(col() + row() + depth())"
 
12
# Add null value information
 
13
r3.mapcalc --o expr="volume_null = if(row() == 1 || row() == 5, null(), volume)"
 
14
# Create floating point map
 
15
r3.mapcalc --o expr="volume_null_float = float(volume_null)"
 
16
 
 
17
 
 
18
# First we @test with identical region settings for raster and voxel data
 
19
# Reference data for all generated @raster maps are located in the r3.to.rast source directory.
 
20
r3.to.rast --o input=volume_null output=test_raster_slice_1
 
21
r3.to.rast --o input=volume_null_float output=test_raster_slice_float
 
22
 
 
23
# Export of the references
 
24
for i in `g.list type=raster pattern=test_raster_slice_1*` ; do r.out.ascii input=$i output=${i}.txt; done
 
25
for i in `g.list type=raster pattern=test_raster_slice_float*` ; do r.out.ascii input=$i output=${i}.txt; done
 
26
 
 
27
# The next @preprocess step adjusts the raster region to increase the resolution by 2
 
28
g.region res=7.5 -p3
 
29
 
 
30
# This @test should show the via nearest neighbour resampled data.  
 
31
# Reference data for all generated @raster maps are located in the r3.to.rast source directory.
 
32
r3.to.rast --o input=volume_null output=test_raster_slice_2
 
33
 
 
34
# Export of the references
 
35
for i in `g.list type=raster pattern=test_raster_slice_2*` ; do r.out.ascii input=$i output=${i}.txt; done
 
36
 
 
37
# The next @preprocess step adjusts the raster region to increase the resolution by 2 again
 
38
g.region res=5 -p3
 
39
 
 
40
# This @test should show the via nearest neighbour resampled data.  
 
41
# Reference data for all generated @raster maps are located in the r3.to.rast source directory.
 
42
r3.to.rast --o input=volume_null output=test_raster_slice_3
 
43
 
 
44
# Export of the references
 
45
for i in `g.list type=raster pattern=test_raster_slice_3*` ; do r.out.ascii input=$i output=${i}.txt; done
 
46
 
 
47
# Comparison of references and text files
 
48
for i in `ls *.ref` ; do 
 
49
    diff $i "`basename $i .ref`.txt" ; 
 
50
done
 
51
rm *.txt