Browse Source

Backport of grass71 bugfixes: correct return value catching in parallel module runs, mapset ordered listing of STDS, API renaming, test updates

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@60534 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 11 years ago
parent
commit
a4573c56f8

+ 8 - 8
lib/python/temporal/abstract_map_dataset.py

@@ -214,7 +214,7 @@ class AbstractMapDataset(AbstractDataset):
             self.print_topology_info()
             self.print_topology_info()
         self.spatial_extent.print_info()
         self.spatial_extent.print_info()
         self.metadata.print_info()
         self.metadata.print_info()
-        datasets = self.get_registered_datasets()
+        datasets = self.get_registered_stds()
         count = 0
         count = 0
         string = ""
         string = ""
         if datasets is not None:
         if datasets is not None:
@@ -236,7 +236,7 @@ class AbstractMapDataset(AbstractDataset):
         self.temporal_extent.print_shell_info()
         self.temporal_extent.print_shell_info()
         self.spatial_extent.print_shell_info()
         self.spatial_extent.print_shell_info()
         self.metadata.print_shell_info()
         self.metadata.print_shell_info()
-        datasets = self.get_registered_datasets()
+        datasets = self.get_registered_stds()
         count = 0
         count = 0
         string = ""
         string = ""
         if datasets is not None:
         if datasets is not None:
@@ -875,7 +875,7 @@ class AbstractMapDataset(AbstractDataset):
         dbif, connected = init_dbif(dbif)
         dbif, connected = init_dbif(dbif)
 
 
         # Get all datasets in which this map is registered
         # Get all datasets in which this map is registered
-        datasets = self.get_registered_datasets(dbif)
+        datasets = self.get_registered_stds(dbif)
 
 
         # For each stds in which the map is registered
         # For each stds in which the map is registered
         if datasets is not None:
         if datasets is not None:
@@ -899,7 +899,7 @@ class AbstractMapDataset(AbstractDataset):
 
 
         return statement
         return statement
 
 
-    def get_registered_datasets(self, dbif=None):
+    def get_registered_stds(self, dbif=None):
         """!Return all space time dataset ids in which this map is registered
         """!Return all space time dataset ids in which this map is registered
            as as a list of strings, or None if this map is not
            as as a list of strings, or None if this map is not
            registered in any space time dataset.
            registered in any space time dataset.
@@ -923,7 +923,7 @@ class AbstractMapDataset(AbstractDataset):
 
 
         return datasets
         return datasets
 
 
-    def add_dataset_to_register(self, stds_id, dbif=None, execute=True):
+    def add_stds_to_register(self, stds_id, dbif=None, execute=True):
         """!Add a new space time dataset to the register
         """!Add a new space time dataset to the register
 
 
            @param stds_id The id of the space time dataset to be registered
            @param stds_id The id of the space time dataset to be registered
@@ -937,7 +937,7 @@ class AbstractMapDataset(AbstractDataset):
         """
         """
         dbif, connected = init_dbif(dbif=dbif)
         dbif, connected = init_dbif(dbif=dbif)
 
 
-        datasets = self.get_registered_datasets(dbif=dbif)
+        datasets = self.get_registered_stds(dbif=dbif)
 
 
         if stds_id is None or stds_id == "":
         if stds_id is None or stds_id == "":
             return ""
             return ""
@@ -969,7 +969,7 @@ class AbstractMapDataset(AbstractDataset):
         return statement
         return statement
 
 
 
 
-    def remove_dataset_from_register(self, stds_id, dbif=None, execute=True):
+    def remove_stds_from_register(self, stds_id, dbif=None, execute=True):
         """!Remove a space time dataset from the register
         """!Remove a space time dataset from the register
 
 
            @param stds_id The id of the space time dataset to removed from the registered
            @param stds_id The id of the space time dataset to removed from the registered
@@ -983,7 +983,7 @@ class AbstractMapDataset(AbstractDataset):
         """
         """
         dbif, connected = init_dbif(dbif)
         dbif, connected = init_dbif(dbif)
 
 
-        datasets = self.get_registered_datasets(dbif=dbif)
+        datasets = self.get_registered_stds(dbif=dbif)
 
 
         # Check if no datasets are present
         # Check if no datasets are present
         if datasets is None:
         if datasets is None:

+ 5 - 5
lib/python/temporal/abstract_space_time_dataset.py

@@ -1810,7 +1810,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                                          dbif=dbif)
                                          dbif=dbif)
 
 
             # Save the datasets that must be updated
             # Save the datasets that must be updated
-            datasets = map.get_registered_datasets(dbif)
+            datasets = map.get_registered_stds(dbif)
             if datasets:
             if datasets:
                 for dataset in datasets:
                 for dataset in datasets:
                     datatsets_to_modify[dataset] = dataset
                     datatsets_to_modify[dataset] = dataset
@@ -1882,8 +1882,8 @@ class AbstractSpaceTimeDataset(AbstractDataset):
         # We need to rename the space time dataset in the maps register table
         # We need to rename the space time dataset in the maps register table
         if maps:
         if maps:
             for map in maps:
             for map in maps:
-                map.remove_dataset_from_register(stds_id=old_ident, dbif=dbif)
-                map.add_dataset_to_register(stds_id=ident, dbif=dbif)
+                map.remove_stds_from_register(stds_id=old_ident, dbif=dbif)
+                map.add_stds_to_register(stds_id=ident, dbif=dbif)
 
 
         # Execute the accumulated statements
         # Execute the accumulated statements
         dbif.execute_transaction(statement)
         dbif.execute_transaction(statement)
@@ -2111,7 +2111,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             return False
             return False
 
 
         # Register the stds in the map stds register table column
         # Register the stds in the map stds register table column
-        statement += map.add_dataset_to_register(stds_id=self.base.get_id(),
+        statement += map.add_stds_to_register(stds_id=self.base.get_id(),
                                                  dbif=dbif, execute=False)
                                                  dbif=dbif, execute=False)
 
 
         # Now put the raster name in the stds map register table
         # Now put the raster name in the stds map register table
@@ -2179,7 +2179,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
         # Remove the space time dataset from the dataset register
         # Remove the space time dataset from the dataset register
         # We need to execute the statement here, otherwise the space time dataset will not be
         # We need to execute the statement here, otherwise the space time dataset will not be
         # removed correctly
         # removed correctly
-        map.remove_dataset_from_register(self.base.get_id(),
+        map.remove_stds_from_register(self.base.get_id(),
                                                       dbif=dbif, execute=True)
                                                       dbif=dbif, execute=True)
 
 
         # Remove the map from the space time dataset register
         # Remove the map from the space time dataset register

+ 12 - 5
lib/python/temporal/aggregation.py

@@ -102,7 +102,7 @@ def collect_map_names(sp, dbif, start, end, sampling):
 
 
 
 
 def aggregate_raster_maps(inputs, base, start, end, count, method,
 def aggregate_raster_maps(inputs, base, start, end, count, method,
-                          register_null, dbif):
+                          register_null, dbif,  offset=0):
     """!Aggregate a list of raster input maps with r.series
     """!Aggregate a list of raster input maps with r.series
 
 
        @param inputs The names of the raster maps to be aggregated
        @param inputs The names of the raster maps to be aggregated
@@ -117,12 +117,13 @@ def aggregate_raster_maps(inputs, base, start, end, count, method,
        @param register_null If true null maps will be registered in the space
        @param register_null If true null maps will be registered in the space
                             time raster dataset, if false not
                             time raster dataset, if false not
        @param dbif The temporal database interface to use
        @param dbif The temporal database interface to use
+       @param offset Offset to be added to the map counter to create the map ids
     """
     """
 
 
     msgr = get_tgis_message_interface()
     msgr = get_tgis_message_interface()
 
 
     msgr.verbose(_("Aggregate %s raster maps") % (len(inputs)))
     msgr.verbose(_("Aggregate %s raster maps") % (len(inputs)))
-    output = "%s_%i" % (base, count)
+    output = "%s_%i" % (base, int(offset) + count)
 
 
     mapset = get_current_mapset()
     mapset = get_current_mapset()
     map_id = output + "@" + mapset
     map_id = output + "@" + mapset
@@ -151,10 +152,16 @@ def aggregate_raster_maps(inputs, base, start, end, count, method,
         file.write(string)
         file.write(string)
 
 
     file.close()
     file.close()
+    
     # Run r.series
     # Run r.series
-    ret = core.run_command("r.series", flags="z", file=filename,
-                           output=output, overwrite=core.overwrite(),
-                           method=method)
+    if len(inputs) > 1000 :
+        ret = core.run_command("r.series", flags="z", file=filename,
+                               output=output, overwrite=core.overwrite(),
+                               method=method)
+    else:
+        ret = core.run_command("r.series", file=filename,
+                               output=output, overwrite=core.overwrite(),
+                               method=method)
 
 
     if ret != 0:
     if ret != 0:
         dbif.close()
         dbif.close()

+ 58 - 2
lib/python/temporal/c_libraries_interface.py

@@ -38,12 +38,49 @@ class RPCDefs(object):
     READ_MAP_INFO=5
     READ_MAP_INFO=5
     MAP_EXISTS=6
     MAP_EXISTS=6
     READ_MAP_INFO=7
     READ_MAP_INFO=7
+    AVAILABLE_MAPSETS = 8
 
 
     TYPE_RASTER=0
     TYPE_RASTER=0
     TYPE_RASTER3D=1
     TYPE_RASTER3D=1
     TYPE_VECTOR=2
     TYPE_VECTOR=2
 
 
 ###############################################################################
 ###############################################################################
+def available_mapsets(lock, conn, data):
+    """!Return all available mapsets the user can access as a list of strings
+    
+       @param lock A multiprocessing.Lock instance
+       @param conn A multiprocessing.Pipe instance used to send True or False
+       @param data The list of data entries [function_id]
+       
+       @return Names of available mapsets as list of strings
+    """
+    
+    mapsets = libgis.G_available_mapsets()
+
+    count = 0
+    mapset_list = []
+    while mapsets[count]:
+        char_list = ""
+        mapset = mapsets[count]
+        if libgis.G__mapset_permissions(mapset) > 0:
+            count += 1
+            c = 0
+            while mapset[c] != "\x00":
+                char_list += mapset[c]
+                c += 1
+                
+        mapset_list.append(char_list) 
+        
+    # We need to sort the mapset list, but the first one should be 
+    # the current mapset
+    current_mapset = libgis.G_mapset()
+    mapset_list.remove(current_mapset)
+    mapset_list.sort()
+    mapset_list.reverse()
+    mapset_list.append(current_mapset)
+    mapset_list.reverse()
+
+    conn.send(mapset_list) 
 
 
 def _has_timestamp(lock, conn, data):
 def _has_timestamp(lock, conn, data):
     """!Check if the file based GRASS timestamp is present and send
     """!Check if the file based GRASS timestamp is present and send
@@ -586,7 +623,7 @@ def c_library_server(lock, conn):
        @param conn A multiprocessing.Pipe
        @param conn A multiprocessing.Pipe
     """
     """
     # Crerate the function array
     # Crerate the function array
-    functions = [0]*8
+    functions = [0]*9
     functions[RPCDefs.STOP] = _stop
     functions[RPCDefs.STOP] = _stop
     functions[RPCDefs.HAS_TIMESTAMP] = _has_timestamp
     functions[RPCDefs.HAS_TIMESTAMP] = _has_timestamp
     functions[RPCDefs.WRITE_TIMESTAMP] = _write_timestamp
     functions[RPCDefs.WRITE_TIMESTAMP] = _write_timestamp
@@ -594,6 +631,7 @@ def c_library_server(lock, conn):
     functions[RPCDefs.REMOVE_TIMESTAMP] = _remove_timestamp
     functions[RPCDefs.REMOVE_TIMESTAMP] = _remove_timestamp
     functions[RPCDefs.READ_MAP_INFO] = _read_map_info
     functions[RPCDefs.READ_MAP_INFO] = _read_map_info
     functions[RPCDefs.MAP_EXISTS] = _map_exists
     functions[RPCDefs.MAP_EXISTS] = _map_exists
+    functions[RPCDefs.AVAILABLE_MAPSETS] = available_mapsets
 
 
     libgis.G_gisinit("c_library_server")
     libgis.G_gisinit("c_library_server")
     libgis.G_debug(1, "Start C-interface server")
     libgis.G_debug(1, "Start C-interface server")
@@ -643,7 +681,12 @@ class CLibrariesInterface(object):
        >>> grass.run_command("v.timestamp", map="test", date='12 Mar 1995 10:34:40', overwrite=True, quiet=True)
        >>> grass.run_command("v.timestamp", map="test", date='12 Mar 1995 10:34:40', overwrite=True, quiet=True)
        0
        0
 
 
-
+       # Check mapsets
+       >>> ciface = tgis.CLibrariesInterface()
+       >>> mapsets = ciface.available_mapsets()
+       >>> mapsets[0] == tgis.get_current_mapset()
+       True
+       
        # Raster map
        # Raster map
        >>> ciface = tgis.CLibrariesInterface()
        >>> ciface = tgis.CLibrariesInterface()
        >>> check = ciface.raster_map_exists("test", tgis.get_current_mapset())
        >>> check = ciface.raster_map_exists("test", tgis.get_current_mapset())
@@ -1031,6 +1074,19 @@ class CLibrariesInterface(object):
                                name, mapset, layer, timestring])
                                name, mapset, layer, timestring])
         return self.client_conn.recv()
         return self.client_conn.recv()
 
 
