test.r3.null.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Tests for r3.null
  2. # We set up a specific region in the
  3. # @preprocess step of this test. We generate
  4. # voxel data with r3.mapcalc. The region setting
  5. # should work for UTM and LL test locations
  6. g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
  7. # We create several (float, double, null value) voxel map
  8. # with value = col + row + depth.
  9. r3.mapcalc --o expr="test_volume_float_1 = float(col() + row() + depth())"
  10. r3.mapcalc --o expr="test_volume_float_2 = test_volume_float_1"
  11. r3.mapcalc --o expr="test_volume_double_1 = double(col() + row() + depth())"
  12. r3.mapcalc --o expr="test_volume_double_2 = test_volume_double_1"
  13. # Add null value information
  14. r3.mapcalc --o expr="test_volume_float_null_1 = if(row() == 1 || row() == 5, null(), test_volume_float_1)"
  15. r3.mapcalc --o expr="test_volume_float_null_2 = if(row() == 1 || row() == 5, null(), test_volume_float_1)"
  16. r3.mapcalc --o expr="test_volume_double_null_1 = if(row() == 1 || row() == 5, null(), test_volume_double_1)"
  17. r3.mapcalc --o expr="test_volume_double_null_2 = if(row() == 1 || row() == 5, null(), test_volume_double_1)"
  18. # We @test r3.null to set and modify null values.
  19. # Validation is based on @files with @precision=3
  20. # First float maps
  21. r3.null map=test_volume_float_1 setnull=3,4,5
  22. r3.null map=test_volume_float_2 setnull=7,8,9
  23. r3.null map=test_volume_float_null_1 null=-1.5
  24. r3.null map=test_volume_float_null_2 null=-10.5
  25. # Double maps
  26. r3.null map=test_volume_double_1 setnull=3,4,5
  27. r3.null map=test_volume_double_2 setnull=7,8,9
  28. r3.null map=test_volume_double_null_1 null=-1.5
  29. r3.null map=test_volume_double_null_2 null=-10.5
  30. # Commands to export the references
  31. r3.out.ascii dp=3 input=test_volume_float_1 output=test_volume_float_1.txt
  32. r3.out.ascii dp=3 input=test_volume_float_2 output=test_volume_float_2.txt
  33. r3.out.ascii dp=3 input=test_volume_float_null_1 output=test_volume_float_null_1.txt
  34. r3.out.ascii dp=3 input=test_volume_float_null_2 output=test_volume_float_null_2.txt
  35. r3.out.ascii dp=3 input=test_volume_double_1 output=test_volume_double_1.txt
  36. r3.out.ascii dp=3 input=test_volume_double_2 output=test_volume_double_2.txt
  37. r3.out.ascii dp=3 input=test_volume_double_null_1 output=test_volume_double_null_1.txt
  38. r3.out.ascii dp=3 input=test_volume_double_null_2 output=test_volume_double_null_2.txt