[GRASS-SVN] r61985 - in grass/trunk/temporal: t.connect t.connect/testsuite t.info t.list t.vect.list

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 15 15:34:24 PDT 2014


Author: huhabla
Date: 2014-09-15 15:34:24 -0700 (Mon, 15 Sep 2014)
New Revision: 61985

Added:
   grass/trunk/temporal/t.connect/testsuite/
   grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py
   grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py
   grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py
Modified:
   grass/trunk/temporal/t.info/t.info.py
   grass/trunk/temporal/t.list/t.list.py
   grass/trunk/temporal/t.vect.list/t.vect.list.py
Log:
temporal modules: Enabling mapset specific temporal databases in temporal modules, added new tests. This feature is very experimental.

Added: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py
===================================================================
--- grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py	                        (rev 0)
+++ grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py	2014-09-15 22:34:24 UTC (rev 61985)
@@ -0,0 +1,208 @@
+"""Test t.rast.extract
+
+(C) 2014 by the GRASS Development Team
+This program is free software under the GNU General Public
+License (>=v2). Read the file COPYING that comes with GRASS
+for details.
+
+ at author Soeren Gebbert
+"""
+
+import grass.pygrass.modules as pymod
+import subprocess
+from grass.gunittest.case import TestCase
+from grass.gunittest.gmodules import SimpleModule
+import os
+
+
+mapset_count = 0
+class TestRasterExtraction(TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+       os.putenv("GRASS_OVERWRITE", "1")
+       for i in range(1, 5): 
+            cls.runModule("g.mapset", flags="c", mapset="test%i"%i)
+            cls.runModule("g.region",  s=0,  n=80,  w=0,  e=120,  b=0,  t=50,  res=10,  res3=10)
+            # Use always the current mapset as temporal database
+            cls.runModule("r.mapcalc", expression="a1 = 100")
+            cls.runModule("r.mapcalc", expression="a2 = 200")
+            cls.runModule("r.mapcalc", expression="a3 = 300")
+            
+            cls.runModule("t.create",  type="strds",  temporaltype="absolute",  
+                                         output="A",  title="A test",  description="A test")
+            cls.runModule("t.register",  flags="i",  type="rast",  input="A",  
+                                         maps="a1,a2,a3",  
+                                         start="2001-01-01", increment="%i months"%i)
+
+    def test_tlist(self):      
+        self.runModule("g.mapset", mapset="test1")
+        
+        list_string = """A|test1|2001-01-01 00:00:00|2001-04-01 00:00:00|3
+                                A|test2|2001-01-01 00:00:00|2001-07-01 00:00:00|3
+                                A|test3|2001-01-01 00:00:00|2001-10-01 00:00:00|3
+                                A|test4|2001-01-01 00:00:00|2002-01-01 00:00:00|3"""
+                                
+        entries = list_string.split("\n")
+        
+        t_list = SimpleModule("t.list", quiet=True, columns=["name","mapset,start_time","end_time","number_of_maps"],  type="strds")
+        self.assertModule(t_list)
+        
+        out = t_list.outputs["stdout"].value
+        
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        
+    def test_trast_list(self):      
+        self.runModule("g.mapset", mapset="test1")
+
+        list_string = """a1|test1|2001-01-01 00:00:00|2001-02-01 00:00:00
+                                a2|test1|2001-02-01 00:00:00|2001-03-01 00:00:00
+                                a3|test1|2001-03-01 00:00:00|2001-04-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.rast.list", quiet=True, flags="s",  input="A at test1")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|test2|2001-01-01 00:00:00|2001-03-01 00:00:00
+                                a2|test2|2001-03-01 00:00:00|2001-05-01 00:00:00
+                                a3|test2|2001-05-01 00:00:00|2001-07-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.rast.list", quiet=True, flags="s",  input="A at test2")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|test3|2001-01-01 00:00:00|2001-04-01 00:00:00
+                                a2|test3|2001-04-01 00:00:00|2001-07-01 00:00:00
+                                a3|test3|2001-07-01 00:00:00|2001-10-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.rast.list", quiet=True, flags="s",  input="A at test3")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|test4|2001-01-01 00:00:00|2001-05-01 00:00:00
+                                a2|test4|2001-05-01 00:00:00|2001-09-01 00:00:00
+                                a3|test4|2001-09-01 00:00:00|2002-01-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.rast.list", quiet=True, flags="s",  input="A at test4")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+    def test_strds_info(self):  
+        self.runModule("g.mapset", mapset="test4")
+        tinfo_string="""id=A at test1
+                                    name=A
+                                    mapset=test1
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-04-01 00:00:00
+                                    granularity=1 month"""
+
+        info = SimpleModule("t.info", flags="g", input="A at test1")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="test3")
+        tinfo_string="""id=A at test2
+                                    name=A
+                                    mapset=test2
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-07-01 00:00:00
+                                    granularity=2 months"""
+
+        info = SimpleModule("t.info", flags="g", input="A at test2")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="test2")
+        tinfo_string="""id=A at test3
+                                    name=A
+                                    mapset=test3
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-10-01 00:00:00
+                                    granularity=3 months"""
+
+        info = SimpleModule("t.info", flags="g", input="A at test3")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="test1")
+        tinfo_string="""id=A at test4
+                                    name=A
+                                    mapset=test4
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2002-01-01 00:00:00
+                                    granularity=4 months"""
+
+        info = SimpleModule("t.info", flags="g", input="A at test4")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+    def test_raster_info(self):  
+        self.runModule("g.mapset", mapset="test3")
+        tinfo_string="""id=a1 at test1
+                                name=a1
+                                mapset=test1
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-02-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="rast",  input="a1 at test1")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at test2
+                                name=a1
+                                mapset=test2
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-03-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="rast",  input="a1 at test2")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at test3
+                                name=a1
+                                mapset=test3
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-04-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="rast",  input="a1 at test3")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at test4
+                                name=a1
+                                mapset=test4
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-05-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="rast",  input="a1 at test4")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+if __name__ == '__main__':
+    from grass.gunittest.main import test
+    test()

