Browse Source

Modified initialization procedure of the temporal Python library
and removed unnecessary module calls while importing the
database backend modules.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53482 15284696-431f-4ddb-bdfa-cd5b030d7da7

Soeren Gebbert 12 years ago
parent
commit
3419cde61b
44 changed files with 172 additions and 114 deletions
  1. 2 0
      gui/wxpython/gui_core/gselect.py
  2. 1 1
      include/Make/Grass.make
  3. 3 1
      lib/python/temporal/abstract_dataset.py
  4. 1 0
      lib/python/temporal/abstract_map_dataset.py
  5. 9 8
      lib/python/temporal/abstract_space_time_dataset.py
  6. 7 6
      lib/python/temporal/base.py
  7. 95 50
      lib/python/temporal/core.py
  8. 1 1
      lib/python/temporal/space_time_datasets_tools.py
  9. 2 1
      lib/python/temporal/stds_import.py
  10. 2 3
      temporal/t.create/t.create.py
  11. 5 3
      temporal/t.info/t.info.py
  12. 1 1
      temporal/t.list/t.list.py
  13. 1 1
      temporal/t.rast.aggregate.ds/t.rast.aggregate.ds.py
  14. 1 1
      temporal/t.rast.aggregate/t.rast.aggregate.py
  15. 1 1
      temporal/t.rast.export/t.rast.export.py
  16. 1 1
      temporal/t.rast.extract/t.rast.extract.py
  17. 1 1
      temporal/t.rast.gapfill/t.rast.gapfill.py
  18. 2 0
      temporal/t.rast.import/t.rast.import.py
  19. 1 1
      temporal/t.rast.list/t.rast.list.py
  20. 1 1
      temporal/t.rast.mapcalc/t.rast.mapcalc.py
  21. 1 1
      temporal/t.rast.out.vtk/t.rast.out.vtk.py
  22. 1 1
      temporal/t.rast.series/t.rast.series.py
  23. 1 1
      temporal/t.rast.to.rast3/t.rast.to.rast3.py
  24. 1 1
      temporal/t.rast.univar/t.rast.univar.py
  25. 1 1
      temporal/t.rast3d.extract/t.rast3d.extract.py
  26. 1 1
      temporal/t.rast3d.list/t.rast3d.list.py
  27. 1 1
      temporal/t.rast3d.mapcalc/t.rast3d.mapcalc.py
  28. 1 1
      temporal/t.rast3d.univar/t.rast3d.univar.py
  29. 1 1
      temporal/t.register/t.register.py
  30. 1 1
      temporal/t.remove/t.remove.py
  31. 1 1
      temporal/t.sample/t.sample.py
  32. 1 1
      temporal/t.support/t.support.py
  33. 1 1
      temporal/t.topology/t.topology.py
  34. 6 6
      temporal/t.topology/test.t.topology.abstime.sh
  35. 5 5
      temporal/t.topology/test.t.topology.reltime.sh
  36. 1 1
      temporal/t.unregister/t.unregister.py
  37. 1 1
      temporal/t.vect.db.select/t.vect.db.select.py
  38. 1 1
      temporal/t.vect.export/t.vect.export.py
  39. 1 1
      temporal/t.vect.extract/t.vect.extract.py
  40. 2 0
      temporal/t.vect.import/t.vect.import.py
  41. 1 1
      temporal/t.vect.list/t.vect.list.py
  42. 1 1
      temporal/t.vect.observe.strds/t.vect.observe.strds.py
  43. 1 1
      temporal/t.vect.univar/t.vect.univar.py
  44. 1 1
      temporal/t.vect.what.strds/t.vect.what.strds.py

+ 2 - 0
gui/wxpython/gui_core/gselect.py

@@ -163,6 +163,8 @@ class TreeCtrlComboPopup(wx.combo.ComboPopup):
         self.fullyQualified = True
         self.fullyQualified = True
         
         
         self.SetFilter(None)
         self.SetFilter(None)
+
+        tgis.init()
         
         
     def Create(self, parent):
     def Create(self, parent):
         self.seltree = wx.TreeCtrl(parent, style=wx.TR_HIDE_ROOT
         self.seltree = wx.TreeCtrl(parent, style=wx.TR_HIDE_ROOT

+ 1 - 1
include/Make/Grass.make

@@ -169,7 +169,7 @@ libs = \
 	SQLP:sqlp \
 	SQLP:sqlp \
 	STATS:stats \
 	STATS:stats \
 	SYMB:symb \
 	SYMB:symb \
-        TEMPORAL:temporal \
+	TEMPORAL:temporal \
 	VECTOR:vector \
 	VECTOR:vector \
 	VEDIT:vedit \
 	VEDIT:vedit \
 	NETA:neta \
 	NETA:neta \

+ 3 - 1
lib/python/temporal/abstract_dataset.py

@@ -49,6 +49,8 @@ class ImplementationError(Exception):
 class AbstractDataset(object):
 class AbstractDataset(object):
     """!This is the base class for all datasets 
     """!This is the base class for all datasets 
        (raster, vector, raster3d, strds, stvds, str3ds)"""
        (raster, vector, raster3d, strds, stvds, str3ds)"""
+    def __init__(self):
+        pass
 
 
     def reset(self, ident):
     def reset(self, ident):
         """!Reset the internal structure and set the identifier
         """!Reset the internal structure and set the identifier
@@ -231,7 +233,7 @@ class AbstractDataset(object):
                 dbif)
                 dbif)
         statement += self.spatial_extent.get_insert_statement_mogrified(dbif)
         statement += self.spatial_extent.get_insert_statement_mogrified(dbif)
         statement += self.metadata.get_insert_statement_mogrified(dbif)
         statement += self.metadata.get_insert_statement_mogrified(dbif)
-
+        
         if execute:
         if execute:
             dbif.execute_transaction(statement)
             dbif.execute_transaction(statement)
             if connect:
             if connect:

+ 1 - 0
lib/python/temporal/abstract_map_dataset.py

@@ -66,6 +66,7 @@ class TemporalMapRelations(AbstractDataset):
     """
     """
 
 
     def __init__(self):
     def __init__(self):
+        AbstractDataset.__init__(self)
         self.reset_temporal_topology()
         self.reset_temporal_topology()
 
 
     def reset_temporal_topology(self):
     def reset_temporal_topology(self):

+ 9 - 8
lib/python/temporal/abstract_space_time_dataset.py

@@ -32,6 +32,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
        collecting of metadata.
        collecting of metadata.
     """
     """
     def __init__(self, ident):
     def __init__(self, ident):
+        AbstractDataset.__init__(self)
         self.reset(ident)
         self.reset(ident)
         self.map_counter = 0
         self.map_counter = 0
 
 
@@ -1018,7 +1019,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
 
         # Check if map is already registered
         # Check if map is already registered
         if stds_register_table is not None:
         if stds_register_table is not None:
-            if dbmi.paramstyle == "qmark":
+            if dbif.dbmi.paramstyle == "qmark":
                 sql = "SELECT id FROM " + \
                 sql = "SELECT id FROM " + \
                     stds_register_table + " WHERE id = (?)"
                     stds_register_table + " WHERE id = (?)"
             else:
             else:
@@ -1115,7 +1116,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
 
         # Register the stds in the map stds register table
         # Register the stds in the map stds register table
         # Check if the entry is already there
         # Check if the entry is already there
-        if dbmi.paramstyle == "qmark":
+        if dbif.dbmi.paramstyle == "qmark":
             sql = "SELECT id FROM " + map_register_table + " WHERE id = ?"
             sql = "SELECT id FROM " + map_register_table + " WHERE id = ?"
         else:
         else:
             sql = "SELECT id FROM " + map_register_table + " WHERE id = %s"
             sql = "SELECT id FROM " + map_register_table + " WHERE id = %s"
@@ -1127,7 +1128,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
 
         # In case of no entry make a new one
         # In case of no entry make a new one
         if row is None:
         if row is None:
-            if dbmi.paramstyle == "qmark":
+            if dbif.dbmi.paramstyle == "qmark":
                 sql = "INSERT INTO " + map_register_table + \
                 sql = "INSERT INTO " + map_register_table + \
                     " (id) " + "VALUES (?);\n"
                     " (id) " + "VALUES (?);\n"
             else:
             else:
@@ -1138,7 +1139,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                 (sql, (self.base.get_id(),)))
                 (sql, (self.base.get_id(),)))
 
 
         # Now put the raster name in the stds map register table
         # Now put the raster name in the stds map register table
-        if dbmi.paramstyle == "qmark":
+        if dbif.dbmi.paramstyle == "qmark":
             sql = "INSERT INTO " + stds_register_table + \
             sql = "INSERT INTO " + stds_register_table + \
                 " (id) " + "VALUES (?);\n"
                 " (id) " + "VALUES (?);\n"
         else:
         else:
@@ -1193,7 +1194,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
 
         # Check if the map is registered in the space time raster dataset
         # Check if the map is registered in the space time raster dataset
         if map_register_table is not None:
         if map_register_table is not None:
-            if dbmi.paramstyle == "qmark":
+            if dbif.dbmi.paramstyle == "qmark":
                 sql = "SELECT id FROM " + map_register_table + " WHERE id = ?"
                 sql = "SELECT id FROM " + map_register_table + " WHERE id = ?"
             else:
             else:
                 sql = "SELECT id FROM " + map_register_table + " WHERE id = %s"
                 sql = "SELECT id FROM " + map_register_table + " WHERE id = %s"
@@ -1220,7 +1221,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
 
         # Remove the space time raster dataset from the raster dataset register
         # Remove the space time raster dataset from the raster dataset register
         if map_register_table is not None:
         if map_register_table is not None:
-            if dbmi.paramstyle == "qmark":
+            if dbif.dbmi.paramstyle == "qmark":
                 sql = "DELETE FROM " + map_register_table + " WHERE id = ?;\n"
                 sql = "DELETE FROM " + map_register_table + " WHERE id = ?;\n"
             else:
             else:
                 sql = "DELETE FROM " + map_register_table + " WHERE id = %s;\n"
                 sql = "DELETE FROM " + map_register_table + " WHERE id = %s;\n"
@@ -1230,7 +1231,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
 
         # Remove the raster map from the space time raster dataset register
         # Remove the raster map from the space time raster dataset register
         if stds_register_table is not None:
         if stds_register_table is not None:
-            if dbmi.paramstyle == "qmark":
+            if dbif.dbmi.paramstyle == "qmark":
                 sql = "DELETE FROM " + stds_register_table + " WHERE id = ?;\n"
                 sql = "DELETE FROM " + stds_register_table + " WHERE id = ?;\n"
             else:
             else:
                 sql = "DELETE FROM " + \
                 sql = "DELETE FROM " + \
@@ -1353,7 +1354,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
 
             if row is not None:
             if row is not None:
                 # This seems to be a bug in sqlite3 Python driver
                 # This seems to be a bug in sqlite3 Python driver
-                if dbmi.__name__ == "sqlite3":
+                if dbif.dbmi.__name__ == "sqlite3":
                     tstring = row[0]
                     tstring = row[0]
                     # Convert the unicode string into the datetime format
                     # Convert the unicode string into the datetime format
                     if self.is_time_absolute():
                     if self.is_time_absolute():

+ 7 - 6
lib/python/temporal/base.py

@@ -40,6 +40,7 @@ from core import *
 class DictSQLSerializer(object):
 class DictSQLSerializer(object):
     def __init__(self):
     def __init__(self):
         self.D = {}
         self.D = {}
