[GRASS-SVN] r50814 - in grass/trunk/temporal: t.info tr.aggregate tr.aggregate.ds tr.extract tr.import tr3.extract tr3.list

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 14 17:40:07 EST 2012


Author: huhabla
Date: 2012-02-14 14:40:07 -0800 (Tue, 14 Feb 2012)
New Revision: 50814

Modified:
   grass/trunk/temporal/t.info/test.t.info.sh
   grass/trunk/temporal/tr.aggregate.ds/test.tr.aggregate.ds.sh
   grass/trunk/temporal/tr.aggregate/test.tr.aggregate.relative_time.sh
   grass/trunk/temporal/tr.aggregate/test.tr.aggregate.sh
   grass/trunk/temporal/tr.extract/test.tr.extract.sh
   grass/trunk/temporal/tr.import/test.tr.import.sh
   grass/trunk/temporal/tr.import/tr.import.py
   grass/trunk/temporal/tr3.extract/test.tr3.extract.sh
   grass/trunk/temporal/tr3.list/test.tr3.list.sh
Log:
Updated all tests to use t.register and t.unregister.
Added color rules support in tr.import.


Modified: grass/trunk/temporal/t.info/test.t.info.sh
===================================================================
--- grass/trunk/temporal/t.info/test.t.info.sh	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/t.info/test.t.info.sh	2012-02-14 22:40:07 UTC (rev 50814)
@@ -24,11 +24,11 @@
 t.create --o type=stvds temporaltype=absolute output=lidar_abs_ds1 title="A test" descr="A test"
 t.create --o type=stvds temporaltype=absolute output=lidar_abs_ds2 title="A test" descr="A test"
 
-tr.register -i input=precip_abs1 maps=prec_1,prec_2 start="2001-01-01" increment="20 years"
+t.register type=rast -i input=precip_abs1 maps=prec_1,prec_2 start="2001-01-01" increment="20 years"
 t.info type=strds input=precip_abs1
 t.info -g type=strds input=precip_abs1
 
-tr.register -i input=precip_abs2 maps=prec_1,prec_2 start="2001-01-01" increment="20 years"
+t.register type=rast -i input=precip_abs2 maps=prec_1,prec_2 start="2001-01-01" increment="20 years"
 t.info type=strds input=precip_abs2
 t.info -g type=strds input=precip_abs2
 t.info type=rast input=prec_1
@@ -37,11 +37,11 @@
 t.info -g type=rast input=prec_2
 
 
-tr3.register -i input=precip_abs1 maps=prec_1,prec_2 start="2001-01-01" increment="20 years"
+t.register type=rast3d -i input=precip_abs1 maps=prec_1,prec_2 start="2001-01-01" increment="20 years"
 t.info type=str3ds input=precip_abs1
 t.info -g type=str3ds input=precip_abs1
 
-tr3.register -i input=precip_abs2 maps=prec_1,prec_2 start="2001-01-01" increment="20 years"
+t.register type=rast3d -i input=precip_abs2 maps=prec_1,prec_2 start="2001-01-01" increment="20 years"
 t.info type=str3ds input=precip_abs2
 t.info -g type=str3ds input=precip_abs2
 t.info type=rast3 input=prec_1
@@ -49,11 +49,11 @@
 t.info type=rast3 input=prec_2
 t.info -g type=rast3 input=prec_2
 
-tv.register --v -i input=lidar_abs_ds1 maps=lidar_abs_1,lidar_abs_2 start="2001-01-01" increment="20 years"
+t.register type=vect --v -i input=lidar_abs_ds1 maps=lidar_abs_1,lidar_abs_2 start="2001-01-01" increment="20 years"
 t.info type=stvds input=lidar_abs_ds1
 t.info -g type=stvds input=lidar_abs_ds1
 
-tv.register --v -i input=lidar_abs_ds2 maps=lidar_abs_1,lidar_abs_2 start="2001-01-01" increment="20 years"
+t.register type=vect --v -i input=lidar_abs_ds2 maps=lidar_abs_1,lidar_abs_2 start="2001-01-01" increment="20 years"
 t.info type=stvds input=lidar_abs_ds2
 t.info -g type=stvds input=lidar_abs_ds2
 t.info type=vect input=lidar_abs_1
@@ -61,12 +61,12 @@
 t.info type=vect input=lidar_abs_2
 t.info -g type=vect input=lidar_abs_2
 
-t.remove type=vect input=lidar_abs_1,lidar_abs_2
+t.unregister type=vect maps=lidar_abs_1,lidar_abs_2
 t.remove type=stvds input=lidar_abs_ds1,lidar_abs_ds2
 
-t.remove type=rast input=prec_1,prec_2
+t.unregister type=rast maps=prec_1,prec_2
 t.remove type=strds input=precip_abs1,precip_abs2
 
-t.remove type=rast3 input=prec_1,prec_2
+t.unregister type=rast3 maps=prec_1,prec_2
 t.remove type=str3ds input=precip_abs1,precip_abs2
 