Added: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py
===================================================================
--- grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py	                        (rev 0)
+++ grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py	2014-09-15 22:34:24 UTC (rev 61985)
@@ -0,0 +1,205 @@
+"""test distributed temporal databases with str3ds
+
+(C) 2014 by the GRASS Development Team
+This program is free software under the GNU General Public
+License (>=v2). Read the file COPYING that comes with GRASS
+for details.
+
+ at author Soeren Gebbert
+"""
+
+import grass.pygrass.modules as pymod
+from grass.gunittest.case import TestCase
+from grass.gunittest.gmodules import SimpleModule
+import os
+
+class testRaster3dExtraction(TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+       os.putenv("GRASS_OVERWRITE", "1")
+       for i in range(1, 5): 
+            cls.runModule("g.mapset", flags="c", mapset="test3d%i"%i)
+            cls.runModule("g.region",  s=0,  n=80,  w=0,  e=120,  b=0,  t=50,  res=10,  res3=10)
+            # Use always the current mapset as temporal database
+            cls.runModule("r3.mapcalc", expression="a1 = 100")
+            cls.runModule("r3.mapcalc", expression="a2 = 200")
+            cls.runModule("r3.mapcalc", expression="a3 = 300")
+            
+            cls.runModule("t.create",  type="str3ds",  temporaltype="absolute",  
+                                         output="A",  title="A test3d",  description="A test3d")
+            cls.runModule("t.register",  flags="i",  type="rast3d",  input="A",  
+                                         maps="a1,a2,a3",  
+                                         start="2001-01-01", increment="%i months"%i)
+
+    def test_tlist(self):      
+        self.runModule("g.mapset", mapset="test3d1")
+        
+        list_string = """A|test3d1|2001-01-01 00:00:00|2001-04-01 00:00:00|3
+                                A|test3d2|2001-01-01 00:00:00|2001-07-01 00:00:00|3
+                                A|test3d3|2001-01-01 00:00:00|2001-10-01 00:00:00|3
+                                A|test3d4|2001-01-01 00:00:00|2002-01-01 00:00:00|3"""
+                                
+        entries = list_string.split("\n")
+        
+        t_list = SimpleModule("t.list", quiet=True, columns=["name","mapset,start_time","end_time","number_of_maps"],  type="str3ds")
+        self.assertModule(t_list)
+        
+        out = t_list.outputs["stdout"].value
+        
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        
+    def test_trast_list(self):      
+        self.runModule("g.mapset", mapset="test3d1")
+
+        list_string = """a1|test3d1|2001-01-01 00:00:00|2001-02-01 00:00:00
+                                a2|test3d1|2001-02-01 00:00:00|2001-03-01 00:00:00
+                                a3|test3d1|2001-03-01 00:00:00|2001-04-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.rast3d.list", quiet=True, flags="s",  input="A at test3d1")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|test3d2|2001-01-01 00:00:00|2001-03-01 00:00:00
+                                a2|test3d2|2001-03-01 00:00:00|2001-05-01 00:00:00
+                                a3|test3d2|2001-05-01 00:00:00|2001-07-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.rast3d.list", quiet=True, flags="s",  input="A at test3d2")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|test3d3|2001-01-01 00:00:00|2001-04-01 00:00:00
+                                a2|test3d3|2001-04-01 00:00:00|2001-07-01 00:00:00
+                                a3|test3d3|2001-07-01 00:00:00|2001-10-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.rast3d.list", quiet=True, flags="s",  input="A at test3d3")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|test3d4|2001-01-01 00:00:00|2001-05-01 00:00:00
+                                a2|test3d4|2001-05-01 00:00:00|2001-09-01 00:00:00
+                                a3|test3d4|2001-09-01 00:00:00|2002-01-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.rast3d.list", quiet=True, flags="s",  input="A at test3d4")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+    def test_strds_info(self):  
+        self.runModule("g.mapset", mapset="test3d4")
+        tinfo_string="""id=A at test3d1
+                                    name=A
+                                    mapset=test3d1
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-04-01 00:00:00
+                                    granularity=1 month"""
+
+        info = SimpleModule("t.info", flags="g", type="str3ds",  input="A at test3d1")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="test3d3")
+        tinfo_string="""id=A at test3d2
+                                    name=A
+                                    mapset=test3d2
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-07-01 00:00:00
+                                    granularity=2 months"""
+
+        info = SimpleModule("t.info", flags="g", type="str3ds", input="A at test3d2")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="test3d2")
+        tinfo_string="""id=A at test3d3
+                                    name=A
+                                    mapset=test3d3
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-10-01 00:00:00
+                                    granularity=3 months"""
+
+        info = SimpleModule("t.info", flags="g", type="str3ds", input="A at test3d3")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="test3d1")
+        tinfo_string="""id=A at test3d4
+                                    name=A
+                                    mapset=test3d4
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2002-01-01 00:00:00
+                                    granularity=4 months"""
+
+        info = SimpleModule("t.info", flags="g", type="str3ds", input="A at test3d4")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+    def test_raster_info(self):  
+        self.runModule("g.mapset", mapset="test3d3")
+        tinfo_string="""id=a1 at test3d1
+                                name=a1
+                                mapset=test3d1
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-02-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="rast3d",  input="a1 at test3d1")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at test3d2
+                                name=a1
+                                mapset=test3d2
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-03-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="rast3d",  input="a1 at test3d2")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at test3d3
+                                name=a1
+                                mapset=test3d3
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-04-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="rast3d",  input="a1 at test3d3")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at test3d4
+                                name=a1
+                                mapset=test3d4
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-05-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="rast3d",  input="a1 at test3d4")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+if __name__ == '__main__':
+    from grass.gunittest.main import test
+    test()