+    def available_mapsets(self):
+        """!Return all available mapsets the user can access as a list of strings
+        
+           @param lock A multiprocessing.Lock instance
+           @param conn A multiprocessing.Pipe instance used to send True or False
+           @param data Can be None
+           
+           @return Names of available mapsets as list of strings
+        """
+        self._check_restart_server()
+        self.client_conn.send([RPCDefs.AVAILABLE_MAPSETS, ])
+        return self.client_conn.recv()
+
     def stop(self):
     def stop(self):
         """!Stop the messenger server and close the pipe
         """!Stop the messenger server and close the pipe
         """
         """

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

@@ -152,7 +152,6 @@ def extract_dataset(input, output, type, where, expression, base, nprocs=1,
                     for proc in proc_list:
                     for proc in proc_list:
                         proc.join()
                         proc.join()
                         exitcodes += proc.exitcode
                         exitcodes += proc.exitcode
-
                     if exitcodes != 0:
                     if exitcodes != 0:
                         dbif.close()
                         dbif.close()
                         msgr.fatal(_("Error while computation"))
                         msgr.fatal(_("Error while computation"))
@@ -248,18 +247,18 @@ def extract_dataset(input, output, type, where, expression, base, nprocs=1,
 
 
 def run_mapcalc2d(expr):
 def run_mapcalc2d(expr):
     """Helper function to run r.mapcalc in parallel"""
     """Helper function to run r.mapcalc in parallel"""
-    return core.run_command("r.mapcalc", expression=expr,
-                            overwrite=core.overwrite(), quiet=True)
+    exit(core.run_command("r.mapcalc", expression=expr,
+                            overwrite=core.overwrite(), quiet=True))
 
 
 
 
 def run_mapcalc3d(expr):
 def run_mapcalc3d(expr):
     """Helper function to run r3.mapcalc in parallel"""
     """Helper function to run r3.mapcalc in parallel"""
-    return core.run_command("r3.mapcalc", expression=expr,
-                            overwrite=core.overwrite(), quiet=True)
+    exit(core.run_command("r3.mapcalc", expression=expr,
+                            overwrite=core.overwrite(), quiet=True))
 
 
 
 
 def run_vector_extraction(input, output, layer, type, where):
 def run_vector_extraction(input, output, layer, type, where):
     """Helper function to run r.mapcalc in parallel"""
     """Helper function to run r.mapcalc in parallel"""
-    return core.run_command("v.extract", input=input, output=output,
+    exit(core.run_command("v.extract", input=input, output=output,
                             layer=layer, type=type, where=where,
                             layer=layer, type=type, where=where,
-                            overwrite=core.overwrite(), quiet=True)
+                            overwrite=core.overwrite(), quiet=True))

+ 84 - 1
lib/python/temporal/list_stds.py

@@ -28,6 +28,83 @@ from open_stds import *
 
 
 ###############################################################################
 ###############################################################################
 
 
+def get_dataset_list(type,  temporal_type,  columns=None,  where=None,  order=None):
+    """! Return a list of time stamped maps or space time datasets of a specific temporal type
+         that are registred in the temporal database
+    
+         This method returns a dictionary, the keys are the available mapsets, 
+         the values are the rows from the SQL database query.
+
+        @param type The type of the datasets (strds, str3ds, stvds, rast, rast3d, vect)
+        @param temporal_type The temporal type of the datasets (absolute, relative)
+        @param columns A comma separated list of columns that will be selected
+        @param where A where statement for selected listing without "WHERE"
+        @param order A comma separated list of columns to order the
+                               datasets by category
+                      
+        @return A dictionary with the rows of the SQL query for each available mapset
+        
+        >>> import grass.temporal as tgis
+        >>> tgis.init()
+        >>> name = "list_stds_test"
+        >>> sp = tgis.open_new_space_time_dataset(name=name, type="strds", 
+        ... temporaltype="absolute", title="title", descr="descr", semantic="mean", dbif=None, overwrite=True)
+        >>> mapset = tgis.get_current_mapset()
+        >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name")
+        >>> rows =  stds_list[mapset]
+        >>> for row in rows:
+        ...     if row["name"] == name:
+        ...         print True
+        True
+        >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name,mapset", where="mapset = '%s'"%(mapset))
+        >>> rows =  stds_list[mapset]
+        >>> for row in rows:
+        ...     if row["name"] == name and row["mapset"] == mapset:
+        ...         print True
+        True
+        >>> check = sp.delete()
+    """
+    id = None
+    sp = dataset_factory(type, id)
+
+    dbif = SQLDatabaseInterfaceConnection()
+    dbif.connect()
+    
+    mapsets = get_tgis_c_library_interface().available_mapsets()
+    
+    result = {}
+    
+    for mapset in mapsets:
+        
+        if temporal_type == "absolute":
+            table = sp.get_type() + "_view_abs_time"
+        else:
+            table = sp.get_type() + "_view_rel_time"
+
+        if columns and columns.find("all") == -1:
+            sql = "SELECT " + str(columns) + " FROM " + table
+        else:
+            sql = "SELECT * FROM " + table
+
+        if where:
+            sql += " WHERE " + where
+            sql += " AND mapset = '%s'"%(mapset)
+        else:
+            sql += " WHERE mapset = '%s'"%(mapset)
+
+        if order:
+            sql += " ORDER BY " + order
+
+        dbif.cursor.execute(sql)
+        rows = dbif.cursor.fetchall()
+        
+        if rows:
+            result[mapset] = rows
+        
+    return result
+        
+###############################################################################
+
 def list_maps_of_stds(type, input, columns, order, where, separator, method, header, gran=None):
 def list_maps_of_stds(type, input, columns, order, where, separator, method, header, gran=None):
     """! List the maps of a space time dataset using diffetent methods
     """! List the maps of a space time dataset using diffetent methods
 
 
@@ -35,7 +112,7 @@ def list_maps_of_stds(type, input, columns, order, where, separator, method, hea
         @param input Name of a space time raster dataset
         @param input Name of a space time raster dataset
         @param columns A comma separated list of columns to be printed to stdout
         @param columns A comma separated list of columns to be printed to stdout
         @param order A comma separated list of columns to order the
         @param order A comma separated list of columns to order the
-                      space time dataset by category
+                      maps by category
         @param where A where statement for selected listing without "WHERE"
         @param where A where statement for selected listing without "WHERE"
                       e.g: start_time < "2001-01-01" and end_time > "2001-01-01"
                       e.g: start_time < "2001-01-01" and end_time > "2001-01-01"
         @param separator The field separator character between the columns
         @param separator The field separator character between the columns
@@ -185,3 +262,9 @@ def list_maps_of_stds(type, input, columns, order, where, separator, method, hea
                     print output
                     print output
     if connected:
     if connected:
         dbif.close()
         dbif.close()
+
+###############################################################################
+
+if __name__ == "__main__":
+    import doctest
+    doctest.testmod()

+ 22 - 22
lib/python/temporal/mapcalc.py

@@ -340,16 +340,16 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
 
 
 def _run_mapcalc2d(expr):
 def _run_mapcalc2d(expr):
     """Helper function to run r.mapcalc in parallel"""
     """Helper function to run r.mapcalc in parallel"""
-    return core.run_command("r.mapcalc", expression=expr,
-                            overwrite=core.overwrite(), quiet=True)
+    exit(core.run_command("r.mapcalc", expression=expr,
+                            overwrite=core.overwrite(), quiet=True))
 
 
 ###############################################################################
 ###############################################################################
 
 
 
 
 def _run_mapcalc3d(expr):
 def _run_mapcalc3d(expr):
     """Helper function to run r3.mapcalc in parallel"""
     """Helper function to run r3.mapcalc in parallel"""
-    return core.run_command("r3.mapcalc", expression=expr,
-                            overwrite=core.overwrite(), quiet=True)
+    exit(core.run_command("r3.mapcalc", expression=expr,
+                            overwrite=core.overwrite(), quiet=True))
 
 
 ###############################################################################
 ###############################################################################
 
 
@@ -427,55 +427,55 @@ def _parse_start_operators(expr, is_time_absolute, current):
 
 
     if expr.find("start_year()") >= 0:
     if expr.find("start_year()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         expr = expr.replace("start_year()", str(start.year))
         expr = expr.replace("start_year()", str(start.year))
 
 
     if expr.find("start_month()") >= 0:
     if expr.find("start_month()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         expr = expr.replace("start_month()", str(start.month))
         expr = expr.replace("start_month()", str(start.month))
 
 
     if expr.find("start_week()") >= 0:
     if expr.find("start_week()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         expr = expr.replace("start_week()", str(start.isocalendar()[1]))
         expr = expr.replace("start_week()", str(start.isocalendar()[1]))
 
 
     if expr.find("start_day()") >= 0:
     if expr.find("start_day()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         expr = expr.replace("start_day()", str(start.day))
         expr = expr.replace("start_day()", str(start.day))
 
 
     if expr.find("start_hour()") >= 0:
     if expr.find("start_hour()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         expr = expr.replace("start_hour()", str(start.hour))
         expr = expr.replace("start_hour()", str(start.hour))
 
 
     if expr.find("start_minute()") >= 0:
     if expr.find("start_minute()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         expr = expr.replace("start_minute()", str(start.minute))
         expr = expr.replace("start_minute()", str(start.minute))
 
 
     if expr.find("start_second()") >= 0:
     if expr.find("start_second()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         expr = expr.replace("start_second()", str(start.second))
         expr = expr.replace("start_second()", str(start.second))
 
 
     if expr.find("start_dow()") >= 0:
     if expr.find("start_dow()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         expr = expr.replace("start_dow()", str(start.isoweekday()))
         expr = expr.replace("start_dow()", str(start.isoweekday()))
 
 
     if expr.find("start_doy()") >= 0:
     if expr.find("start_doy()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("start_*")))
                          "time." % ("start_*")))
         year = datetime(start.year, 1, 1)
         year = datetime(start.year, 1, 1)
         delta = start - year
         delta = start - year
@@ -510,7 +510,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_year()") >= 0:
     if expr.find("end_year()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_year()", "null()")
             expr = expr.replace("end_year()", "null()")
@@ -519,7 +519,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_month()") >= 0:
     if expr.find("end_month()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_month()", "null()")
             expr = expr.replace("end_month()", "null()")
@@ -528,7 +528,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_week()") >= 0:
     if expr.find("end_week()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_week()", "null()")
             expr = expr.replace("end_week()", "null()")
@@ -537,7 +537,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_day()") >= 0:
     if expr.find("end_day()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_day()", "null()")
             expr = expr.replace("end_day()", "null()")
@@ -546,7 +546,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_hour()") >= 0:
     if expr.find("end_hour()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_hour()", "null()")
             expr = expr.replace("end_hour()", "null()")
@@ -555,7 +555,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_minute()") >= 0:
     if expr.find("end_minute()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_minute()", "null()")
             expr = expr.replace("end_minute()", "null()")
@@ -564,7 +564,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_second()") >= 0:
     if expr.find("end_second()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_second()", "null()")
             expr = expr.replace("end_second()", "null()")
@@ -573,7 +573,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_dow()") >= 0:
     if expr.find("end_dow()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_dow()", "null()")
             expr = expr.replace("end_dow()", "null()")
@@ -582,7 +582,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
 
 
     if expr.find("end_doy()") >= 0:
     if expr.find("end_doy()") >= 0:
         if not is_time_absolute:
         if not is_time_absolute:
-            msgr.fatal(_("The temporal operators <%s> supports only absolute"\
+            msgr.fatal(_("The temporal operators <%s> supports only absolute "\
                          "time." % ("end_*")))
                          "time." % ("end_*")))
         if not end:
         if not end:
             expr = expr.replace("end_doy()", "null()")
             expr = expr.replace("end_doy()", "null()")

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

@@ -243,7 +243,7 @@ def register_maps_in_space_time_dataset(
             map.select(dbif)
             map.select(dbif)
 
 
             # Save the datasets that must be updated
             # Save the datasets that must be updated
-            datasets = map.get_registered_datasets(dbif)
+            datasets = map.get_registered_stds(dbif)
             if datasets is not None:
             if datasets is not None:
                 for dataset in datasets:
                 for dataset in datasets:
                     if dataset != "":
                     if dataset != "":

+ 107 - 59
lib/python/temporal/space_time_datasets.py

@@ -51,6 +51,7 @@ class RasterDataset(AbstractMapDataset):
         >>> rmap.get_temporal_extent_as_tuple()
         >>> rmap.get_temporal_extent_as_tuple()
         (datetime.datetime(1999, 1, 15, 0, 0), None)
         (datetime.datetime(1999, 1, 15, 0, 0), None)
         >>> rmap.load()
         >>> rmap.load()
+        True
         >>> rmap.spatial_extent.print_info()
         >>> rmap.spatial_extent.print_info()
          +-------------------- Spatial extent ----------------------------------------+
          +-------------------- Spatial extent ----------------------------------------+
          | North:...................... 80.0
          | North:...................... 80.0
@@ -286,8 +287,17 @@ class RasterDataset(AbstractMapDataset):
                                              self.get_mapset())
                                              self.get_mapset())
 
 
     def load(self):
     def load(self):
-        """!Load all info from an existing raster map into the internal s
-           tructure"""
+        """!Load all info from an existing raster map into the internal structure
+            
+            This method checks first if the map exists, in case it exists
+            the metadata of the map is put into this object and True is returned.
+            
+            @return True is the map exists and the metadata was filled successfully
+                          and getting the data was successfull, False otherwise
+        """
+
+        if self.map_exists() is not True:
+            return False
 
 
         # Fill base information
         # Fill base information
         self.base.set_creator(str(getpass.getuser()))
         self.base.set_creator(str(getpass.getuser()))
@@ -295,27 +305,32 @@ class RasterDataset(AbstractMapDataset):
         kvp = self.ciface.read_raster_info(self.get_name(),
         kvp = self.ciface.read_raster_info(self.get_name(),
                                            self.get_mapset())
                                            self.get_mapset())
 
 
-        # Fill spatial extent
-        self.set_spatial_extent_from_values(north=kvp["north"],
-                                            south=kvp["south"],
-                                            east=kvp["east"],
-                                            west=kvp["west"])
+        if kvp:
+            # Fill spatial extent
+            self.set_spatial_extent_from_values(north=kvp["north"],
+                                                south=kvp["south"],
+                                                east=kvp["east"],
+                                                west=kvp["west"])
 
 
-        # Fill metadata
-        self.metadata.set_nsres(kvp["nsres"])
-        self.metadata.set_ewres(kvp["ewres"])
-        self.metadata.set_datatype(kvp["datatype"])
-        self.metadata.set_min(kvp["min"])
-        self.metadata.set_max(kvp["max"])
+            # Fill metadata
+            self.metadata.set_nsres(kvp["nsres"])
+            self.metadata.set_ewres(kvp["ewres"])
+            self.metadata.set_datatype(kvp["datatype"])
+            self.metadata.set_min(kvp["min"])
+            self.metadata.set_max(kvp["max"])
 
 
-        rows = int(kvp["rows"])
-        cols = int(kvp["cols"])
+            rows = int(kvp["rows"])
+            cols = int(kvp["cols"])
 
 
-        ncells = cols * rows
+            ncells = cols * rows
 
 
-        self.metadata.set_cols(cols)
-        self.metadata.set_rows(rows)
-        self.metadata.set_number_of_cells(ncells)
+            self.metadata.set_cols(cols)
+            self.metadata.set_rows(rows)
+            self.metadata.set_number_of_cells(ncells)
+            
+            return True
+
+        return False
 
 
 ###############################################################################
 ###############################################################################
 
 
@@ -352,6 +367,7 @@ class Raster3DDataset(AbstractMapDataset):
         >>> r3map.get_temporal_extent_as_tuple()
         >>> r3map.get_temporal_extent_as_tuple()
         (datetime.datetime(1999, 1, 15, 0, 0), None)
         (datetime.datetime(1999, 1, 15, 0, 0), None)
         >>> r3map.load()
         >>> r3map.load()
+        True
         >>> r3map.spatial_extent.print_info()
         >>> r3map.spatial_extent.print_info()
          +-------------------- Spatial extent ----------------------------------------+
          +-------------------- Spatial extent ----------------------------------------+
          | North:...................... 80.0
          | North:...................... 80.0
@@ -598,7 +614,17 @@ class Raster3DDataset(AbstractMapDataset):
                                                self.get_mapset())
                                                self.get_mapset())
 
 
     def load(self):
     def load(self):
-        """!Load all info from an existing raster3d map into the internal structure"""
+        """!Load all info from an existing 3d raster map into the internal structure
+            
+            This method checks first if the map exists, in case it exists
+            the metadata of the map is put into this object and True is returned.
+            
+            @return True is the map exists and the metadata was filled successfully
+                          and getting the data was successfull, False otherwise
+        """
+
+        if self.map_exists() is not True:
+            return False
 
 
         # Fill base information
         # Fill base information
         self.base.set_creator(str(getpass.getuser()))
         self.base.set_creator(str(getpass.getuser()))
@@ -607,28 +633,33 @@ class Raster3DDataset(AbstractMapDataset):
         kvp = self.ciface.read_raster3d_info(self.get_name(),
         kvp = self.ciface.read_raster3d_info(self.get_name(),
                                            self.get_mapset())
                                            self.get_mapset())
 
 
-        self.set_spatial_extent_from_values(north=kvp["north"], south=kvp["south"],
-                                east=kvp["east"], west=kvp["west"],
-                                top=kvp["top"], bottom=kvp["bottom"])
+        if kvp:
+            self.set_spatial_extent_from_values(north=kvp["north"], south=kvp["south"],
+                                    east=kvp["east"], west=kvp["west"],
+                                    top=kvp["top"], bottom=kvp["bottom"])
 
 
-        # Fill metadata
-        self.metadata.set_nsres(kvp["nsres"])
-        self.metadata.set_ewres(kvp["ewres"])
-        self.metadata.set_tbres(kvp["tbres"])
-        self.metadata.set_datatype(kvp["datatype"])
-        self.metadata.set_min(kvp["min"])
-        self.metadata.set_max(kvp["max"])
+            # Fill metadata
+            self.metadata.set_nsres(kvp["nsres"])
+            self.metadata.set_ewres(kvp["ewres"])
+            self.metadata.set_tbres(kvp["tbres"])
+            self.metadata.set_datatype(kvp["datatype"])
+            self.metadata.set_min(kvp["min"])
+            self.metadata.set_max(kvp["max"])
 
 
-        rows = int(kvp["rows"])
-        cols = int(kvp["cols"])
-        depths = int(kvp["depths"])
+            rows = int(kvp["rows"])
+            cols = int(kvp["cols"])
+            depths = int(kvp["depths"])
 
 
-        ncells = cols * rows * depths
+            ncells = cols * rows * depths
 
 
-        self.metadata.set_cols(cols)
-        self.metadata.set_rows(rows)
-        self.metadata.set_depths(depths)
-        self.metadata.set_number_of_cells(ncells)
+            self.metadata.set_cols(cols)
+            self.metadata.set_rows(rows)
+            self.metadata.set_depths(depths)
+            self.metadata.set_number_of_cells(ncells)
+            
+            return True
+
+        return False
 
 
 ###############################################################################
 ###############################################################################
 
 
@@ -665,6 +696,7 @@ class VectorDataset(AbstractMapDataset):
         >>> vmap.get_temporal_extent_as_tuple()
         >>> vmap.get_temporal_extent_as_tuple()
         (datetime.datetime(1999, 1, 15, 0, 0), None)
         (datetime.datetime(1999, 1, 15, 0, 0), None)
         >>> vmap.load()
         >>> vmap.load()
+        True
         >>> vmap.absolute_time.print_info()
         >>> vmap.absolute_time.print_info()
          +-------------------- Absolute time -----------------------------------------+
          +-------------------- Absolute time -----------------------------------------+
          | Start time:................. 1999-01-15 00:00:00
          | Start time:................. 1999-01-15 00:00:00
@@ -869,8 +901,19 @@ class VectorDataset(AbstractMapDataset):
 
 
 
 
     def load(self):
     def load(self):
-        """!Load all info from an existing vector map into the internal
-        structure"""
+
+        """!Load all info from an existing vector map into the internal structure
+            
+            This method checks first if the map exists, in case it exists
+            the metadata of the map is put into this object and True is returned.
+            
+            @return True is the map exists and the metadata was filled successfully
+                          and getting the data was successfull, False otherwise
+        """
+
+        if self.map_exists() is not True:
+            return False
+
 
 
         # Fill base information
         # Fill base information
         self.base.set_creator(str(getpass.getuser()))
         self.base.set_creator(str(getpass.getuser()))
@@ -880,25 +923,30 @@ class VectorDataset(AbstractMapDataset):
         kvp = self.ciface.read_vector_info(self.get_name(),
         kvp = self.ciface.read_vector_info(self.get_name(),
                                            self.get_mapset())
                                            self.get_mapset())
 
 
-        # Fill spatial extent
-        self.set_spatial_extent_from_values(north=kvp["north"], south=kvp["south"],
-                                east=kvp["east"], west=kvp["west"],
-                                top=kvp["top"], bottom=kvp["bottom"])
-
-        # Fill metadata
-        self.metadata.set_3d_info(kvp["map3d"])
-        self.metadata.set_number_of_points(kvp["points"])
-        self.metadata.set_number_of_lines(kvp["lines"])
-        self.metadata.set_number_of_boundaries(kvp["boundaries"])
-        self.metadata.set_number_of_centroids(kvp["centroids"])
-        self.metadata.set_number_of_faces(kvp["faces"])
-        self.metadata.set_number_of_kernels(kvp["kernels"])
-        self.metadata.set_number_of_primitives(kvp["primitives"])
-        self.metadata.set_number_of_nodes(kvp["nodes"])
-        self.metadata.set_number_of_areas(kvp["areas"])
-        self.metadata.set_number_of_islands(kvp["islands"])
-        self.metadata.set_number_of_holes(kvp["holes"])
-        self.metadata.set_number_of_volumes(kvp["volumes"])
+        if kvp:
+            # Fill spatial extent
+            self.set_spatial_extent_from_values(north=kvp["north"], south=kvp["south"],
+                                    east=kvp["east"], west=kvp["west"],
+                                    top=kvp["top"], bottom=kvp["bottom"])
+
+            # Fill metadata
+            self.metadata.set_3d_info(kvp["map3d"])
+            self.metadata.set_number_of_points(kvp["points"])
+            self.metadata.set_number_of_lines(kvp["lines"])
+            self.metadata.set_number_of_boundaries(kvp["boundaries"])
+            self.metadata.set_number_of_centroids(kvp["centroids"])
+            self.metadata.set_number_of_faces(kvp["faces"])
+            self.metadata.set_number_of_kernels(kvp["kernels"])
+            self.metadata.set_number_of_primitives(kvp["primitives"])
+            self.metadata.set_number_of_nodes(kvp["nodes"])
+            self.metadata.set_number_of_areas(kvp["areas"])
+            self.metadata.set_number_of_islands(kvp["islands"])
+            self.metadata.set_number_of_holes(kvp["holes"])
+            self.metadata.set_number_of_volumes(kvp["volumes"])
+            
+            return True
+
+        return False
 
 
 ###############################################################################
 ###############################################################################
 
 

+ 90 - 90
lib/python/temporal/temporal_extent.py

@@ -27,7 +27,7 @@ from base import *
 
 
 ###############################################################################
 ###############################################################################
 
 
-class AbstractTemporalExtent(SQLDatabaseInterface):
+class TemporalExtent(SQLDatabaseInterface):
     """!This is the abstract time base class for relative and absolute time objects
     """!This is the abstract time base class for relative and absolute time objects
 
 
         It abstract class implements the interface to absolute and relative time.
         It abstract class implements the interface to absolute and relative time.
@@ -42,7 +42,7 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
         @code
         @code
 
 
         >>> init()
         >>> init()
-        >>> A = AbstractTemporalExtent(table="raster_absolute_time",
+        >>> A = TemporalExtent(table="raster_absolute_time",
         ... ident="soil@PERMANENT", start_time=datetime(2001, 01, 01),
         ... ident="soil@PERMANENT", start_time=datetime(2001, 01, 01),
         ... end_time=datetime(2005,01,01) )
         ... end_time=datetime(2005,01,01) )
         >>> A.id
         >>> A.id
@@ -58,7 +58,7 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
         start_time=2001-01-01 00:00:00
         start_time=2001-01-01 00:00:00
         end_time=2005-01-01 00:00:00
         end_time=2005-01-01 00:00:00
         >>> # relative time
         >>> # relative time
-        >>> A = AbstractTemporalExtent(table="raster_absolute_time",
+        >>> A = TemporalExtent(table="raster_absolute_time",
         ... ident="soil@PERMANENT", start_time=0, end_time=1 )
         ... ident="soil@PERMANENT", start_time=0, end_time=1 )
         >>> A.id
         >>> A.id
         'soil@PERMANENT'
         'soil@PERMANENT'
@@ -95,14 +95,14 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=6 )
+           >>> A = TemporalExtent(start_time=5, end_time=6 )
            >>> inter = A.intersect(A)
            >>> inter = A.intersect(A)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 5
             | Start time:................. 5
             | End time:................... 6
             | End time:................... 6
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=6 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=7 )
+           >>> A = TemporalExtent(start_time=5, end_time=6 )
+           >>> B = TemporalExtent(start_time=5, end_time=7 )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 5
             | Start time:................. 5
@@ -112,8 +112,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 5
             | Start time:................. 5
             | End time:................... 6
             | End time:................... 6
 
 
-           >>> A = AbstractTemporalExtent(start_time=3, end_time=6 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=7 )
+           >>> A = TemporalExtent(start_time=3, end_time=6 )
+           >>> B = TemporalExtent(start_time=5, end_time=7 )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 5
             | Start time:................. 5
@@ -123,8 +123,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 5
             | Start time:................. 5
             | End time:................... 6
             | End time:................... 6
 
 
-           >>> A = AbstractTemporalExtent(start_time=3, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=6 )
+           >>> A = TemporalExtent(start_time=3, end_time=8 )
+           >>> B = TemporalExtent(start_time=5, end_time=6 )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 5
             | Start time:................. 5
@@ -134,8 +134,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 5
             | Start time:................. 5
             | End time:................... 6
             | End time:................... 6
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=6 )
+           >>> A = TemporalExtent(start_time=5, end_time=8 )
+           >>> B = TemporalExtent(start_time=3, end_time=6 )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 5
             | Start time:................. 5
@@ -145,8 +145,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 5
             | Start time:................. 5
             | End time:................... 6
             | End time:................... 6
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=None )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=6 )
+           >>> A = TemporalExtent(start_time=5, end_time=None )
+           >>> B = TemporalExtent(start_time=3, end_time=6 )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 5
             | Start time:................. 5
@@ -156,14 +156,14 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 5
             | Start time:................. 5
             | End time:................... None
             | End time:................... None
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=4 )
+           >>> A = TemporalExtent(start_time=5, end_time=8 )
+           >>> B = TemporalExtent(start_time=3, end_time=4 )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> print inter
            >>> print inter
            None
            None
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=None )
+           >>> A = TemporalExtent(start_time=5, end_time=8 )
+           >>> B = TemporalExtent(start_time=3, end_time=None )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> print inter
            >>> print inter
            None
            None
@@ -176,10 +176,10 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             return None
             return None
 
 
         if self.D["end_time"] is None:
         if self.D["end_time"] is None:
-            return AbstractTemporalExtent(start_time=self.D["start_time"])
+            return TemporalExtent(start_time=self.D["start_time"])
 
 
         if extent.D["end_time"] is None:
         if extent.D["end_time"] is None:
-            return AbstractTemporalExtent(start_time=extent.D["start_time"])
+            return TemporalExtent(start_time=extent.D["start_time"])
 
 
         start = None
         start = None
         end = None
         end = None
@@ -199,8 +199,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
                                           unit=self.get_unit())
                                           unit=self.get_unit())
         elif issubclass(type(self), AbsoluteTemporalExtent):
         elif issubclass(type(self), AbsoluteTemporalExtent):
             return AbsoluteTemporalExtent(start_time=start, end_time=end)
             return AbsoluteTemporalExtent(start_time=start, end_time=end)