Modified: grass/trunk/temporal/tr.aggregate/test.tr.aggregate.relative_time.sh
===================================================================
--- grass/trunk/temporal/tr.aggregate/test.tr.aggregate.relative_time.sh	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/tr.aggregate/test.tr.aggregate.relative_time.sh	2012-02-14 22:40:07 UTC (rev 50814)
@@ -13,7 +13,7 @@
 r.mapcalc --o expr="prec_6 = rand(0, 650)"
 
 t.create --o type=strds temporaltype=relative output=precip_abs1 title="A test" descr="A test"
-tr.register -i input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start=0 unit=days increment=3
+t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start=0 unit=days increment=3
 
 # The first @test
 
@@ -39,5 +39,5 @@
 r.info prec_sum_2
 r.info prec_sum_3
 
-t.remove type=rast input=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 t.remove type=strds input=precip_abs1,precip_abs2

Modified: grass/trunk/temporal/tr.aggregate/test.tr.aggregate.sh
===================================================================
--- grass/trunk/temporal/tr.aggregate/test.tr.aggregate.sh	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/tr.aggregate/test.tr.aggregate.sh	2012-02-14 22:40:07 UTC (rev 50814)
@@ -13,7 +13,7 @@
 r.mapcalc --o expr="prec_6 = rand(0, 650)"
 
 t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
-tr.register -i input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-15 12:05:45" increment="14 days"
+t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-15 12:05:45" increment="14 days"
 
 # The first @test
 
@@ -26,5 +26,5 @@
 tr.aggregate --o --v input=precip_abs1 output=precip_abs2 base=prec_sum granularity="3 months" method=sum sampling=start,during
 t.info type=strds input=precip_abs2
 
-t.remove type=rast input=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 t.remove type=strds input=precip_abs1,precip_abs2

Modified: grass/trunk/temporal/tr.aggregate.ds/test.tr.aggregate.ds.sh
===================================================================
--- grass/trunk/temporal/tr.aggregate.ds/test.tr.aggregate.ds.sh	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/tr.aggregate.ds/test.tr.aggregate.ds.sh	2012-02-14 22:40:07 UTC (rev 50814)
@@ -27,10 +27,10 @@
 EOF
 
 t.create --o type=stvds temporaltype=absolute output=soil_abs1 title="A test" descr="A test"
-tv.register input=soil_abs1 file="${n1}" start=file end=file
+t.register type=vect input=soil_abs1 file="${n1}"
 
 t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
-tr.register -i input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-03-01 00:00:00" increment="1 months"
+t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-03-01 00:00:00" increment="1 months"
 
 # The @test
 
@@ -39,8 +39,8 @@
 tr.list input=precip_abs2 method=deltagap
 
 # @postprocess
-t.remove type=vect input=soil_1,soil_2,soil_3
+t.unregister type=vect maps=soil_1,soil_2,soil_3
 t.remove type=stvds input=soil_abs1
 
-t.remove type=rast input=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 t.remove type=strds input=precip_abs1,precip_abs2

Modified: grass/trunk/temporal/tr.extract/test.tr.extract.sh
===================================================================
--- grass/trunk/temporal/tr.extract/test.tr.extract.sh	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/tr.extract/test.tr.extract.sh	2012-02-14 22:40:07 UTC (rev 50814)
@@ -15,7 +15,7 @@
 r.mapcalc --o expr="prec_6 = rand(0, 650)"
 
 t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
-tr.register -i input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 months"
+t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 months"
 
 # The first @test
 # We create the space time raster inputs and register the raster maps with absolute time interval
@@ -28,5 +28,5 @@
            expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec
 t.info type=strds input=precip_abs3
 
-t.remove type=rast input=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 t.remove type=strds input=precip_abs1,precip_abs2,precip_abs3

Modified: grass/trunk/temporal/tr.import/test.tr.import.sh
===================================================================
--- grass/trunk/temporal/tr.import/test.tr.import.sh	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/tr.import/test.tr.import.sh	2012-02-14 22:40:07 UTC (rev 50814)
@@ -29,7 +29,7 @@
 t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test with input files" descr="A test with input files"
 
 # The first @test
-tr.register -i input=precip_abs1 file="${n1}" start="2001-01-01" increment="1 months"
+t.register -i type=rast input=precip_abs1 file="${n1}" start="2001-01-01" increment="1 months"
 tr.export input=precip_abs1 output=strds_export.tar.bz2 compression=bzip2 workdir=test
 
 tr.import --o input=strds_export.tar.bz2 output=precip_abs1 extrdir=test\
@@ -41,6 +41,6 @@
 tr.import --o input=strds_export.tar.bz2 output=precip_abs1 extrdir=test\
           -l  title="A test" description="Description of a test"
 
-t.remove type=rast input=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 t.remove type=strds input=precip_abs1
 g.remove rast=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6

Modified: grass/trunk/temporal/tr.import/tr.import.py
===================================================================
--- grass/trunk/temporal/tr.import/tr.import.py	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/tr.import/tr.import.py	2012-02-14 22:40:07 UTC (rev 50814)
@@ -80,6 +80,7 @@
 
 import shutil
 import os
+import os.path
 import tarfile
 import tempfile
 import grass.script as grass
