[GRASS-SVN] r52447 - grass/trunk/temporal/t.vect.what.strds
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 25 02:03:59 PDT 2012
Author: huhabla
Date: 2012-07-25 02:03:59 -0700 (Wed, 25 Jul 2012)
New Revision: 52447
Added:
grass/trunk/temporal/t.vect.what.strds/test.t.vect.what.strds_relative.sh
Modified:
grass/trunk/temporal/t.vect.what.strds/t.vect.what.strds.py
Log:
Fixed bug reported by Peter L?\195?\182we and added a test.
Modified: grass/trunk/temporal/t.vect.what.strds/t.vect.what.strds.py
===================================================================
--- grass/trunk/temporal/t.vect.what.strds/t.vect.what.strds.py 2012-07-25 08:45:51 UTC (rev 52446)
+++ grass/trunk/temporal/t.vect.what.strds/t.vect.what.strds.py 2012-07-25 09:03:59 UTC (rev 52447)
@@ -115,11 +115,11 @@
dbif.close()
grass.fatal(_("Input and aggregation dataset must have the same temporal type"))
- # Check if intervals are present
+ # Check if intervals are present in the sample dataset
if sp.get_temporal_type() == "absolute":
- map_time = strds_sp.absolute_time.get_map_time()
+ map_time = sp.absolute_time.get_map_time()
else:
- map_time = strds_sp.relative_time.get_map_time()
+ map_time = sp.relative_time.get_map_time()
if map_time != "interval":
dbif.close()
Added: grass/trunk/temporal/t.vect.what.strds/test.t.vect.what.strds_relative.sh
===================================================================
--- grass/trunk/temporal/t.vect.what.strds/test.t.vect.what.strds_relative.sh (rev 0)
+++ grass/trunk/temporal/t.vect.what.strds/test.t.vect.what.strds_relative.sh 2012-07-25 09:03:59 UTC (rev 52447)
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Test the temporal and spatial sampling of raster maps by vector point maps
+# We need to set a specific region in the
+# @preprocess step of this test.
+# The region setting should work for UTM and LL test locations
+g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
+
+r.mapcalc --o expr="prec_1 = 100.0"
+r.mapcalc --o expr="prec_2 = 200.0"
+r.mapcalc --o expr="prec_3 = 300"
+r.mapcalc --o expr="prec_4 = 400"
+r.mapcalc --o expr="prec_5 = 500.0"
+r.mapcalc --o expr="prec_6 = 600.0"
+
+v.random --o -z output=soil_1 n=5 zmin=0 zmax=100 column=heigh seed=1
+v.random --o -z output=soil_2 n=5 zmin=0 zmax=100 column=height seed=2
+v.random --o -z output=soil_3 n=5 zmin=0 zmax=100 column=height seed=3
+
+n1=`g.tempfile pid=1 -d`
+
+cat > "${n1}" << EOF
+soil_1|0|10
+soil_2|12|17
+soil_3|20|30
+EOF
+
+t.create --o type=stvds temporaltype=relative output=soil_rel1 title="A test" descr="A test"
+t.register type=vect input=soil_rel1 file="${n1}" unit=minutes
+t.info type=stvds input=soil_rel1
+
+t.create --o type=strds temporaltype=relative output=precip_rel1 title="A test" descr="A test"
+t.register type=rast input=precip_rel1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start=0 increment=5 unit=minutes
+
+# The @test
+
+t.vect.what.strds --v input=soil_rel1 strds=precip_rel1 sampling=start,during column=map_vals method=maximum
+v.db.select map=soil_1
+v.db.select map=soil_2
+v.db.select map=soil_3
+
+t.vect.what.strds --v input=soil_rel1 strds=precip_rel1 sampling=during column=map_vals method=average
+v.db.select map=soil_1
+v.db.select map=soil_2
+v.db.select map=soil_3
+
+t.vect.what.strds --v input=soil_rel1 strds=precip_rel1 sampling=start,during
+v.db.select map=soil_1
+v.db.select map=soil_2
+v.db.select map=soil_3
+
+# @postprocess
+t.unregister type=vect maps=soil_1,soil_2,soil_3
+t.remove type=stvds input=soil_rel1
+
+t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.remove type=strds input=precip_rel1
+
+g.remove rast=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+g.remove vect=soil_1,soil_2,soil_3
Property changes on: grass/trunk/temporal/t.vect.what.strds/test.t.vect.what.strds_relative.sh
___________________________________________________________________
Added: svn:executable
+ *
More information about the grass-commit
mailing list