test.t.rename.sh 1.8 KB

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