+        self.dbif =  SQLDatabaseInterfaceConnection()
 
 
     def serialize(self, type, table, where=None):
     def serialize(self, type, table, where=None):
         """!Convert the internal dictionary into a string of semicolon 
         """!Convert the internal dictionary into a string of semicolon 
@@ -107,12 +108,12 @@ class DictSQLSerializer(object):
             sql += ') VALUES ('
             sql += ') VALUES ('
             for key in self.D.keys():
             for key in self.D.keys():
                 if count == 0:
                 if count == 0:
-                    if dbmi.paramstyle == "qmark":
+                    if self.dbif.dbmi.paramstyle == "qmark":
                         sql += '?'
                         sql += '?'
                     else:
                     else:
                         sql += '%s'
                         sql += '%s'
                 else:
                 else:
-                    if dbmi.paramstyle == "qmark":
+                    if self.dbif.dbmi.paramstyle == "qmark":
                         sql += ' ,?'
                         sql += ' ,?'
                     else:
                     else:
                         sql += ' ,%s'
                         sql += ' ,%s'
@@ -132,13 +133,13 @@ class DictSQLSerializer(object):
                 # Update only entries which are not None
                 # Update only entries which are not None
                 if self.D[key] is not None:
                 if self.D[key] is not None:
                     if count == 0:
                     if count == 0:
-                        if dbmi.paramstyle == "qmark":
+                        if self.dbif.dbmi.paramstyle == "qmark":
                             sql += ' %s = ? ' % key
                             sql += ' %s = ? ' % key
                         else:
                         else:
                             sql += ' %s ' % key
                             sql += ' %s ' % key
                             sql += '= %s '
                             sql += '= %s '
                     else:
                     else:
-                        if dbmi.paramstyle == "qmark":
+                        if self.dbif.dbmi.paramstyle == "qmark":
                             sql += ' ,%s = ? ' % key
                             sql += ' ,%s = ? ' % key
                         else:
                         else:
                             sql += ' ,%s ' % key
                             sql += ' ,%s ' % key
@@ -155,13 +156,13 @@ class DictSQLSerializer(object):
             sql += 'UPDATE ' + table + ' SET '
             sql += 'UPDATE ' + table + ' SET '
             for key in self.D.keys():
             for key in self.D.keys():
                 if count == 0:
                 if count == 0:
-                    if dbmi.paramstyle == "qmark":
+                    if self.dbif.dbmi.paramstyle == "qmark":
                         sql += ' %s = ? ' % key
                         sql += ' %s = ? ' % key
                     else:
                     else:
                         sql += ' %s ' % key
                         sql += ' %s ' % key
                         sql += '= %s '
                         sql += '= %s '
                 else:
                 else:
-                    if dbmi.paramstyle == "qmark":
+                    if self.dbif.dbmi.paramstyle == "qmark":
                         sql += ' ,%s = ? ' % key
                         sql += ' ,%s = ? ' % key
                     else:
                     else:
                         sql += ' ,%s ' % key
                         sql += ' ,%s ' % key

+ 95 - 50
lib/python/temporal/core.py

@@ -36,7 +36,25 @@ for details.
 """
 """
 import os
 import os
 import copy
 import copy
+import sys
 import grass.script.core as core
 import grass.script.core as core
+# Import all supported database backends
+try:
+    import sqlite3
+except ImportError:
+    raise
+# Postgresql is optional, existence is checked when needed
+try:
+    import psycopg2
+    import psycopg2.extras
+except:
+    pass
+
+# Global variable that defines the backend
+# of the temporal GIS
+# It can either be "sqlite" or "pg"
+tgis_backed = None
+
 
 
 # This variable specifies if the ctypes interface to the grass 
 # This variable specifies if the ctypes interface to the grass 
 # libraries should be used to read map specific data. If set to False
 # libraries should be used to read map specific data. If set to False
@@ -45,34 +63,14 @@ import grass.script.core as core
 # the GRASS C functions may call G_fatal_error() which exits the process.
 # the GRASS C functions may call G_fatal_error() which exits the process.
 # That is not catchable in Python.
 # That is not catchable in Python.
 use_ctypes_map_access = True
 use_ctypes_map_access = True
-
-###############################################################################
-
-# The chosen DBMI back-end can be defined on runtime
-# Check the grass environment before import
-core.run_command("t.connect", flags="c")
-kv = core.parse_command("t.connect", flags="pg")
-if "driver" in kv:
-    if kv["driver"] == "sqlite":
-        import sqlite3 as dbmi
-    elif kv["driver"] == "pg":
-        import psycopg2 as dbmi
-        # Needed for dictionary like cursors
-        import psycopg2.extras
-    else:
-        core.fatal(_("Unable to initialize the temporal DBMI interface. Use "
-                     "t.connect to specify the driver and the database string"))
-else:
-    # Use the default sqlite variable
-    core.run_command("t.connect", flags="d")
-    import sqlite3 as dbmi
-
+        
 ###############################################################################
 ###############################################################################
 
 
 def get_temporal_dbmi_init_string():
 def get_temporal_dbmi_init_string():
     kv = core.parse_command("t.connect", flags="pg")
     kv = core.parse_command("t.connect", flags="pg")
     grassenv = core.gisenv()
     grassenv = core.gisenv()
-    if dbmi.__name__ == "sqlite3":
+    global tgis_backed
+    if tgis_backed == "sqlite":
         if "database" in kv:
         if "database" in kv:
             string = kv["database"]
             string = kv["database"]
             string = string.replace("$GISDBASE", grassenv["GISDBASE"])
             string = string.replace("$GISDBASE", grassenv["GISDBASE"])
@@ -83,15 +81,14 @@ def get_temporal_dbmi_init_string():
             core.fatal(_("Unable to initialize the temporal GIS DBMI "
             core.fatal(_("Unable to initialize the temporal GIS DBMI "
                          "interface. Use t.connect to specify the driver "
                          "interface. Use t.connect to specify the driver "
                          "and the database string"))
                          "and the database string"))
