test.t.rename.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. # Tests the rename 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. # We need to create three space time dataset
  10. t.create --v --o type=strds temporaltype=absolute output=precip_abs1 \
  11. title="Test" descr="This is the 1 test strds" semantictype=sum
  12. t.register -i --o input=precip_abs1 maps=prec_1,prec_2 \
  13. start="2001-01-01" increment="1 seconds"
  14. t.create --v --o type=strds temporaltype=absolute output=precip_abs2 \
  15. title="Test" descr="This is the 2 test strds" semantictype=sum
  16. t.register --o input=precip_abs2 maps=prec_1,prec_2
  17. t.create --v --o type=strds temporaltype=absolute output=precip_abs3 \
  18. title="Test" descr="This is the 3 test strds" semantictype=sum
  19. t.register --o input=precip_abs3 maps=prec_1,prec_2
  20. t.info precip_abs1
  21. t.info precip_abs2
  22. t.info precip_abs3
  23. # @test Rename the space time raster dataset by overwritung an old one
  24. t.rename --o type=strds input=precip_abs1 output=precip_abs2
  25. t.info precip_abs2
  26. t.info type=rast input=prec_1
  27. t.info type=rast input=prec_2
  28. t.rename --o type=strds input=precip_abs2 output=precip_abs4
  29. t.info precip_abs4
  30. t.info type=rast input=prec_1
  31. t.info type=rast input=prec_2
  32. # Error checking, new dataset has the wrong mapset
  33. t.rename type=strds input=precip_abs4 output=precip_abs3@BLABLA
  34. # Error checking, no overwrite flag set
  35. t.rename type=strds input=precip_abs4 output=precip_abs3
  36. t.remove --v type=strds input=precip_abs3,precip_abs4
  37. t.unregister type=rast maps=prec_1,prec_2
  38. g.remove rast=prec_1,prec_2