Added: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py
===================================================================
--- grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py	                        (rev 0)
+++ grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py	2014-09-15 22:34:24 UTC (rev 61985)
@@ -0,0 +1,215 @@
+"""test distributed temporal databases with stvds
+(C) 2014 by the GRASS Development Team
+This program is free software under the GNU General Public
+License (>=v2). Read the file COPYING that comes with GRASS
+for details.
+
+ at author Soeren Gebbert
+"""
+
+import grass.pygrass.modules as pymod
+import subprocess
+from grass.gunittest.case import TestCase
+from grass.gunittest.gmodules import SimpleModule
+import os
+
+
+mapset_count = 0
+class TestRasterExtraction(TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+       os.putenv("GRASS_OVERWRITE", "1")
+       for i in range(1, 5): 
+            cls.runModule("g.mapset", flags="c", mapset="testvect%i"%i)
+            cls.runModule("g.region",  s=0,  n=80,  w=0,  e=120,  b=0,  t=50,  res=10,  res3=10)
+            # Use always the current mapset as temporal database
+            cls.runModule("v.random", output="a1",  n=20)
+            cls.runModule("v.random", output="a2",  n=20)
+            cls.runModule("v.random", output="a3",  n=20)
+            
+            cls.runModule("t.create",  type="stvds",  temporaltype="absolute",  
+                                         output="A",  title="A testvect",  description="A testvect")
+            cls.runModule("t.register",  flags="i",  type="vect",  input="A",  
+                                         maps="a1,a2,a3",  
+                                         start="2001-01-01", increment="%i months"%i)
+
+    def test_tlist(self):      
+        self.runModule("g.mapset", mapset="testvect1")
+        
+        list_string = """A|testvect1|2001-01-01 00:00:00|2001-04-01 00:00:00|3
+                                A|testvect2|2001-01-01 00:00:00|2001-07-01 00:00:00|3
+                                A|testvect3|2001-01-01 00:00:00|2001-10-01 00:00:00|3
+                                A|testvect4|2001-01-01 00:00:00|2002-01-01 00:00:00|3"""
+                                
+        entries = list_string.split("\n")
+        
+        t_list = SimpleModule("t.list", quiet=True, columns=["name","mapset,start_time","end_time","number_of_maps"],  type="stvds")
+        self.assertModule(t_list)
+        
+        out = t_list.outputs["stdout"].value
+        
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        
+    def test_tvect_list(self):      
+        self.runModule("g.mapset", mapset="testvect1")
+
+        list_string = """a1|testvect1|2001-01-01 00:00:00|2001-02-01 00:00:00
+                                a2|testvect1|2001-02-01 00:00:00|2001-03-01 00:00:00
+                                a3|testvect1|2001-03-01 00:00:00|2001-04-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.vect.list", quiet=True, flags="s",  
+                                  columns=["name","mapset","start_time","end_time"] , 
+                                  input="A at testvect1")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|testvect2|2001-01-01 00:00:00|2001-03-01 00:00:00
+                                a2|testvect2|2001-03-01 00:00:00|2001-05-01 00:00:00
+                                a3|testvect2|2001-05-01 00:00:00|2001-07-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.vect.list", quiet=True, flags="s", 
+                                  columns=["name","mapset","start_time","end_time"] , 
+                                  input="A at testvect2")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|testvect3|2001-01-01 00:00:00|2001-04-01 00:00:00
+                                a2|testvect3|2001-04-01 00:00:00|2001-07-01 00:00:00
+                                a3|testvect3|2001-07-01 00:00:00|2001-10-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.vect.list", quiet=True, flags="s", 
+                                  columns=["name","mapset","start_time","end_time"] , 
+                                  input="A at testvect3")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+        list_string = """a1|testvect4|2001-01-01 00:00:00|2001-05-01 00:00:00
+                                a2|testvect4|2001-05-01 00:00:00|2001-09-01 00:00:00
+                                a3|testvect4|2001-09-01 00:00:00|2002-01-01 00:00:00"""
+
+        entries = list_string.split("\n")
+
+        trast_list = SimpleModule("t.vect.list", quiet=True, flags="s",
+                                  columns=["name","mapset","start_time","end_time"] , 
+                                  input="A at testvect4")
+        self.assertModule(trast_list)
+
+        out = trast_list.outputs["stdout"].value
+
+        for a,  b in zip(list_string.split("\n"),  out.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+
+    def test_stvds_info(self):  
+        self.runModule("g.mapset", mapset="testvect4")
+        tinfo_string="""id=A at testvect1
+                                    name=A
+                                    mapset=testvect1
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-04-01 00:00:00
+                                    granularity=1 month"""
+
+        info = SimpleModule("t.info", flags="g", type="stvds", input="A at testvect1")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="testvect3")
+        tinfo_string="""id=A at testvect2
+                                    name=A
+                                    mapset=testvect2
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-07-01 00:00:00
+                                    granularity=2 months"""
+
+        info = SimpleModule("t.info", flags="g", type="stvds",  input="A at testvect2")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="testvect2")
+        tinfo_string="""id=A at testvect3
+                                    name=A
+                                    mapset=testvect3
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2001-10-01 00:00:00
+                                    granularity=3 months"""
+
+        info = SimpleModule("t.info", flags="g", type="stvds", input="A at testvect3")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+  
+        self.runModule("g.mapset", mapset="testvect1")
+        tinfo_string="""id=A at testvect4
+                                    name=A
+                                    mapset=testvect4
+                                    start_time=2001-01-01 00:00:00
+                                    end_time=2002-01-01 00:00:00
+                                    granularity=4 months"""
+
+        info = SimpleModule("t.info", flags="g", type="stvds", input="A at testvect4")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+    def testv_vector_info(self):  
+        self.runModule("g.mapset", mapset="testvect3")
+        tinfo_string="""id=a1 at testvect1
+                                name=a1
+                                mapset=testvect1
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-02-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="vect",  input="a1 at testvect1")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at testvect2
+                                name=a1
+                                mapset=testvect2
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-03-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="vect",  input="a1 at testvect2")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at testvect3
+                                name=a1
+                                mapset=testvect3
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-04-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="vect",  input="a1 at testvect3")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+        tinfo_string="""id=a1 at testvect4
+                                name=a1
+                                mapset=testvect4
+                                creator=soeren
+                                temporal_type=absolute
+                                start_time=2001-01-01 00:00:00
+                                end_time=2001-05-01 00:00:00 """
+
+        info = SimpleModule("t.info", flags="g", type="vect",  input="a1 at testvect4")
+        self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
+
+if __name__ == '__main__':
+    from grass.gunittest.main import test
+    test()

