test.t.shift.relative.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. # Space time raster dataset temporal shifting with relative time
  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. r.mapcalc --o expr="prec_3 = rand(0, 320)" -s
  11. r.mapcalc --o expr="prec_4 = rand(0, 510)" -s
  12. r.mapcalc --o expr="prec_5 = rand(0, 300)" -s
  13. r.mapcalc --o expr="prec_6 = rand(0, 650)" -s
  14. t.create --o type=strds temporaltype=relative output=precip_rel title="A test" descr="A test"
  15. t.register -i --o type=raster unit=days input=precip_rel maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 \
  16. start=0 increment=1
  17. t.info type=strds input=precip_rel
  18. t.rast.list input=precip_rel
  19. # The first @test
  20. t.shift --o input=precip_rel granularity=3
  21. t.info type=strds input=precip_rel
  22. t.rast.list input=precip_rel
  23. t.shift --o input=precip_rel granularity=10000
  24. t.info type=strds input=precip_rel
  25. t.rast.list input=precip_rel
  26. t.unregister type=raster maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
  27. t.remove type=strds input=precip_rel