-    elif dbmi.__name__ == "psycopg2":
+    elif tgis_backed == "pg":
         if "database" in kv:
         if "database" in kv:
             string = kv["database"]
             string = kv["database"]
             return string
             return string
-        else:
-            core.fatal(_("Unable to initialize the temporal GIS DBMI "
-                         "interface. Use t.connect to specify the driver "
-                         "and the database string"))
-            return "dbname=grass_test user=soeren password=abcdefgh"
+    else:
+        core.fatal(_("Unable to initialize the temporal GIS DBMI "
+                     "interface. Use t.connect to specify the driver "
+                     "and the database string"))
 
 
 ###############################################################################
 ###############################################################################
 
 
@@ -112,6 +109,13 @@ def set_use_ctypes_map_access(use_ctype = True):
 
 
 ###############################################################################
 ###############################################################################
 
 
+def get_use_ctypes_map_access(use_ctype = True):
+    """!Return true if ctypes is used for map access """
+    global use_ctypes_map_access
+    return use_ctypes_map_access
+
+###############################################################################
+
 def get_sql_template_path():
 def get_sql_template_path():
     base = os.getenv("GISBASE")
     base = os.getenv("GISBASE")
     base_etc = os.path.join(base, "etc")
     base_etc = os.path.join(base, "etc")
@@ -119,25 +123,61 @@ def get_sql_template_path():
 
 
 ###############################################################################
 ###############################################################################
 
 
-def create_temporal_database():
-    """!This function creates the grass location database structure for raster, 
+def init():
+    """!This function set the correct database backend from the environmental variables
+       and creates the grass location database structure for raster, 
        vector and raster3d maps as well as for the space-time datasets strds, 
        vector and raster3d maps as well as for the space-time datasets strds, 
-       str3ds and stvds
+       str3ds and stvds in case it not exists.
 
 
-       This functions must be called before any spatio-temporal processing 
-       can be started
+        ATTENTION: This functions must be called before any spatio-temporal processing 
+                   can be started
     """
     """
+    # We need to set the correct database backend from the environment variables
+    global tgis_backed
+    
+    dbmi = sqlite3
 
 
+    core.run_command("t.connect", flags="c")
+    kv = core.parse_command("t.connect", flags="pg")
+    
+    if "driver" in kv:
+        if kv["driver"] == "sqlite":
+            tgis_backed = kv["driver"]
+        elif kv["driver"] == "pg":
+            tgis_backed = kv["driver"]
+            try:
+                import psycopg2
+            except ImportError:
+                core.error("Unable to locate the Postgresql SQL Python interface module psycopg2.")
+                raise
+            dbmi = psycopg2
+        else:
+            core.fatal(_("Unable to initialize the temporal DBMI interface. Use "
+                         "t.connect to specify the driver and the database string"))
+    else:
+        # Set the default sqlite3 connection in case nothing was defined
+        core.run_command("t.connect", flags="d")
+            
     database = get_temporal_dbmi_init_string()
     database = get_temporal_dbmi_init_string()
 
 
     db_exists = False
     db_exists = False
 
 
     # Check if the database already exists
     # Check if the database already exists
-    if dbmi.__name__ == "sqlite3":
+    if tgis_backed == "sqlite":
         # Check path of the sqlite database
         # Check path of the sqlite database
         if os.path.exists(database):
         if os.path.exists(database):
-            db_exists = True
-    elif dbmi.__name__ == "psycopg2":
+            # Connect to database
+            connection = dbmi.connect(database)
+            cursor = connection.cursor()
+            # Check for raster_base table
+            cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='raster_base';")
+            
+            name = cursor.fetchone()[0]
+            if name == "raster_base":
+                db_exists = True
+            connection.commit()
+            cursor.close()
+    elif tgis_backed == "pg":
         # Connect to database
         # Connect to database
         connection = dbmi.connect(database)
         connection = dbmi.connect(database)
         cursor = connection.cursor()
         cursor = connection.cursor()
@@ -186,7 +226,7 @@ def create_temporal_database():
     connection = dbmi.connect(database)
     connection = dbmi.connect(database)
     cursor = connection.cursor()
     cursor = connection.cursor()
 
 
-    if dbmi.__name__ == "sqlite3":
+    if tgis_backed == "sqlite":
 
 
         sqlite3_delete_trigger_sql = open(os.path.join(get_sql_template_path(
         sqlite3_delete_trigger_sql = open(os.path.join(get_sql_template_path(
         ), "sqlite3_delete_trigger.sql"), 'r').read()
         ), "sqlite3_delete_trigger.sql"), 'r').read()
@@ -207,7 +247,7 @@ def create_temporal_database():
         cursor.executescript(str3ds_tables_sql)
         cursor.executescript(str3ds_tables_sql)
         cursor.executescript(str3ds_metadata_sql)
         cursor.executescript(str3ds_metadata_sql)
         cursor.executescript(sqlite3_delete_trigger_sql)
         cursor.executescript(sqlite3_delete_trigger_sql)
-    elif dbmi.__name__ == "psycopg2":
+    elif tgis_backed == "pg":
         # Execute the SQL statements for postgresql
         # Execute the SQL statements for postgresql
         # Create the global tables for the native grass datatypes
         # Create the global tables for the native grass datatypes
         cursor.execute(raster_tables_sql)
         cursor.execute(raster_tables_sql)
@@ -240,6 +280,11 @@ class SQLDatabaseInterfaceConnection():
     """
     """
     def __init__(self):
     def __init__(self):
         self.connected = False
         self.connected = False
+        global tgis_backend
+        if tgis_backed == "sqlite":
+            self.dbmi = sqlite3
+        else:
+            self.dbmi = psycopg2
 
 
     def connect(self):
     def connect(self):
         """!Connect to the DBMI to execute SQL statements
         """!Connect to the DBMI to execute SQL statements