-        elif issubclass(type(self), AbstractTemporalExtent):
-            return AbstractTemporalExtent(start_time=start, end_time=end)
+        elif issubclass(type(self), TemporalExtent):
+            return TemporalExtent(start_time=start, end_time=end)
 
 
     def disjoint_union(self, extent):
     def disjoint_union(self, extent):
         """!Creates a disjoint union with this temporal extent and the provided one.
         """!Creates a disjoint union with this temporal extent and the provided one.
@@ -213,14 +213,14 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=6 )
+           >>> A = TemporalExtent(start_time=5, end_time=6 )
            >>> inter = A.intersect(A)
            >>> inter = A.intersect(A)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 5
             | Start time:................. 5
             | End time:................... 6
             | End time:................... 6
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=6 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=7 )
+           >>> A = TemporalExtent(start_time=5, end_time=6 )
+           >>> B = TemporalExtent(start_time=5, end_time=7 )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 5
             | Start time:................. 5
@@ -230,8 +230,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 5
             | Start time:................. 5
             | End time:................... 7
             | End time:................... 7
 
 
-           >>> A = AbstractTemporalExtent(start_time=3, end_time=6 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=7 )
+           >>> A = TemporalExtent(start_time=3, end_time=6 )
+           >>> B = TemporalExtent(start_time=5, end_time=7 )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
@@ -241,8 +241,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 3
             | Start time:................. 3
             | End time:................... 7
             | End time:................... 7
 
 