Modified: grass/trunk/temporal/t.info/t.info.py
===================================================================
--- grass/trunk/temporal/t.info/t.info.py	2014-09-15 22:33:24 UTC (rev 61984)
+++ grass/trunk/temporal/t.info/t.info.py	2014-09-15 22:34:24 UTC (rev 61985)
@@ -2,15 +2,15 @@
 # -*- coding: utf-8 -*-
 ############################################################################
 #
-# MODULE:	t.info
-# AUTHOR(S):	Soeren Gebbert
+# MODULE:   t.info
+# AUTHOR(S):    Soeren Gebbert
 #
-# PURPOSE:	Print information about a space-time dataset
-# COPYRIGHT:	(C) 2011 by the GRASS Development Team
+# PURPOSE:  Print information about a space-time dataset
+# COPYRIGHT:    (C) 2011 by the GRASS Development Team
 #
-#		This program is free software under the GNU General Public
-#		License (version 2). Read the file COPYING that comes with GRASS
-#		for details.
+#       This program is free software under the GNU General Public
+#       License (version 2). Read the file COPYING that comes with GRASS
+#       for details.
 #
 #############################################################################
 
@@ -77,7 +77,7 @@
     if system and not shellstyle:
         #      0123456789012345678901234567890
         print " +------------------- Temporal DBMI backend information ----------------------+"