@@ -248,19 +293,19 @@ class SQLDatabaseInterfaceConnection():
         """
         """
         init = get_temporal_dbmi_init_string()
         init = get_temporal_dbmi_init_string()
         #print "Connect to",  self.database
         #print "Connect to",  self.database
-        if dbmi.__name__ == "sqlite3":
-            self.connection = dbmi.connect(init, 
-                    detect_types=dbmi.PARSE_DECLTYPES | dbmi.PARSE_COLNAMES)
-            self.connection.row_factory = dbmi.Row
+        if self.dbmi.__name__ == "sqlite3":
+            self.connection = self.dbmi.connect(init, 
+                    detect_types = self.dbmi.PARSE_DECLTYPES | self.dbmi.PARSE_COLNAMES)
+            self.connection.row_factory = self.dbmi.Row
             self.connection.isolation_level = None
             self.connection.isolation_level = None
             self.cursor = self.connection.cursor()
             self.cursor = self.connection.cursor()
             self.cursor.execute("PRAGMA synchronous = OFF")
             self.cursor.execute("PRAGMA synchronous = OFF")
             self.cursor.execute("PRAGMA journal_mode = MEMORY")
             self.cursor.execute("PRAGMA journal_mode = MEMORY")
-        elif dbmi.__name__ == "psycopg2":
-            self.connection = dbmi.connect(init)
+        elif self.dbmi.__name__ == "psycopg2":
+            self.connection = self.dbmi.connect(init)
             #self.connection.set_isolation_level(dbmi.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
             #self.connection.set_isolation_level(dbmi.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
             self.cursor = self.connection.cursor(
             self.cursor = self.connection.cursor(
-                cursor_factory=dbmi.extras.DictCursor)
+                cursor_factory = self.dbmi.extras.DictCursor)
         self.connected = True
         self.connected = True
 
 
     def close(self):
     def close(self):
@@ -291,8 +336,8 @@ class SQLDatabaseInterfaceConnection():
         """
         """
         sql = content[0]
         sql = content[0]
         args = content[1]
         args = content[1]
-
-        if dbmi.__name__ == "psycopg2":
+        
+        if self.dbmi.__name__ == "psycopg2":
             if len(args) == 0:
             if len(args) == 0:
                 return sql
                 return sql
             else:
             else:
@@ -308,7 +353,7 @@ class SQLDatabaseInterfaceConnection():
                     self.close()
                     self.close()
                     return statement
                     return statement
 
 
-        elif dbmi.__name__ == "sqlite3":
+        elif self.dbmi.__name__ == "sqlite3":
             if len(args) == 0:
             if len(args) == 0:
                 return sql
                 return sql
             else:
             else:
@@ -366,7 +411,7 @@ class SQLDatabaseInterfaceConnection():
         sql_script += "END TRANSACTION;"
         sql_script += "END TRANSACTION;"
         
         
         try:
         try:
-            if dbmi.__name__ == "sqlite3":
+            if self.dbmi.__name__ == "sqlite3":
                 self.cursor.executescript(statement)
                 self.cursor.executescript(statement)
             else:
             else:
                 self.cursor.execute(statement)
                 self.cursor.execute(statement)

+ 1 - 1
lib/python/temporal/space_time_datasets_tools.py

