test.t.support.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/sh
  2. # Tests the support module of space time datasets
  3. # We need to set a specific region in the
  4. # @preprocess step of this test.
  5. # The region setting 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. r.mapcalc --o expr="prec_1 = rand(0, 550)"
  8. r.mapcalc --o expr="prec_2 = rand(0, 450)"
  9. r.mapcalc --o expr="prec_3 = rand(0, 320)"
  10. r.mapcalc --o expr="prec_4 = rand(0, 510)"
  11. r.mapcalc --o expr="prec_5 = rand(0, 300)"
  12. r.mapcalc --o expr="prec_6 = rand(0, 650)"
  13. # We create several space time raster datasets
  14. # @test Register the maps in two space time datasets
  15. t.create --v --o type=strds temporaltype=absolute output=precip_abs1 title="Test" descr="This is the 1 test strds" semantictype=sum
  16. t.register -i --o input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="1 seconds"
  17. t.create --v --o type=strds temporaltype=absolute output=precip_abs2 title="Test" descr="This is the 2 test strds" semantictype=sum
  18. t.register -i --o input=precip_abs2 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
  19. t.create --v --o type=strds temporaltype=relative output=precip_rel1 title="Test" descr="This is the 1 test strds" semantictype=min
  20. # Check metadata update
  21. t.info type=strds input=precip_rel1
  22. t.support --v type=strds input=precip_rel1 title="Test support" descr="This is the support test strds" semantictype=max
  23. t.info type=strds input=precip_rel1
  24. # Check metadata update
  25. t.info type=strds input=precip_abs1
  26. t.support --v type=strds input=precip_abs1 title="Test support" descr="This is the support test strds" semantictype=mean
  27. t.info type=strds input=precip_abs1
  28. # @test the map update function
  29. g.region s=0 n=80 w=0 e=120 b=0 t=50 res=20 res3=20
  30. r.mapcalc --o expr="prec_1 = rand(0, 55)"
  31. r.mapcalc --o expr="prec_2 = rand(0, 45)"
  32. r.mapcalc --o expr="prec_3 = rand(0, 32)"
  33. r.mapcalc --o expr="prec_4 = rand(0, 51)"
  34. r.mapcalc --o expr="prec_5 = rand(0, 30)"
  35. r.mapcalc --o expr="prec_6 = rand(0, 65)"
  36. # The map dependent metadata should have been updated
  37. t.support --v -m type=strds input=precip_abs1
  38. t.info type=strds input=precip_abs1
  39. t.support --v -m type=strds input=precip_abs2
  40. t.info type=strds input=precip_abs2
  41. # Remove three maps
  42. g.remove rast=prec_1,prec_2,prec_3
  43. # Booth space time datasets should be updated and 3 maps must have been unregistered
  44. t.support --v -m type=strds input=precip_abs1
  45. t.info type=strds input=precip_abs1
  46. t.info type=strds input=precip_abs2
  47. t.remove --v type=strds input=precip_abs1,precip_rel1
  48. t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
  49. g.remove rast=prec_4,prec_5,prec_6