-        print " | DBMI Python interface:...... " + str(dbif.dbmi.__name__)
+        print " | DBMI Python interface:...... " + str(dbif.get_dbmi().__name__)
         print " | Temporal database string:... " + str(
             tgis.get_tgis_database_string())
         print " | SQL template path:.......... " + str(
@@ -88,7 +88,7 @@
         print " +----------------------------------------------------------------------------+"
         return
     elif system:
-        print "dbmi_python_interface=\'" + str(dbif.dbmi.__name__) + "\'"
+        print "dbmi_python_interface=\'" + str(dbif.get_dbmi().__name__) + "\'"
         print "dbmi_string=\'" + str(tgis.get_tgis_database_string()) + "\'"
         print "sql_template_path=\'" + str(tgis.get_sql_template_path()) + "\'"
         if rows:
@@ -106,10 +106,10 @@
 
     dataset = tgis.dataset_factory(type_, id_)
 
-    if dataset.is_in_db() == False:
+    if dataset.is_in_db(dbif) == False:
         grass.fatal(_("Dataset <%s> not found in temporal database") % (id_))
 
-    dataset.select()
+    dataset.select(dbif)
 
     if history == True and type in ["strds", "stvds", "str3ds"]:
         dataset.print_history()

Modified: grass/trunk/temporal/t.list/t.list.py
===================================================================
--- grass/trunk/temporal/t.list/t.list.py	2014-09-15 22:33:24 UTC (rev 61984)
+++ grass/trunk/temporal/t.list/t.list.py	2014-09-15 22:34:24 UTC (rev 61985)
@@ -76,7 +76,7 @@
 #% guisection: Formatting
 #%end
 
-import grass.script as grass
+import grass.script as gscript
 import grass.temporal as tgis
 import sys
 
@@ -91,7 +91,7 @@
     columns = options["columns"]
     order = options["order"]
     where = options["where"]
-    separator = grass.separator(options["separator"])
+    separator = gscript.separator(options["separator"])
     colhead = flags['c']
 
     # Make sure the temporal database exists
@@ -100,7 +100,8 @@
     sp = tgis.dataset_factory(type, None)
     first = True
     
-    sys.stderr.write("----------------------------------------------\n")
+    if  gscript.verbosity() > 0:
+        sys.stderr.write("----------------------------------------------\n")
 
     for ttype in temporal_type.split(","):
         if ttype == "absolute":
@@ -120,12 +121,13 @@
                 rows = stds_list[key]
 
                 if rows:
-                    if issubclass(sp.__class__,  tgis.AbstractMapDataset):
-                        sys.stderr.write(_("Time stamped %s maps with %s available in mapset <%s>:\n")%\
-                                                 (sp.get_type(),  time,  key))
-                    else:
-                        sys.stderr.write(_("Space time %s datasets with %s available in mapset <%s>:\n")%\
-                                                 (sp.get_new_map_instance(None).get_type(),  time,  key))
+                    if  gscript.verbosity() > 0:
+                        if issubclass(sp.__class__,  tgis.AbstractMapDataset):
+                            sys.stderr.write(_("Time stamped %s maps with %s available in mapset <%s>:\n")%\
+                                                     (sp.get_type(),  time,  key))
+                        else:
+                            sys.stderr.write(_("Space time %s datasets with %s available in mapset <%s>:\n")%\
+                                                     (sp.get_new_map_instance(None).get_type(),  time,  key))
 
                     # Print the column names if requested
                     if colhead == True and first == True:
@@ -153,5 +155,5 @@
                         print output
 
 if __name__ == "__main__":
-    options, flags = grass.parser()
+    options, flags = gscript.parser()
     main()

Modified: grass/trunk/temporal/t.vect.list/t.vect.list.py
===================================================================
--- grass/trunk/temporal/t.vect.list/t.vect.list.py	2014-09-15 22:33:24 UTC (rev 61984)
+++ grass/trunk/temporal/t.vect.list/t.vect.list.py	2014-09-15 22:34:24 UTC (rev 61985)
@@ -44,7 +44,7 @@
 #% required: no
 #% multiple: yes
 #% options: id,name,layer,creator,mapset,temporal_type,creation_time,start_time,end_time,north,south,west,east,points,lines,boundaries,centroids,faces,kernels,primitives,nodes,areas,islands,holes,volumes
-#% answer: id,name,layer,mapset,start_time,end_time
+#% answer: name,layer,mapset,start_time,end_time
 #%end
 
 #%option G_OPT_T_WHERE



More information about the grass-commit mailing list