-           >>> A = AbstractTemporalExtent(start_time=3, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=6 )
+           >>> A = TemporalExtent(start_time=3, end_time=8 )
+           >>> B = TemporalExtent(start_time=5, end_time=6 )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
@@ -252,8 +252,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 3
             | Start time:................. 3
             | End time:................... 8
             | End time:................... 8
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=6 )
+           >>> A = TemporalExtent(start_time=5, end_time=8 )
+           >>> B = TemporalExtent(start_time=3, end_time=6 )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
@@ -263,8 +263,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 3
             | Start time:................. 3
             | End time:................... 8
             | End time:................... 8
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=None )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=6 )
+           >>> A = TemporalExtent(start_time=5, end_time=None )
+           >>> B = TemporalExtent(start_time=3, end_time=6 )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
@@ -274,8 +274,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
             | Start time:................. 3
             | Start time:................. 3
             | End time:................... 6
             | End time:................... 6
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=4 )
+           >>> A = TemporalExtent(start_time=5, end_time=8 )
+           >>> B = TemporalExtent(start_time=3, end_time=4 )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
@@ -284,8 +284,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
             | End time:................... 8
             | End time:................... 8
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=None )
+           >>> A = TemporalExtent(start_time=5, end_time=8 )
+           >>> B = TemporalExtent(start_time=3, end_time=None )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
@@ -294,8 +294,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
             | End time:................... 8
             | End time:................... 8
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=None )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=8 )
+           >>> A = TemporalExtent(start_time=5, end_time=None )
+           >>> B = TemporalExtent(start_time=3, end_time=8 )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
@@ -304,8 +304,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
             | End time:................... 8
             | End time:................... 8
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=None )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=None )
+           >>> A = TemporalExtent(start_time=5, end_time=None )
+           >>> B = TemporalExtent(start_time=3, end_time=None )
            >>> inter = A.disjoint_union(B)
            >>> inter = A.disjoint_union(B)
            >>> inter.print_info()
            >>> inter.print_info()
             | Start time:................. 3
             | Start time:................. 3
@@ -384,8 +384,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
                                           unit=self.get_unit())
                                           unit=self.get_unit())
         elif issubclass(type(self), AbsoluteTemporalExtent):
         elif issubclass(type(self), AbsoluteTemporalExtent):
             return AbsoluteTemporalExtent(start_time=start, end_time=end)
             return AbsoluteTemporalExtent(start_time=start, end_time=end)
