test.t.vect.extract.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # Test the extraction of a subset of a space time vector input
  3. # We need to set a specific region in the
  4. # @preprocess step of this test.
  5. v.random --o -z output=soil_1 n=100 zmin=0 zmax=100 column=height seed=1
  6. v.random --o -z output=soil_2 n=100 zmin=0 zmax=100 column=height seed=2
  7. v.random --o -z output=soil_3 n=100 zmin=0 zmax=100 column=height seed=3
  8. v.random --o -z output=soil_4 n=100 zmin=0 zmax=100 column=height seed=4
  9. v.random --o -z output=soil_5 n=100 zmin=0 zmax=100 column=height seed=5
  10. v.random --o -z output=soil_6 n=100 zmin=0 zmax=100 column=height seed=6
  11. v.random --o -z output=soil_7 n=100 zmin=0 zmax=100 column=height seed=7
  12. v.random --o -z output=soil_8 n=100 zmin=0 zmax=100 column=height seed=8
  13. n1=`g.tempfile pid=1 -d`
  14. cat > "${n1}" << EOF
  15. soil_1
  16. soil_2
  17. soil_3
  18. soil_4
  19. soil_5
  20. soil_6
  21. soil_7
  22. soil_8
  23. EOF
  24. t.create --o type=stvds temporaltype=absolute output=soil_abs1 title="A test" descr="A test"
  25. t.register -i type=vect input=soil_abs1 file="${n1}" start='2001-01-01' increment="1 months"
  26. t.info type=stvds input=soil_abs1
  27. t.vect.list input=soil_abs1
  28. # The @test
  29. t.vect.extract --v input=soil_abs1 output=soil_abs2 where="start_time > '2001-03-01 00:00:01'"
  30. t.info type=stvds input=soil_abs2
  31. t.vect.list input=soil_abs2
  32. t.vect.extract --v --o input=soil_abs1 output=soil_abs3 where="start_time >= '2001-01-01'" \
  33. base=new_vect expr=" height > 50" nprocs=1
  34. t.info type=stvds input=soil_abs3
  35. t.vect.list input=soil_abs3 columns=name,start_time,end_time,primitives
  36. # @postprocess
  37. t.unregister type=vect maps=soil_1,soil_2,soil_3,soil_4,soil_5,soil_6,soil_7,soil_8
  38. t.remove type=stvds input=soil_abs1,soil_abs2,soil_abs3
  39. g.remove vect=soil_1,soil_2,soil_3,soil_4,soil_5,soil_6,soil_7,soil_8
  40. g.remove vect=new_vect_1,new_vect_2,new_vect_3,new_vect_4,new_vect_5,new_vect_6