@@ -274,7 +274,7 @@ def register_maps_in_space_time_dataset(
             statement += map.insert(dbif=dbif, execute=False)
             statement += map.insert(dbif=dbif, execute=False)
 
 
         # Sqlite3 performace better for huge datasets when committing in small chunks
         # Sqlite3 performace better for huge datasets when committing in small chunks
-        if dbmi.__name__ == "sqlite3":
+        if dbif.dbmi.__name__ == "sqlite3":
             if count % 100 == 0:
             if count % 100 == 0:
                 if statement is not None and statement != "":
                 if statement is not None and statement != "":
                     core.message(_("Registering maps in the temporal database")
                     core.message(_("Registering maps in the temporal database")

+ 2 - 1
lib/python/temporal/stds_import.py

@@ -39,6 +39,7 @@ import tarfile
 import tempfile
 import tempfile
 import time
 import time
 import filecmp
 import filecmp
+import space_time_datasets_tools
 from space_time_datasets_tools import *
 from space_time_datasets_tools import *
 
 
 proj_file_name = "proj.txt"
 proj_file_name = "proj.txt"
@@ -248,7 +249,7 @@ def import_stds(
 
 
     try:
     try:
         # Make sure the temporal database exists
         # Make sure the temporal database exists
-        create_temporal_database()
+        space_time_datasets_tools.init()
 
 
         fs = "|"
         fs = "|"
         maplist = []
         maplist = []

+ 2 - 3
temporal/t.create/t.create.py

@@ -72,9 +72,8 @@ def main():
     descr = options["description"]
     descr = options["description"]
     semantic = options["semantictype"]
     semantic = options["semantictype"]
 
 
-    # Make sure the temporal database exists
-    tgis.create_temporal_database()
-
+    tgis.init()
+    
     #Get the current mapset to create the id of the space time dataset
     #Get the current mapset to create the id of the space time dataset
 
 
     mapset = grass.gisenv()["MAPSET"]
     mapset = grass.gisenv()["MAPSET"]

+ 5 - 3
temporal/t.info/t.info.py

@@ -62,12 +62,14 @@ def main():
     system = flags['s']
     system = flags['s']
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
+    
+    dbif = tgis.SQLDatabaseInterfaceConnection()
 
 
     if system and not shellstyle:
     if system and not shellstyle:
         #      0123456789012345678901234567890
         #      0123456789012345678901234567890
         print " +------------------- Temporal DBMI backend information ----------------------+"
         print " +------------------- Temporal DBMI backend information ----------------------+"
-        print " | DBMI Python interface:...... " + str(tgis.dbmi.__name__)
+        print " | DBMI Python interface:...... " + str(dbif.dbmi.__name__)
         print " | DBMI init string:........... " + str(
         print " | DBMI init string:........... " + str(
             tgis.get_temporal_dbmi_init_string())
             tgis.get_temporal_dbmi_init_string())
         print " | SQL template path:.......... " + str(
         print " | SQL template path:.......... " + str(
@@ -75,7 +77,7 @@ def main():
         print " +----------------------------------------------------------------------------+"
         print " +----------------------------------------------------------------------------+"
         return
         return
     elif system:
     elif system:
-        print "dbmi_python_interface=" + str(tgis.dbmi.__name__)
+        print "dbmi_python_interface=" + str(dbif.dbmi.__name__)
         print "dbmi_init_string=" + str(tgis.get_temporal_dbmi_init_string())
         print "dbmi_init_string=" + str(tgis.get_temporal_dbmi_init_string())
         print "sql_template_path=" + str(tgis.get_sql_template_path())
         print "sql_template_path=" + str(tgis.get_sql_template_path())
         return
         return

+ 1 - 1
temporal/t.list/t.list.py

@@ -88,7 +88,7 @@ def main():
     colhead = flags['c']
     colhead = flags['c']
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     id = None
     id = None
     sp = tgis.dataset_factory(type, id)
     sp = tgis.dataset_factory(type, id)

+ 1 - 1
temporal/t.rast.aggregate.ds/t.rast.aggregate.ds.py

@@ -81,7 +81,7 @@ def main():
     sampling = options["sampling"]
     sampling = options["sampling"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
     # We need a database interface
     # We need a database interface
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif.connect()
     dbif.connect()

+ 1 - 1
temporal/t.rast.aggregate/t.rast.aggregate.py

@@ -83,7 +83,7 @@ def main():
     sampling = options["sampling"]
     sampling = options["sampling"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
     # We need a database interface
     # We need a database interface
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif.connect()
     dbif.connect()

+ 1 - 1
temporal/t.rast.export/t.rast.export.py

@@ -73,7 +73,7 @@ def main():
     _format = options["format"]
     _format = options["format"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
     # Export the space time raster dataset
     # Export the space time raster dataset
     tgis.export_stds(
     tgis.export_stds(
         _input, output, compression, workdir, where, _format, "strds")
         _input, output, compression, workdir, where, _format, "strds")

+ 1 - 1
temporal/t.rast.extract/t.rast.extract.py

@@ -79,7 +79,7 @@ def main():
     register_null = flags["n"]
     register_null = flags["n"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.extract_dataset(input, output, "raster", where, expression,
     tgis.extract_dataset(input, output, "raster", where, expression,
                          base, nprocs, register_null)
                          base, nprocs, register_null)

+ 1 - 1
temporal/t.rast.gapfill/t.rast.gapfill.py

@@ -64,7 +64,7 @@ def main():
     nprocs = options["nprocs"]
     nprocs = options["nprocs"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     if input.find("@") >= 0:
     if input.find("@") >= 0:
         id = input
         id = input

+ 2 - 0
temporal/t.rast.import/t.rast.import.py

@@ -92,6 +92,8 @@ def main():
     exp = flags["e"]
     exp = flags["e"]
     overr = flags["o"]
     overr = flags["o"]
     create = flags["c"]
     create = flags["c"]
+    
+    tgis.init()
 
 
     tgis.import_stds(input, output, extrdir, title, descr, location,
     tgis.import_stds(input, output, extrdir, title, descr, location,
                      link, exp, overr, create, "strds")
                      link, exp, overr, create, "strds")

+ 1 - 1
temporal/t.rast.list/t.rast.list.py

@@ -88,7 +88,7 @@ def main():
     header = flags["h"]
     header = flags["h"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.list_maps_of_stds(
     tgis.list_maps_of_stds(
         "strds", input, columns, order, where, separator, method, header)
         "strds", input, columns, order, where, separator, method, header)

+ 1 - 1
temporal/t.rast.mapcalc/t.rast.mapcalc.py

@@ -91,7 +91,7 @@ def main():
     method = method.split(",")
     method = method.split(",")
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.dataset_mapcalculator(inputs, output, "raster", expression,
     tgis.dataset_mapcalculator(inputs, output, "raster", expression,
                                base, method, nprocs, register_null, spatial)
                                base, method, nprocs, register_null, spatial)

+ 1 - 1
temporal/t.rast.out.vtk/t.rast.out.vtk.py

@@ -84,7 +84,7 @@ def main():
     use_granularity = flags["g"]
     use_granularity = flags["g"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     if not os.path.exists(expdir):
     if not os.path.exists(expdir):
         grass.fatal(_("Export directory <%s> not found.") % expdir)
         grass.fatal(_("Export directory <%s> not found.") % expdir)

+ 1 - 1
temporal/t.rast.series/t.rast.series.py

@@ -71,7 +71,7 @@ def main():
     add_time = flags["t"]
     add_time = flags["t"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     if input.find("@") >= 0:
     if input.find("@") >= 0:
         id = input
         id = input

+ 1 - 1
temporal/t.rast.to.rast3/t.rast.to.rast3.py

@@ -42,7 +42,7 @@ def main():
     output = options["output"]
     output = options["output"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     mapset = grass.gisenv()["MAPSET"]
     mapset = grass.gisenv()["MAPSET"]
 
 

+ 1 - 1
temporal/t.rast.univar/t.rast.univar.py

@@ -61,7 +61,7 @@ def main():
     fs = options["fs"]
     fs = options["fs"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.print_gridded_dataset_univar_statistics(
     tgis.print_gridded_dataset_univar_statistics(
         "strds", input, where, extended, header, fs)
         "strds", input, where, extended, header, fs)

+ 1 - 1
temporal/t.rast3d.extract/t.rast3d.extract.py

@@ -77,7 +77,7 @@ def main():
     register_null = flags["n"]
     register_null = flags["n"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.extract_dataset(input, output, "raster3d", where, expression,
     tgis.extract_dataset(input, output, "raster3d", where, expression,
                          base, nprocs, register_null)
                          base, nprocs, register_null)

+ 1 - 1
temporal/t.rast3d.list/t.rast3d.list.py

@@ -88,7 +88,7 @@ def main():
     header = flags["h"]
     header = flags["h"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.list_maps_of_stds(
     tgis.list_maps_of_stds(
         "str3ds", input, columns, order, where, separator, method, header)
         "str3ds", input, columns, order, where, separator, method, header)

+ 1 - 1
temporal/t.rast3d.mapcalc/t.rast3d.mapcalc.py

@@ -90,7 +90,7 @@ def main():
     method = method.split(",")
     method = method.split(",")
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.dataset_mapcalculator(inputs, output, "raster3d", expression,
     tgis.dataset_mapcalculator(inputs, output, "raster3d", expression,
                                base, method, nprocs, register_null, spatial)
                                base, method, nprocs, register_null, spatial)

+ 1 - 1
temporal/t.rast3d.univar/t.rast3d.univar.py

@@ -61,7 +61,7 @@ def main():
     fs = options["fs"]
     fs = options["fs"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.print_gridded_dataset_univar_statistics(
     tgis.print_gridded_dataset_univar_statistics(
         "str3ds", input, where, extended, header, fs)
         "str3ds", input, where, extended, header, fs)

+ 1 - 1
temporal/t.register/t.register.py

@@ -104,7 +104,7 @@ def main():
     interval = flags["i"]
     interval = flags["i"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
     # Register maps
     # Register maps
     tgis.register_maps_in_space_time_dataset(
     tgis.register_maps_in_space_time_dataset(
         type=type, name=name, maps=maps, file=file, start=start, end=end,
         type=type, name=name, maps=maps, file=file, start=start, end=end,

+ 1 - 1
temporal/t.remove/t.remove.py

@@ -59,7 +59,7 @@ def main():
         core.fata(_("%s= and %s= are mutually exclusive") % ("input", "file"))
         core.fata(_("%s= and %s= are mutually exclusive") % ("input", "file"))
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif.connect()
     dbif.connect()

+ 1 - 1
temporal/t.sample/t.sample.py

@@ -81,7 +81,7 @@ def main():
     method = method.split(",")
     method = method.split(",")
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.sample_stds_by_stds_topology(intype, samtype, inputs, sampler,
     tgis.sample_stds_by_stds_topology(intype, samtype, inputs, sampler,
                                       header, separator, method, spatial)
                                       header, separator, method, spatial)

+ 1 - 1
temporal/t.support/t.support.py

@@ -80,7 +80,7 @@ def main():
     map_update = flags["m"]
     map_update = flags["m"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     #Get the current mapset to create the id of the space time dataset
     #Get the current mapset to create the id of the space time dataset
     mapset = grass.gisenv()["MAPSET"]
     mapset = grass.gisenv()["MAPSET"]

+ 1 - 1
temporal/t.topology/t.topology.py

@@ -49,7 +49,7 @@ def main():
     tmatrix = flags['m']
     tmatrix = flags['m']
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     #Get the current mapset to create the id of the space time dataset
     #Get the current mapset to create the id of the space time dataset
     if name.find("@") >= 0:
     if name.find("@") >= 0:

+ 6 - 6
temporal/t.topology/test.t.topology.abstime.sh

@@ -83,32 +83,32 @@ EOF
 t.create --o type=strds temporaltype=absolute output=precip_abs title="A test with input files" descr="A test with input files"
 t.create --o type=strds temporaltype=absolute output=precip_abs title="A test with input files" descr="A test with input files"
 t.create --o type=strds temporaltype=absolute output=maps title="A test with maps in input files" descr="A test with maps in input files"
 t.create --o type=strds temporaltype=absolute output=maps title="A test with maps in input files" descr="A test with maps in input files"
 
 
-t.register type=rast -i input=precip_abs file="${n1}" start="2001-01-01" increment="1 months"
+t.register --o type=rast -i input=precip_abs file="${n1}" start="2001-01-01" increment="1 months"
 cat "${n1}"
 cat "${n1}"
 t.topology    input=precip_abs
 t.topology    input=precip_abs
 t.topology -m input=precip_abs
 t.topology -m input=precip_abs
 
 
-t.register type=rast -i input=precip_abs file="${n2}"
+t.register --o type=rast -i input=precip_abs file="${n2}"
 cat "${n2}"
 cat "${n2}"
 t.topology    input=precip_abs
 t.topology    input=precip_abs
 t.topology -m input=precip_abs
 t.topology -m input=precip_abs
 
 
-t.register type=rast -i input=precip_abs file="${n3}"
+t.register --o type=rast -i input=precip_abs file="${n3}"
 cat "${n3}"
 cat "${n3}"
 t.topology    input=precip_abs
 t.topology    input=precip_abs
 t.topology -m input=precip_abs
 t.topology -m input=precip_abs
 
 
-t.register type=rast -i input=precip_abs file="${n4}"
+t.register --o type=rast -i input=precip_abs file="${n4}"
 cat "${n4}"
 cat "${n4}"
 t.topology    input=precip_abs
 t.topology    input=precip_abs
 t.topology -m input=precip_abs
 t.topology -m input=precip_abs
 
 
-t.register type=rast -i input=precip_abs file="${n5}"
+t.register --o type=rast -i input=precip_abs file="${n5}"
 cat "${n5}"
 cat "${n5}"
 t.topology    input=precip_abs
 t.topology    input=precip_abs
 t.topology -m input=precip_abs
 t.topology -m input=precip_abs
 
 
-t.register type=rast -i input=maps file="${n6}"
+t.register --o type=rast -i input=maps file="${n6}"
 cat "${n6}"
 cat "${n6}"
 t.topology    input=maps
 t.topology    input=maps
 t.topology -m input=maps
 t.topology -m input=maps

+ 5 - 5
temporal/t.topology/test.t.topology.reltime.sh

@@ -70,27 +70,27 @@ EOF
 t.create --o type=strds temporaltype=relative output=precip_rel_d title="A test with input files of unti days" descr="A test with input files"
 t.create --o type=strds temporaltype=relative output=precip_rel_d title="A test with input files of unti days" descr="A test with input files"
 t.create --o type=strds temporaltype=relative output=precip_rel_y title="A test with input files of unit years" descr="A test with input files"
 t.create --o type=strds temporaltype=relative output=precip_rel_y title="A test with input files of unit years" descr="A test with input files"
 
 
-t.register type=rast -i --v input=precip_rel_d file="${n1}" start=0 increment=1 unit=days
+t.register --o type=rast -i --v input=precip_rel_d file="${n1}" start=0 increment=1 unit=days
 cat "${n1}"
 cat "${n1}"
 t.topology    input=precip_rel_d
 t.topology    input=precip_rel_d
 t.topology -m input=precip_rel_d
 t.topology -m input=precip_rel_d
 
 
-t.register type=rast -i input=precip_rel_d file="${n2}" unit=days
+t.register --o type=rast -i input=precip_rel_d file="${n2}" unit=days
 cat "${n2}"
 cat "${n2}"
 t.topology    input=precip_rel_d
 t.topology    input=precip_rel_d
 t.topology -m input=precip_rel_d
 t.topology -m input=precip_rel_d
 
 
-t.register type=rast -i input=precip_rel_d file="${n3}" unit=days
+t.register --o type=rast -i input=precip_rel_d file="${n3}" unit=days
 cat "${n3}"
 cat "${n3}"
 t.topology    input=precip_rel_d
 t.topology    input=precip_rel_d
 t.topology -m input=precip_rel_d
 t.topology -m input=precip_rel_d
 
 
-t.register type=rast -i input=precip_rel_y file="${n4}" unit=years
+t.register --o type=rast -i input=precip_rel_y file="${n4}" unit=years
 cat "${n4}"
 cat "${n4}"
 t.topology    input=precip_rel_y
 t.topology    input=precip_rel_y
 t.topology -m input=precip_rel_y
 t.topology -m input=precip_rel_y
 
 
-t.register type=rast -i input=precip_rel_y file="${n5}" unit=years
+t.register --o type=rast -i input=precip_rel_y file="${n5}" unit=years
 cat "${n5}"
 cat "${n5}"
 t.topology    input=precip_rel_y
 t.topology    input=precip_rel_y
 t.topology -m input=precip_rel_y
 t.topology -m input=precip_rel_y

+ 1 - 1
temporal/t.unregister/t.unregister.py

@@ -55,7 +55,7 @@ def main():
     type = options["type"]
     type = options["type"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     if maps and file:
     if maps and file:
         grass.fatal(_(
         grass.fatal(_(

+ 1 - 1
temporal/t.vect.db.select/t.vect.db.select.py

@@ -71,7 +71,7 @@ def main():
         columns = None
         columns = None
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     mapset = grass.gisenv()["MAPSET"]
     mapset = grass.gisenv()["MAPSET"]
 
 

+ 1 - 1
temporal/t.vect.export/t.vect.export.py

@@ -73,7 +73,7 @@ def main():
     _format = options["format"]
     _format = options["format"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
     # Export the space time raster dataset
     # Export the space time raster dataset
     tgis.export_stds(
     tgis.export_stds(
         _input, output, compression, workdir, where, _format, "stvds")
         _input, output, compression, workdir, where, _format, "stvds")

+ 1 - 1
temporal/t.vect.extract/t.vect.extract.py

@@ -82,7 +82,7 @@ def main():
     register_null = flags["n"]
     register_null = flags["n"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.extract_dataset(input, output, "vector", where, expression,
     tgis.extract_dataset(input, output, "vector", where, expression,
                          base, nprocs, register_null, layer, type)
                          base, nprocs, register_null, layer, type)

+ 2 - 0
temporal/t.vect.import/t.vect.import.py

@@ -86,6 +86,8 @@ def main():
     exp = flags["e"]
     exp = flags["e"]
     overr = flags["o"]
     overr = flags["o"]
     create = flags["c"]
     create = flags["c"]
+    
+    tgis.init()
 
 
     tgis.import_stds(input, output, extrdir, title, descr, location,
     tgis.import_stds(input, output, extrdir, title, descr, location,
                      None, exp, overr, create, "stvds")
                      None, exp, overr, create, "stvds")

+ 1 - 1
temporal/t.vect.list/t.vect.list.py

@@ -87,7 +87,7 @@ def main():
     header = flags["h"]
     header = flags["h"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.list_maps_of_stds(
     tgis.list_maps_of_stds(
         "stvds", input, columns, order, where, separator, method, header)
         "stvds", input, columns, order, where, separator, method, header)

+ 1 - 1
temporal/t.vect.observe.strds/t.vect.observe.strds.py

@@ -73,7 +73,7 @@ def main():
         where = None
         where = None
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
     # We need a database interface
     # We need a database interface
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif.connect()
     dbif.connect()

+ 1 - 1
temporal/t.vect.univar/t.vect.univar.py

@@ -82,7 +82,7 @@ def main():
     fs = options["fs"]
     fs = options["fs"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
 
 
     tgis.print_vector_dataset_univar_statistics(
     tgis.print_vector_dataset_univar_statistics(
         input, twhere, layer, type, column, where, extended, header, fs)
         input, twhere, layer, type, column, where, extended, header, fs)

+ 1 - 1
temporal/t.vect.what.strds/t.vect.what.strds.py

@@ -79,7 +79,7 @@ def main():
         where = None
         where = None
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
-    tgis.create_temporal_database()
+    tgis.init()
     # We need a database interface
     # We need a database interface
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif.connect()
     dbif.connect()