-        elif issubclass(type(self), AbstractTemporalExtent):
-            return AbstractTemporalExtent(start_time=start, end_time=end)
+        elif issubclass(type(self), TemporalExtent):
+            return TemporalExtent(start_time=start, end_time=end)
 
 
     def union(self, extent):
     def union(self, extent):
         """!Creates a union with this temporal extent and the provided one.
         """!Creates a union with this temporal extent and the provided one.
@@ -397,14 +397,14 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=4 )
+           >>> A = TemporalExtent(start_time=5, end_time=8 )
+           >>> B = TemporalExtent(start_time=3, end_time=4 )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> print inter
            >>> print inter
            None
            None
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=None )
+           >>> A = TemporalExtent(start_time=5, end_time=8 )
+           >>> B = TemporalExtent(start_time=3, end_time=None )
            >>> inter = A.intersect(B)
            >>> inter = A.intersect(B)
            >>> print inter
            >>> print inter
            None
            None
@@ -433,8 +433,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=6 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=7 )
+           >>> A = TemporalExtent(start_time=5, end_time=6 )
+           >>> B = TemporalExtent(start_time=5, end_time=7 )
            >>> A.starts(B)
            >>> A.starts(B)
            True
            True
            >>> B.starts(A)
            >>> B.starts(A)
@@ -465,8 +465,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=6 )
+           >>> A = TemporalExtent(start_time=5, end_time=7 )
+           >>> B = TemporalExtent(start_time=5, end_time=6 )
            >>> A.started(B)
            >>> A.started(B)
            True
            True
            >>> B.started(A)
            >>> B.started(A)
@@ -497,8 +497,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=6, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=7 )
+           >>> A = TemporalExtent(start_time=6, end_time=7 )
+           >>> B = TemporalExtent(start_time=5, end_time=7 )
            >>> A.finishes(B)
            >>> A.finishes(B)
            True
            True
            >>> B.finishes(A)
            >>> B.finishes(A)
@@ -529,8 +529,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=6, end_time=7 )
+           >>> A = TemporalExtent(start_time=5, end_time=7 )
+           >>> B = TemporalExtent(start_time=6, end_time=7 )
            >>> A.finished(B)
            >>> A.finished(B)
            True
            True
            >>> B.finished(A)
            >>> B.finished(A)
@@ -561,8 +561,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=8, end_time=9 )
-           >>> B = AbstractTemporalExtent(start_time=6, end_time=7 )
+           >>> A = TemporalExtent(start_time=8, end_time=9 )
+           >>> B = TemporalExtent(start_time=6, end_time=7 )
            >>> A.after(B)
            >>> A.after(B)
            True
            True
            >>> B.after(A)
            >>> B.after(A)
@@ -595,8 +595,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=6, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=8, end_time=9 )
+           >>> A = TemporalExtent(start_time=6, end_time=7 )
+           >>> B = TemporalExtent(start_time=8, end_time=9 )
            >>> A.before(B)
            >>> A.before(B)
            True
            True
            >>> B.before(A)
            >>> B.before(A)
@@ -632,14 +632,14 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=7, end_time=9 )
+           >>> A = TemporalExtent(start_time=5, end_time=7 )
+           >>> B = TemporalExtent(start_time=7, end_time=9 )
            >>> A.adjacent(B)
            >>> A.adjacent(B)
            True
            True
            >>> B.adjacent(A)
            >>> B.adjacent(A)
            True
            True
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=5 )
+           >>> A = TemporalExtent(start_time=5, end_time=7 )
+           >>> B = TemporalExtent(start_time=3, end_time=5 )
            >>> A.adjacent(B)
            >>> A.adjacent(B)
            True
            True
            >>> B.adjacent(A)
            >>> B.adjacent(A)
@@ -671,8 +671,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=3, end_time=5 )
+           >>> A = TemporalExtent(start_time=5, end_time=7 )
+           >>> B = TemporalExtent(start_time=3, end_time=5 )
            >>> A.follows(B)
            >>> A.follows(B)
            True
            True
            >>> B.follows(A)
            >>> B.follows(A)
@@ -703,8 +703,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=7, end_time=9 )
+           >>> A = TemporalExtent(start_time=5, end_time=7 )
+           >>> B = TemporalExtent(start_time=7, end_time=9 )
            >>> A.precedes(B)
            >>> A.precedes(B)
            True
            True
            >>> B.precedes(A)
            >>> B.precedes(A)
@@ -734,8 +734,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=4, end_time=9 )
+           >>> A = TemporalExtent(start_time=5, end_time=7 )
+           >>> B = TemporalExtent(start_time=4, end_time=9 )
            >>> A.during(B)
            >>> A.during(B)
            True
            True
            >>> B.during(A)
            >>> B.during(A)
@@ -776,8 +776,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=4, end_time=9 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=8 )
+           >>> A = TemporalExtent(start_time=4, end_time=9 )
+           >>> B = TemporalExtent(start_time=5, end_time=8 )
            >>> A.contains(B)
            >>> A.contains(B)
            True
            True
            >>> B.contains(A)
            >>> B.contains(A)
@@ -818,8 +818,8 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=6 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=6 )
+           >>> A = TemporalExtent(start_time=5, end_time=6 )
+           >>> B = TemporalExtent(start_time=5, end_time=6 )
            >>> A.equal(B)
            >>> A.equal(B)
            True
            True
            >>> B.equal(A)
            >>> B.equal(A)
@@ -856,15 +856,15 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=7 )
-           >>> B = AbstractTemporalExtent(start_time=6, end_time=8 )
+           >>> A = TemporalExtent(start_time=5, end_time=7 )
+           >>> B = TemporalExtent(start_time=6, end_time=8 )
            >>> A.overlaps(B)
            >>> A.overlaps(B)
            True
            True
            >>> B.overlaps(A)
            >>> B.overlaps(A)
            False
            False
 
 
-           >>> A = AbstractTemporalExtent(start_time=5, end_time=6 )
-           >>> B = AbstractTemporalExtent(start_time=6, end_time=8 )
+           >>> A = TemporalExtent(start_time=5, end_time=6 )
+           >>> B = TemporalExtent(start_time=6, end_time=8 )
            >>> A.overlaps(B)
            >>> A.overlaps(B)
            False
            False
            >>> B.overlaps(A)
            >>> B.overlaps(A)
@@ -897,15 +897,15 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 
 
            @code
            @code
 
 
-           >>> A = AbstractTemporalExtent(start_time=6, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=7 )
+           >>> A = TemporalExtent(start_time=6, end_time=8 )
+           >>> B = TemporalExtent(start_time=5, end_time=7 )
            >>> A.overlapped(B)
            >>> A.overlapped(B)
            True
            True
            >>> B.overlapped(A)
            >>> B.overlapped(A)
            False
            False
 
 
-           >>> A = AbstractTemporalExtent(start_time=6, end_time=8 )
-           >>> B = AbstractTemporalExtent(start_time=5, end_time=6 )
+           >>> A = TemporalExtent(start_time=6, end_time=8 )
+           >>> B = TemporalExtent(start_time=5, end_time=6 )
            >>> A.overlapped(B)
            >>> A.overlapped(B)
            False
            False
            >>> B.overlapped(A)
            >>> B.overlapped(A)
@@ -1046,25 +1046,25 @@ class AbstractTemporalExtent(SQLDatabaseInterface):
 ###############################################################################
 ###############################################################################
 
 
 
 
-class AbsoluteTemporalExtent(AbstractTemporalExtent):
+class AbsoluteTemporalExtent(TemporalExtent):
     """!This is the absolute time class for all maps and spacetime datasets
     """!This is the absolute time class for all maps and spacetime datasets
 
 
         start_time and end_time must be of type datetime
         start_time and end_time must be of type datetime
     """
     """
     def __init__(self, table=None, ident=None, start_time=None, end_time=None):
     def __init__(self, table=None, ident=None, start_time=None, end_time=None):
 
 
-        AbstractTemporalExtent.__init__(
+        TemporalExtent.__init__(
             self, table, ident, start_time, end_time)
             self, table, ident, start_time, end_time)
 
 
     def print_info(self):
     def print_info(self):
         """!Print information about this class in human readable style"""
         """!Print information about this class in human readable style"""
         #      0123456789012345678901234567890
         #      0123456789012345678901234567890
         print " +-------------------- Absolute time -----------------------------------------+"
         print " +-------------------- Absolute time -----------------------------------------+"
-        AbstractTemporalExtent.print_info(self)
+        TemporalExtent.print_info(self)
 
 
     def print_shell_info(self):
     def print_shell_info(self):
         """!Print information about this class in shell style"""
         """!Print information about this class in shell style"""
-        AbstractTemporalExtent.print_shell_info(self)
+        TemporalExtent.print_shell_info(self)
 
 
 ###############################################################################
 ###############################################################################
 
 
@@ -1212,7 +1212,7 @@ class STVDSAbsoluteTime(STDSAbsoluteTime):
 
 
 ###############################################################################
 ###############################################################################
 
 
-class RelativeTemporalExtent(AbstractTemporalExtent):
+class RelativeTemporalExtent(TemporalExtent):
     """!This is the relative time class for all maps and space time datasets
     """!This is the relative time class for all maps and space time datasets
 
 
         start_time and end_time must be of type integer
         start_time and end_time must be of type integer
@@ -1247,7 +1247,7 @@ class RelativeTemporalExtent(AbstractTemporalExtent):
     def __init__(self, table=None, ident=None, start_time=None, end_time=None,
     def __init__(self, table=None, ident=None, start_time=None, end_time=None,
                  unit=None):
                  unit=None):
 
 
-        AbstractTemporalExtent.__init__(
+        TemporalExtent.__init__(
             self, table, ident, start_time, end_time)
             self, table, ident, start_time, end_time)
         self.set_unit(unit)
         self.set_unit(unit)
 
 
@@ -1287,7 +1287,7 @@ class RelativeTemporalExtent(AbstractTemporalExtent):
         if self.D["unit"] != map.D["unit"]:
         if self.D["unit"] != map.D["unit"]:
             return None
             return None
 
 
-        return AbstractTemporalExtent.temporal_relation(self, map)
+        return TemporalExtent.temporal_relation(self, map)
 
 
     # Properties
     # Properties
     unit = property(fget=get_unit, fset=set_unit)
     unit = property(fget=get_unit, fset=set_unit)
@@ -1296,12 +1296,12 @@ class RelativeTemporalExtent(AbstractTemporalExtent):
         """!Print information about this class in human readable style"""
         """!Print information about this class in human readable style"""
         #      0123456789012345678901234567890
         #      0123456789012345678901234567890
         print " +-------------------- Relative time -----------------------------------------+"
         print " +-------------------- Relative time -----------------------------------------+"
-        AbstractTemporalExtent.print_info(self)
+        TemporalExtent.print_info(self)
         print " | Relative time unit:......... " + str(self.get_unit())
         print " | Relative time unit:......... " + str(self.get_unit())
 
 
     def print_shell_info(self):
     def print_shell_info(self):
         """!Print information about this class in shell style"""
         """!Print information about this class in shell style"""
-        AbstractTemporalExtent.print_shell_info(self)
+        TemporalExtent.print_shell_info(self)
         print "unit=" + str(self.get_unit())
         print "unit=" + str(self.get_unit())
 
 
 ###############################################################################
 ###############################################################################

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

@@ -301,7 +301,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
 
 
                         m = copy.deepcopy(self.m_mapcalc)
                         m = copy.deepcopy(self.m_mapcalc)
                         m_expression = newident + "=" + map_i.cmd_list
                         m_expression = newident + "=" + map_i.cmd_list