@@ -213,6 +214,14 @@
         if ret != 0:
             grass.fatal(_("Unable to import/link raster map <%s>.") % name)
     
+        # Set the color rules if present
+        filename = str(row["name"]) + ".color"
+        if os.path.isfile(filename):
+            ret = grass.run_command("r.colors", map=name, rules=filename, overwrite=grass.overwrite())
+
+            if ret != 0:
+                grass.fatal(_("Unable to set the color rules for raster map <%s>.") % name)
+
     # Create the space time raster dataset
     if sp.is_in_db() and grass.overwrite() == True:
         grass.info(_("Overwrite space time %s dataset <%s> and unregister all maps.") % (sp.get_new_map_instance(None).get_type(), name))
@@ -228,7 +237,7 @@
 
     # register the raster maps
     fs="|"
-    tgis.register_maps_in_space_time_dataset(type="strds", name=output, file=list_file_name, start="file", end="file", dbif=None, fs=fs)
+    tgis.register_maps_in_space_time_dataset(type="rast", name=output, file=list_file_name, start="file", end="file", dbif=None, fs=fs)
 
 if __name__ == "__main__":
     options, flags = grass.parser()

Modified: grass/trunk/temporal/tr3.extract/test.tr3.extract.sh
===================================================================
--- grass/trunk/temporal/tr3.extract/test.tr3.extract.sh	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/tr3.extract/test.tr3.extract.sh	2012-02-14 22:40:07 UTC (rev 50814)
@@ -15,7 +15,7 @@
 r3.mapcalc --o expr="prec_6 = rand(0, 650)"
 
 t.create --o type=str3ds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
-tr3.register -i input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 months"
+t.register -i type=rast3d input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 months"
 
 # The first @test
 # We create the space time raster inputs and register the raster maps with absolute time interval
@@ -24,5 +24,5 @@
 
 t.info type=str3ds input=precip_abs2
 
-t.remove type=rast3d input=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.unregister type=rast3d maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 t.remove type=str3ds input=precip_abs1,precip_abs2

Modified: grass/trunk/temporal/tr3.list/test.tr3.list.sh
===================================================================
--- grass/trunk/temporal/tr3.list/test.tr3.list.sh	2012-02-14 15:01:13 UTC (rev 50813)
+++ grass/trunk/temporal/tr3.list/test.tr3.list.sh	2012-02-14 22:40:07 UTC (rev 50814)
@@ -71,36 +71,36 @@
 t.create --o type=str3ds temporaltype=absolute output=volume_abs5 title="A test with input files" descr="A test with input files"
 
 # The first @test
-tr3.register    input=volume_abs1 file="${n1}" start="2001-01-01" increment="1 months"
+t.register type=rast3d   input=volume_abs1 file="${n1}" start="2001-01-01" increment="1 months"
 tr3.list    fs=" | " method=comma     input=volume_abs1
 tr3.list -h input=volume_abs1
 tr3.list -h fs=" | " method=cols      input=volume_abs1
 tr3.list -h fs=" | " method=delta     input=volume_abs1
 tr3.list -h fs=" | " method=deltagaps input=volume_abs1
 
-tr3.register -i input=volume_abs2 file="${n2}" start=file
+t.register -i type=rast3d input=volume_abs2 file="${n2}"
 tr3.list    fs=" | " method=comma     input=volume_abs2
 tr3.list -h input=volume_abs2
 tr3.list -h fs=" | " method=cols      input=volume_abs2
 tr3.list -h fs=" | " method=delta     input=volume_abs2
 tr3.list -h fs=" | " method=deltagaps input=volume_abs2
 
-tr3.register -i input=volume_abs3 file="${n3}" start=file end=file
+t.register -i type=rast3d input=volume_abs3 file="${n3}"
 tr3.list    fs=" | " method=comma     input=volume_abs3
 tr3.list -h fs=" | " method=delta     input=volume_abs3
 tr3.list -h fs=" | " method=deltagaps input=volume_abs3
 
-tr3.register -i input=volume_abs4 file="${n4}" start=file end=file
+t.register -i type=rast3d input=volume_abs4 file="${n4}"
 tr3.list    fs=" | " method=comma     input=volume_abs4
 tr3.list -h fs=" | " method=delta     input=volume_abs4
 tr3.list -h fs=" | " method=deltagaps input=volume_abs4
 
-tr3.register -i input=volume_abs5 file="${n5}" start=file end=file
+t.register -i type=rast3d input=volume_abs5 file="${n5}"
 tr3.list    fs=" | " method=comma     input=volume_abs5
 tr3.list -h input=volume_abs5
 tr3.list -h fs=" | " method=cols      input=volume_abs5
 tr3.list -h fs=" | " method=delta     input=volume_abs5
 tr3.list -h fs=" | " method=deltagaps input=volume_abs5
 
-t.remove type=rast3d input=vol_1,vol_2,vol_3,vol_4,vol_5,vol_6
+t.unregister type=rast3d maps=vol_1,vol_2,vol_3,vol_4,vol_5,vol_6
 t.remove type=str3ds input=volume_abs1,volume_abs2,volume_abs3,volume_abs4,volume_abs5



More information about the grass-commit mailing list