[GRASS-SVN] r57464 - in grass/trunk/temporal: t.info t.remove

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 17 15:20:27 PDT 2013


Author: huhabla
Date: 2013-08-17 15:20:27 -0700 (Sat, 17 Aug 2013)
New Revision: 57464

Modified:
   grass/trunk/temporal/t.info/t.info.py
   grass/trunk/temporal/t.remove/t.remove.py
Log:
Added tgis metadata output to t.info. Improved map removal speed in t.remove.


Modified: grass/trunk/temporal/t.info/t.info.py
===================================================================
--- grass/trunk/temporal/t.info/t.info.py	2013-08-17 22:18:14 UTC (rev 57463)
+++ grass/trunk/temporal/t.info/t.info.py	2013-08-17 22:20:27 UTC (rev 57464)
@@ -68,9 +68,12 @@
 
     # Make sure the temporal database exists
     tgis.init()
-    
-    dbif = tgis.SQLDatabaseInterfaceConnection()
-    
+
+    dbif, connected = tgis.init_dbif(None)
+
+
+    rows = tgis.get_tgis_metadata(dbif)
+
     if system and not shellstyle:
         #      0123456789012345678901234567890
         print " +------------------- Temporal DBMI backend information ----------------------+"
@@ -79,14 +82,20 @@
             tgis.get_temporal_dbmi_init_string())
         print " | SQL template path:.......... " + str(
             tgis.get_sql_template_path())
+        if rows:
+            for row in rows:
+                print " | %s .......... %s"%(row[0], row[1])
         print " +----------------------------------------------------------------------------+"
         return
     elif system:
-        print "dbmi_python_interface=" + str(dbif.dbmi.__name__)
-        print "dbmi_init_string=" + str(tgis.get_temporal_dbmi_init_string())
-        print "sql_template_path=" + str(tgis.get_sql_template_path())
+        print "dbmi_python_interface=\'" + str(dbif.dbmi.__name__) + "\'"
+        print "dbmi_init_string=\'" + str(tgis.get_temporal_dbmi_init_string()) + "\'"
+        print "sql_template_path=\'" + str(tgis.get_sql_template_path()) + "\'"
+        if rows:
+            for row in rows:
+                print "%s=\'%s\'"%(row[0], row[1])
         return
-        
+
     if not system and not name:
         grass.fatal(_("Please specify %s=") % ("name"))
 

Modified: grass/trunk/temporal/t.remove/t.remove.py
===================================================================
--- grass/trunk/temporal/t.remove/t.remove.py	2013-08-17 22:18:14 UTC (rev 57463)
+++ grass/trunk/temporal/t.remove/t.remove.py	2013-08-17 22:20:27 UTC (rev 57464)
@@ -55,6 +55,7 @@
 #%end
 import grass.script as grass
 import grass.temporal as tgis
+import grass.pygrass.modules as pyg
 
 ############################################################################
 
@@ -128,19 +129,24 @@
             maps = sp.get_registered_maps_as_objects(dbif=dbif)
             map_statement = ""
             count = 1
+            name_list = []
             for map in maps:
                 map.select(dbif)
-                grass.run_command("g.remove", rast=map.get_name(), quiet=True)
+                name_list.append(map.get_name())
                 map_statement += map.delete(dbif=dbif, execute=False)
 
                 count += 1
                 # Delete every 100 maps
                 if count%100 == 0:
                     dbif.execute_transaction(map_statement)
+                    pyg.Module("g.remove", rast=name_list, quiet=True)
                     map_statement = ""
+                    name_list = []
 
             if map_statement:
                 dbif.execute_transaction(map_statement)
+            if name_list:
+                pyg.Module("g.remove", rast=name_list, quiet=True)
 
         statement += sp.delete(dbif=dbif, execute=False)
 



More information about the grass-commit mailing list