-                        m.inputs["expression"].value = m_expression
+                        m.inputs["expression"].value = str(m_expression)
                         m.flags["overwrite"].value = self.overwrite
                         m.flags["overwrite"].value = self.overwrite
                         process_queue.put(m)
                         process_queue.put(m)
                     else:
                     else:

+ 39 - 6
lib/python/temporal/unittests_temporal_raster_algebra.py

@@ -50,8 +50,42 @@ class TestRegisterFunctions(unittest.TestCase):
         tgis.register_maps_in_space_time_dataset(type="rast", name="C", maps="c1",
         tgis.register_maps_in_space_time_dataset(type="rast", name="C", maps="c1",
                                                  start="2001-01-02", increment="2 day", interval=True)
                                                  start="2001-01-02", increment="2 day", interval=True)
 
 
+
+    def test_temporal_conditional_time_dimension_bug(self):
+        """Testing the conditional time dimension bug, that uses the time 
+            dimension of the conditional statement instead the time dimension 
+            of the then/else statement."""
+        tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
+        tra.parse(expression="D = if({contains}, B == 5,  A - 1,  A + 1)", basename="d", overwrite=True)
+
+        D = tgis.open_old_space_time_dataset("D", type="strds")
+        D.select()
+        self.assertEqual(D.metadata.get_number_of_maps(), 4)
+        self.assertEqual(D.metadata.get_min_min(), 0) # 1 - 1
+        self.assertEqual(D.metadata.get_max_max(), 5) # 4 + 1
+        start, end = D.get_absolute_time()
+        self.assertEqual(start, datetime.datetime(2001, 1, 1))
+        self.assertEqual(end, datetime.datetime(2001, 1, 5))
+        self.assertEqual( D.check_temporal_topology(),  True)
+        self.assertEqual(D.get_granularity(),  u'1 day')
+
+    def test_simple_arith_hash_1(self):
+        """Simple arithmetic test including the hash operator"""
+        tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
+        tra.parse(expression='D = A + A{equal,=#}A', basename="d", overwrite=True)
+
+        D = tgis.open_old_space_time_dataset("D", type="strds")
+        D.select()
+        self.assertEqual(D.metadata.get_number_of_maps(), 4)
+        self.assertEqual(D.metadata.get_min_min(), 2)
+        self.assertEqual(D.metadata.get_max_max(), 5)
+        start, end = D.get_absolute_time()
+        self.assertEqual(start, datetime.datetime(2001, 1, 1))
+        self.assertEqual(end, datetime.datetime(2001, 1, 5))
+
+
     def test_simple_arith_td_1(self):
     def test_simple_arith_td_1(self):
-        """Simple arithmetic test with if condition"""
+        """Simple arithmetic test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra.parse(expression='D = A + td(A)', basename="d", overwrite=True)
         tra.parse(expression='D = A + td(A)', basename="d", overwrite=True)
 
 
@@ -64,9 +98,8 @@ class TestRegisterFunctions(unittest.TestCase):
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
 
 
-
     def test_simple_arith_td_2(self):
     def test_simple_arith_td_2(self):
-        """Simple arithmetic test with if condition"""
+        """Simple arithmetic test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra.parse(expression='D = A / td(A)', basename="d", overwrite=True)
         tra.parse(expression='D = A / td(A)', basename="d", overwrite=True)
 
 
@@ -80,7 +113,7 @@ class TestRegisterFunctions(unittest.TestCase):
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
 
 
     def test_simple_arith_td_3(self):
     def test_simple_arith_td_3(self):
-        """Simple arithmetic test with if condition"""
+        """Simple arithmetic test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra.parse(expression='D = A {equal,+} td(A)', basename="d", overwrite=True)
         tra.parse(expression='D = A {equal,+} td(A)', basename="d", overwrite=True)
 
 
@@ -95,7 +128,7 @@ class TestRegisterFunctions(unittest.TestCase):
 
 
 
 
     def test_simple_arith_td_4(self):
     def test_simple_arith_td_4(self):
-        """Simple arithmetic test with if condition"""
+        """Simple arithmetic test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra.parse(expression='D = A {equal,/} td(A)', basename="d", overwrite=True)
         tra.parse(expression='D = A {equal,/} td(A)', basename="d", overwrite=True)
 
 
@@ -187,7 +220,7 @@ class TestRegisterFunctions(unittest.TestCase):
         start, end = D.get_absolute_time()
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-
+        
     def test_temporal_intersection_1(self):
     def test_temporal_intersection_1(self):
         """Simple temporal intersection test"""
         """Simple temporal intersection test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)

+ 54 - 59
temporal/t.list/t.list.py

@@ -81,15 +81,15 @@
 
 
 import grass.script as grass
 import grass.script as grass
 import grass.temporal as tgis
 import grass.temporal as tgis
+import sys
 
 
 ############################################################################
 ############################################################################
 
 
-
 def main():
 def main():
 
 
     # Get the options
     # Get the options
     type = options["type"]
     type = options["type"]
-    temporaltype = options["temporaltype"]
+    temporal_type = options["temporaltype"]
     columns = options["columns"]
     columns = options["columns"]
     order = options["order"]
     order = options["order"]
     where = options["where"]
     where = options["where"]
@@ -99,69 +99,64 @@ def main():
     # Make sure the temporal database exists
     # Make sure the temporal database exists
     tgis.init()
     tgis.init()
 
 
-    id = None
-    sp = tgis.dataset_factory(type, id)
-
-    dbif = tgis.SQLDatabaseInterfaceConnection()
-    dbif.connect()
-    
+    sp = tgis.dataset_factory(type, None)
     first = True
     first = True
     
     
-    for ttype in temporaltype.split(","):
-    
-        # Create the sql selection statement
-        # Table name
+    sys.stderr.write("----------------------------------------------\n")
+
+    for ttype in temporal_type.split(","):
         if ttype == "absolute":
         if ttype == "absolute":
-            table = sp.get_type() + "_view_abs_time"
+            time = "absolute time"
         else:
         else:
-            table = sp.get_type() + "_view_rel_time"
-    
-        if columns.find("all") == -1:
-            sql = "SELECT " + str(columns) + " FROM " + table
-        else:
-            sql = "SELECT * FROM " + table
-    
-        if where:
-            sql += " WHERE " + where
-    
-        if order:
-            sql += " ORDER BY " + order
-    
-        dbif.cursor.execute(sql)
-        rows = dbif.cursor.fetchall()
-    
-        # Print the query result to stout
-        if rows:
-            if separator is None or separator == "":
-                separator = "\t"
-    
-            # Print the column names if requested
-            if colhead == True and first == True:
-                output = ""
-                count = 0
-                for key in rows[0].keys():
-                    if count > 0:
-                        output += separator + str(key)
-                    else:
-                        output += str(key)
-                    count += 1
-                print output
-                first = False
-    
-            for row in rows:
-                output = ""
-                count = 0
-                for col in row:
-                    if count > 0:
-                        output += separator + str(col)
+            time = "relative time"
+
+        stds_list = tgis.get_dataset_list(type,  ttype,  columns,  where,  order)
+
+        # Use the correct order of the mapsets, hence first the current mapset, then
+        # alphabetic ordering
+        mapsets = tgis.get_tgis_c_library_interface().available_mapsets()
+
+        # Print for each mapset separately
+        for key in mapsets:
+            if key in stds_list.keys():
+                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:
                     else:
-                        output += str(col)
-                    count += 1
-    
-                print output
+                        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 separator is None or separator == "":
+                        separator = "\t"
+            
+                    # Print the column names if requested
+                    if colhead == True and first == True:
+                        output = ""
+                        count = 0
+                        for key in rows[0].keys():
+                            if count > 0:
+                                output += separator + str(key)
+                            else:
+                                output += str(key)
+                            count += 1
+                        print output
+                        first = False
+            
+                    for row in rows:
+                        output = ""
+                        count = 0
+                        for col in row:
+                            if count > 0:
+                                output += separator + str(col)
+                            else:
+                                output += str(col)
+                            count += 1
+            
+                        print output
 
 
-    dbif.close()
-        
 if __name__ == "__main__":
 if __name__ == "__main__":
     options, flags = grass.parser()
     options, flags = grass.parser()
     main()
     main()

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

@@ -55,6 +55,15 @@
 #% answer: average
 #% answer: average
 #%end
 #%end
 
 
+#%option
+#% key: offset
+#% type: integer
+#% description: Offset that is used to create the output map ids, output map id is generated as: basename_ (count + offset)
+#% required: no
+#% multiple: no
+#% answer: 0
+#%end
+
 #%option G_OPT_T_SAMPLE
 #%option G_OPT_T_SAMPLE
 #%end
 #%end
 
 
@@ -80,6 +89,7 @@ def main():
     method = options["method"]
     method = options["method"]
     type = options["type"]
     type = options["type"]
     sampling = options["sampling"]
     sampling = options["sampling"]
+    offset = options["offset"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
     tgis.init()
     tgis.init()
@@ -125,7 +135,7 @@ def main():
         if input_map_names:
         if input_map_names:
             new_map = tgis.aggregate_raster_maps(input_map_names, base,
             new_map = tgis.aggregate_raster_maps(input_map_names, base,
                                                  start, end, count, method,
                                                  start, end, count, method,
-                                                 register_null, dbif)
+                                                 register_null, dbif,  offset)
 
 
             if new_map:
             if new_map:
                 # Set the time stamp and write it to the raster map
                 # Set the time stamp and write it to the raster map

+ 19 - 15
temporal/t.rast.aggregate.ds/test.t.rast.aggregate.ds.sh

@@ -1,21 +1,23 @@
 #!/bin/sh
 #!/bin/sh
 # Aggregate a dataset by a second one
 # Aggregate a dataset by a second one
 
 
+export GRASS_OVERWRITE=1
+
 # We need to set a specific region in the
 # We need to set a specific region in the
 # @preprocess step of this test. 
 # @preprocess step of this test. 
 # The region setting should work for UTM and LL test locations
 # The region setting should work for UTM and LL test locations
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 
 
-r.mapcalc --o expr="prec_1 = 100"
-r.mapcalc --o expr="prec_2 = 150"
-r.mapcalc --o expr="prec_3 = 250"
-r.mapcalc --o expr="prec_4 = 250"
-r.mapcalc --o expr="prec_5 = 150"
-r.mapcalc --o expr="prec_6 = 100"
+r.mapcalc expr="prec_1 = 100"
+r.mapcalc expr="prec_2 = 150"
+r.mapcalc expr="prec_3 = 250"
+r.mapcalc expr="prec_4 = 250"
+r.mapcalc expr="prec_5 = 150"
+r.mapcalc expr="prec_6 = 100"
 
 
-v.random --o -z output=soil_1 n=20 zmin=0 zmax=100 column=height
-v.random --o -z output=soil_2 n=20 zmin=0 zmax=100 column=height
-v.random --o -z output=soil_3 n=20 zmin=0 zmax=100 column=height
+v.random -z output=soil_1 n=20 zmin=0 zmax=100 column=height
+v.random -z output=soil_2 n=20 zmin=0 zmax=100 column=height
+v.random -z output=soil_3 n=20 zmin=0 zmax=100 column=height
 
 
 n1=`g.tempfile pid=1 -d` 
 n1=`g.tempfile pid=1 -d` 
 
 
@@ -25,15 +27,18 @@ soil_2|2001-05-01|2001-07-01
 soil_3|2001-08-01|2001-12-01
 soil_3|2001-08-01|2001-12-01
 EOF
 EOF
 
 
-t.create --o type=stvds temporaltype=absolute output=soil_abs1 title="A test" descr="A test"
+t.create type=stvds temporaltype=absolute output=soil_abs1 title="A test" descr="A test"
 t.register type=vect input=soil_abs1 file="${n1}"
 t.register type=vect input=soil_abs1 file="${n1}"
 
 
-t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
-t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-03-01 00:00:00" increment="1 months"
+t.create type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
+t.register -i type=rast input=precip_abs1 \
+    maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 \
+    start="2001-03-01 00:00:00" increment="1 months"
 
 
 # The @test
 # The @test
 
 
-t.rast.aggregate.ds --o --v input=precip_abs1 output=precip_abs2 base=prec_sum type=stvds sample=soil_abs1 method=sum sampling=start,during
+t.rast.aggregate.ds --v input=precip_abs1 output=precip_abs2 base=prec_sum \
+    type=stvds sample=soil_abs1 method=sum sampling=start,during offset=100
 t.info type=strds input=precip_abs2
 t.info type=strds input=precip_abs2
 t.rast.list input=precip_abs2 method=deltagap
 t.rast.list input=precip_abs2 method=deltagap
 
 
@@ -41,6 +46,5 @@ t.rast.list input=precip_abs2 method=deltagap
 t.unregister type=vect maps=soil_1,soil_2,soil_3
 t.unregister type=vect maps=soil_1,soil_2,soil_3
 t.remove type=stvds input=soil_abs1
 t.remove type=stvds input=soil_abs1
 
 
-t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
-t.remove type=strds input=precip_abs1,precip_abs2
+t.remove -rf type=strds input=precip_abs1,precip_abs2
 g.remove vect=soil_1,soil_2,soil_3
 g.remove vect=soil_1,soil_2,soil_3

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

@@ -54,6 +54,15 @@
 #% answer: average
 #% answer: average
 #%end
 #%end
 
 
+#%option
+#% key: offset
+#% type: integer
+#% description: Offset that is used to create the output map ids, output map id is generated as: basename_ (count + offset)
+#% required: no
+#% multiple: no
+#% answer: 0
+#%end
+
 #%option G_OPT_T_SAMPLE
 #%option G_OPT_T_SAMPLE
 #%end
 #%end
 
 
@@ -82,6 +91,7 @@ def main():
     register_null = flags["n"]
     register_null = flags["n"]
     method = options["method"]
     method = options["method"]
     sampling = options["sampling"]
     sampling = options["sampling"]
+    offset = options["offset"]
 
 
     # Make sure the temporal database exists
     # Make sure the temporal database exists
     tgis.init()
     tgis.init()
@@ -143,7 +153,7 @@ def main():
         if input_map_names:
         if input_map_names:
             new_map = tgis.aggregate_raster_maps(
             new_map = tgis.aggregate_raster_maps(
                 input_map_names, base, start, end,
                 input_map_names, base, start, end,
-                count, method, register_null, dbif)
+                count, method, register_null, dbif,  offset)
 
 
             if new_map:
             if new_map:
                 # Set the time stamp and write it to the raster map
                 # Set the time stamp and write it to the raster map

+ 23 - 15
temporal/t.rast.aggregate/test.t.rast.aggregate.sh

@@ -2,29 +2,37 @@
 # Space time raster dataset aggregation
 # Space time raster dataset aggregation
 # We need to set a specific region in the
 # We need to set a specific region in the
 # @preprocess step of this test. 
 # @preprocess step of this test. 
+
+export GRASS_OVERWRITE=1
+
 # The region setting should work for UTM and LL test locations
 # The region setting should work for UTM and LL test locations
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 # Generate data
 # Generate data
-r.mapcalc --o expr="prec_1 = rand(0, 550)"
-r.mapcalc --o expr="prec_2 = rand(0, 450)"
-r.mapcalc --o expr="prec_3 = rand(0, 320)"
-r.mapcalc --o expr="prec_4 = rand(0, 510)"
-r.mapcalc --o expr="prec_5 = rand(0, 300)"
-r.mapcalc --o expr="prec_6 = rand(0, 650)"
+r.mapcalc expr="prec_1 = rand(0, 550)"
+r.mapcalc expr="prec_2 = rand(0, 450)"
+r.mapcalc expr="prec_3 = rand(0, 320)"
+r.mapcalc expr="prec_4 = rand(0, 510)"
+r.mapcalc expr="prec_5 = rand(0, 300)"
+r.mapcalc expr="prec_6 = rand(0, 650)"
 
 
-t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
-t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-15 12:05:45" increment="14 days"
+t.create type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
+t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 \
+    start="2001-01-15 12:05:45" increment="14 days"
 
 
 # The first @test
 # The first @test
-
-t.rast.aggregate --o --v input=precip_abs1 output=precip_abs2 base=prec_sum granularity="2 days" method=average sampling=start,during
+t.rast.aggregate --v input=precip_abs1 output=precip_abs2 \
+    base=prec_sum granularity="2 days" method=average sampling=start,during
 t.info type=strds input=precip_abs2
 t.info type=strds input=precip_abs2
-t.rast.aggregate --o --v input=precip_abs1 output=precip_abs2 base=prec_sum granularity="1 months" method=maximum sampling=start,during
+t.rast.aggregate --v input=precip_abs1 output=precip_abs2 \
+    base=prec_sum granularity="1 months" method=maximum sampling=start,during
 t.info type=strds input=precip_abs2
 t.info type=strds input=precip_abs2
-t.rast.aggregate --o --v input=precip_abs1 output=precip_abs2 base=prec_sum granularity="2 months" method=minimum sampling=start,during
+t.rast.aggregate --v input=precip_abs1 output=precip_abs3 offset=10 \
+    base=prec_sum granularity="2 months" method=minimum sampling=start,during
 t.info type=strds input=precip_abs2
 t.info type=strds input=precip_abs2
-t.rast.aggregate --o --v input=precip_abs1 output=precip_abs2 base=prec_sum granularity="3 months" method=sum sampling=start,during
+t.rast.list input=precip_abs3
+t.rast.aggregate --v input=precip_abs1 output=precip_abs4 offset=100 \
+    base=prec_sum granularity="3 months" method=sum sampling=start,during
 t.info type=strds input=precip_abs2
 t.info type=strds input=precip_abs2
+t.rast.list input=precip_abs4
 
 
-t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
-t.remove type=strds input=precip_abs1,precip_abs2
+t.remove -rf type=strds input=precip_abs1,precip_abs2,precip_abs3,precip_abs4

+ 7 - 3
temporal/t.rast.extract/test.t.rast.extract.sh

@@ -26,8 +26,12 @@ t.rast.extract --o --v -n input=precip_abs1 output=precip_abs3 where="start_time
            expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec nprocs=4
            expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec nprocs=4
 t.info type=strds input=precip_abs3
 t.info type=strds input=precip_abs3
 
 
-t.rast.extract --o --v input=precip_abs1 output=precip_abs4 where="start_time > '2001-06-01'" 
+# Let the test fail
+g.remove rast=prec_1
+
+t.rast.extract --o --v input=precip_abs1 output=precip_abs4 \
+          where="start_time > '2001-01-01'" expr="precip_abs1/1.0"\
+          base=new_test
 t.info type=strds input=precip_abs4
 t.info type=strds input=precip_abs4
 
 
-t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
-t.remove type=strds input=precip_abs1,precip_abs2,precip_abs3,precip_abs4
+t.remove -rf type=strds input=precip_abs1,precip_abs2,precip_abs3

+ 7 - 4
temporal/t.rast.gapfill/test.t.rast.gapfill.sh

@@ -3,11 +3,14 @@
 # We need to set a specific region in the
 # We need to set a specific region in the
 # @preprocess step of this test. 
 # @preprocess step of this test. 
 # The region setting should work for UTM and LL test locations
 # The region setting should work for UTM and LL test locations
+
+export GRASS_OVERWRITE=1
+
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 
 
-r.mapcalc --o expr="prec_1 = 100"
-r.mapcalc --o expr="prec_2 = 300"
-r.mapcalc --o expr="prec_3 = 500"
+r.mapcalc  expr="prec_1 = 100"
+r.mapcalc  expr="prec_2 = 300"
+r.mapcalc  expr="prec_3 = 500"
 
 
 n1=`g.tempfile pid=1 -d` 
 n1=`g.tempfile pid=1 -d` 
 
 
@@ -17,7 +20,7 @@ prec_2|2001-03-01|2001-04-01
 prec_3|2001-05-01|2001-06-01
 prec_3|2001-05-01|2001-06-01
 EOF
 EOF
 
 
-t.create --v --o type=strds temporaltype=absolute output=precip_abs title="A test" descr="A test"
+t.create --v  type=strds temporaltype=absolute output=precip_abs title="A test" descr="A test"
 t.register --v type=rast input=precip_abs file="${n1}"
 t.register --v type=rast input=precip_abs file="${n1}"
 
 
 # @test
 # @test

+ 23 - 17
temporal/t.rast.mapcalc/test.t.rast.mapcalc.sh

@@ -1,49 +1,55 @@
 #!/bin/sh
 #!/bin/sh
 # Test for t.rast.mapcalc 
 # Test for t.rast.mapcalc 
 
 
+export GRASS_OVERWRITE=1
+
 # We need to set a specific region in the
 # We need to set a specific region in the
 # @preprocess step of this test. We generate
 # @preprocess step of this test. We generate
 # raster with r.mapcalc and create several space time raster datasets
 # raster with r.mapcalc and create several space time raster datasets
 # The region setting should work for UTM and LL test locations
 # The region setting should work for UTM and LL test locations
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 
 
-r.mapcalc --o expr="prec_1 = rand(0, 550)"
-r.mapcalc --o expr="prec_2 = rand(0, 450)"
-r.mapcalc --o expr="prec_3 = rand(0, 320)"
-r.mapcalc --o expr="prec_4 = rand(0, 510)"
-r.mapcalc --o expr="prec_5 = rand(0, 300)"
-r.mapcalc --o expr="prec_6 = rand(0, 650)"
+r.mapcalc expr="prec_1 = rand(0, 550)"
+r.mapcalc expr="prec_2 = rand(0, 450)"
+r.mapcalc expr="prec_3 = rand(0, 320)"
+r.mapcalc expr="prec_4 = rand(0, 510)"
+r.mapcalc expr="prec_5 = rand(0, 300)"
+r.mapcalc expr="prec_6 = rand(0, 650)"
 
 
-t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
-t.create --o type=strds temporaltype=absolute output=precip_abs2 title="A test" descr="A test"
-t.register -i --o type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 months"
-t.register --o type=rast input=precip_abs2 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.create type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
+t.create type=strds temporaltype=absolute output=precip_abs2 title="A test" descr="A test"
+t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 months"
+t.register type=rast input=precip_abs2 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 
 
 t.info precip_abs1
 t.info precip_abs1
 t.info precip_abs2
 t.info precip_abs2
 
 
 # The first @test
 # The first @test
-t.rast.mapcalc --o -n inputs=precip_abs1,precip_abs2 output=precip_abs3 \
+t.rast.mapcalc -n inputs=precip_abs1,precip_abs2 output=precip_abs3 \
            expression=" precip_abs1 + precip_abs2" base=new_prec \
            expression=" precip_abs1 + precip_abs2" base=new_prec \
            method=equal nprocs=5
            method=equal nprocs=5
 t.info type=strds input=precip_abs3
 t.info type=strds input=precip_abs3
 
 
-t.rast.mapcalc --o -s inputs=precip_abs1,precip_abs2,precip_abs3 output=precip_abs4 \
+t.rast.mapcalc -s inputs=precip_abs1,precip_abs2,precip_abs3 output=precip_abs4 \
            expression=" (precip_abs1 + precip_abs2) / precip_abs2" base=new_prec \
            expression=" (precip_abs1 + precip_abs2) / precip_abs2" base=new_prec \
            method=equal nprocs=5
            method=equal nprocs=5
 t.info type=strds input=precip_abs4
 t.info type=strds input=precip_abs4
 
 
-t.rast.mapcalc --o -s inputs=precip_abs1,precip_abs2 output=precip_abs4 \
+t.rast.mapcalc -s inputs=precip_abs1,precip_abs2 output=precip_abs4 \
            expression=" (precip_abs1 + precip_abs2) * null()" base=new_prec \
            expression=" (precip_abs1 + precip_abs2) * null()" base=new_prec \
            method=equal nprocs=5
            method=equal nprocs=5
 t.info type=strds input=precip_abs4
 t.info type=strds input=precip_abs4
 
 
-t.rast.mapcalc --o -sn inputs=precip_abs1,precip_abs2 output=precip_abs4 \
+t.rast.mapcalc -sn inputs=precip_abs1,precip_abs2 output=precip_abs4 \
            expression=" (precip_abs1 + precip_abs2) * null()" base=new_prec \
            expression=" (precip_abs1 + precip_abs2) * null()" base=new_prec \
            method=equal nprocs=5
            method=equal nprocs=5
 t.info type=strds input=precip_abs4
 t.info type=strds input=precip_abs4
 
 
+# Let the test fail
+g.remove rast=prec_1
+t.rast.mapcalc -sn inputs=precip_abs1,precip_abs2 output=precip_abs4 \
+           expression=" (precip_abs1 + precip_abs2) * null()" base=new_prec \
+           method=equal nprocs=5
+
 # @postprocess
 # @postprocess
-t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
-t.unregister type=rast maps=new_prec_1,new_prec_2,new_prec_3,new_prec_4,new_prec_5,new_prec_6
-t.remove type=strds input=precip_abs1,precip_abs2,precip_abs3,precip_abs4
+t.remove -rf type=strds input=precip_abs1,precip_abs2,precip_abs3,precip_abs4

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

@@ -135,7 +135,7 @@ def main():
         new_maps.append(new_map)
         new_maps.append(new_map)
 
 
         mod = copy.deepcopy(neighbor_module)
         mod = copy.deepcopy(neighbor_module)
-        mod(input=map.get_id(), output=new_map.get_id())
+        mod(input=str(map.get_id()), output=str(new_map.get_id()))
         print(mod.get_bash())
         print(mod.get_bash())
         process_queue.put(mod)
         process_queue.put(mod)
 
 

+ 26 - 24
temporal/t.register/test.t.register.raster.sh

@@ -4,6 +4,8 @@
 # The raster maps will be registered in different space time raster
 # The raster maps will be registered in different space time raster
 # datasets.
 # datasets.
 
 
+export GRASS_OVERWRITE=1
+
 # We need to set a specific region in the
 # We need to set a specific region in the
 # @preprocess step of this test. We generate
 # @preprocess step of this test. We generate
 # raster with r.mapcalc and create several space time raster datasets
 # raster with r.mapcalc and create several space time raster datasets
@@ -11,81 +13,81 @@
 # The region setting should work for UTM and LL test locations
 # The region setting should work for UTM and LL test locations
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
 
 
-r.mapcalc --o expr="prec_1 = rand(0, 550)"
-r.mapcalc --o expr="prec_2 = rand(0, 450)"
-r.mapcalc --o expr="prec_3 = rand(0, 320)"
-r.mapcalc --o expr="prec_4 = rand(0, 510)"
-r.mapcalc --o expr="prec_5 = rand(0, 300)"
-r.mapcalc --o expr="prec_6 = rand(0, 650)"
+r.mapcalc  expr="prec_1 = rand(0, 550)"
+r.mapcalc  expr="prec_2 = rand(0, 450)"
+r.mapcalc  expr="prec_3 = rand(0, 320)"
+r.mapcalc  expr="prec_4 = rand(0, 510)"
+r.mapcalc  expr="prec_5 = rand(0, 300)"
+r.mapcalc  expr="prec_6 = rand(0, 650)"
 
 
 # The first @test
 # The first @test
 # We create the space time raster inputs and register the raster maps with absolute time interval
 # We create the space time raster inputs and register the raster maps with absolute time interval
 
 
-t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
-t.create --o type=strds temporaltype=absolute output=precip_abs2 title="A test" descr="A test"
-t.create --o type=strds temporaltype=absolute output=precip_abs3 title="A test" descr="A test"
-t.create --o type=strds temporaltype=absolute output=precip_abs4 title="A test" descr="A test"
-t.create --o type=strds temporaltype=absolute output=precip_abs5 title="A test" descr="A test"
-t.create --o type=strds temporaltype=absolute output=precip_abs6 title="A test" descr="A test"
-t.create --o type=strds temporaltype=absolute output=precip_abs7 title="A test" descr="A test"
+t.create  type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
+t.create  type=strds temporaltype=absolute output=precip_abs2 title="A test" descr="A test"
+t.create  type=strds temporaltype=absolute output=precip_abs3 title="A test" descr="A test"
+t.create  type=strds temporaltype=absolute output=precip_abs4 title="A test" descr="A test"
+t.create  type=strds temporaltype=absolute output=precip_abs5 title="A test" descr="A test"
+t.create  type=strds temporaltype=absolute output=precip_abs6 title="A test" descr="A test"
+t.create  type=strds temporaltype=absolute output=precip_abs7 title="A test" descr="A test"
 
 
-t.register --o -i input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="1 seconds"
+t.register  -i input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="1 seconds"
 t.info type=strds input=precip_abs1
 t.info type=strds input=precip_abs1
 t.info -g type=strds input=precip_abs1
 t.info -g type=strds input=precip_abs1
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs1
 t.rast.list input=precip_abs1
 t.topology input=precip_abs1
 t.topology input=precip_abs1
 
 
-t.register --o -i input=precip_abs2 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="20 seconds, 5 minutes"
+t.register  -i input=precip_abs2 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="20 seconds, 5 minutes"
 t.info type=strds input=precip_abs2
 t.info type=strds input=precip_abs2
 t.info -g type=strds input=precip_abs2
 t.info -g type=strds input=precip_abs2
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs2
 t.rast.list input=precip_abs2
 t.topology input=precip_abs2
 t.topology input=precip_abs2
 
 
-t.register --o -i input=precip_abs3 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="8 hours"
+t.register  -i input=precip_abs3 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="8 hours"
 t.info -g type=strds input=precip_abs3
 t.info -g type=strds input=precip_abs3
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs3
 t.rast.list input=precip_abs3
 t.topology input=precip_abs3
 t.topology input=precip_abs3
 
 
-t.register --o input=precip_abs4 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 days"
+t.register  input=precip_abs4 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 days"
 t.info -g type=strds input=precip_abs4
 t.info -g type=strds input=precip_abs4
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs4
 t.rast.list input=precip_abs4
 t.topology input=precip_abs4
 t.topology input=precip_abs4
 
 
-t.register --o input=precip_abs5 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="4 weeks"
+t.register  input=precip_abs5 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="4 weeks"
 t.info -g type=strds input=precip_abs5
 t.info -g type=strds input=precip_abs5
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs5
 t.rast.list input=precip_abs5
 t.topology input=precip_abs5
 t.topology input=precip_abs5
 
 
-t.register --o input=precip_abs6 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-08-01" increment="2 months"
+t.register  input=precip_abs6 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-08-01" increment="2 months"
 t.info -g type=strds input=precip_abs6
 t.info -g type=strds input=precip_abs6
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs6
 t.rast.list input=precip_abs6
 t.topology input=precip_abs6
 t.topology input=precip_abs6
 
 
-t.register --o input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="20 years, 3 months, 1 days, 4 hours"
+t.register  input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="20 years, 3 months, 1 days, 4 hours"
 t.info -g type=strds input=precip_abs7
 t.info -g type=strds input=precip_abs7
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs7
 t.rast.list input=precip_abs7
 t.topology input=precip_abs7
 t.topology input=precip_abs7
 # Register with different valid time again
 # Register with different valid time again
-t.register --o input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="99 years, 9 months, 9 days, 9 hours"
+t.register  input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="99 years, 9 months, 9 days, 9 hours"
 t.info -g type=strds input=precip_abs7
 t.info -g type=strds input=precip_abs7
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs7
 t.rast.list input=precip_abs7
 t.topology input=precip_abs7
 t.topology input=precip_abs7
 # Register with different valid time again creating an interval
 # Register with different valid time again creating an interval
-t.register --o -i input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="99 years, 9 months, 9 days, 9 hours"
+t.register  -i input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="99 years, 9 months, 9 days, 9 hours"
 t.info -g type=strds input=precip_abs7
 t.info -g type=strds input=precip_abs7
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs7
 t.rast.list input=precip_abs7
 t.topology input=precip_abs7
 t.topology input=precip_abs7
 
 
-t.register --o input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" end="2002-01-01"
+t.register  input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" end="2002-01-01"
 t.info -g type=strds input=precip_abs7
 t.info -g type=strds input=precip_abs7
 r.info map=prec_1
 r.info map=prec_1
 t.rast.list input=precip_abs7
 t.rast.list input=precip_abs7
@@ -93,7 +95,7 @@ t.topology input=precip_abs7
 
 
 # Check for correct errors
 # Check for correct errors
 # Increment format error
 # Increment format error
-t.register -i --o input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="months"
+t.register -i  input=precip_abs7 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="months"
 
 
 
 
 t.unregister type=rast maps=prec_1,prec_2,prec_3
 t.unregister type=rast maps=prec_1,prec_2,prec_3

+ 2 - 0
temporal/t.select/test.t.select.sh

@@ -1,5 +1,7 @@
 #!/usr/bin/sh
 #!/usr/bin/sh
 
 
+export GRASS_OVERWRITE=1
+
 # Test for temporal algebra in LatLon location.
 # Test for temporal algebra in LatLon location.
 n1=`g.tempfile pid=1 -d`
 n1=`g.tempfile pid=1 -d`
 n2=`g.tempfile pid=2 -d`
 n2=`g.tempfile pid=2 -d`

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

@@ -130,7 +130,7 @@ def main():
             else:
             else:
                 # Delete the map from the temporal database
                 # Delete the map from the temporal database
                 # We need to update all effected space time datasets
                 # We need to update all effected space time datasets
-                datasets = map.get_registered_datasets(dbif)
+                datasets = map.get_registered_stds(dbif)
                 if datasets:
                 if datasets:
                     for dataset in datasets:
                     for dataset in datasets:
                         dataset_dict[dataset] = dataset
                         dataset_dict[dataset] = dataset

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

@@ -131,7 +131,7 @@ def main():
             else:
             else:
                 # We need to update all datasets after the removement of maps
                 # We need to update all datasets after the removement of maps
                 map.metadata.select(dbif)
                 map.metadata.select(dbif)
-                datasets = map.get_registered_datasets(dbif)
+                datasets = map.get_registered_stds(dbif)
                 # Store all unique dataset ids in a dictionary
                 # Store all unique dataset ids in a dictionary
                 if datasets:
                 if datasets:
                     for dataset in datasets:
                     for dataset in datasets: