[GRASS-SVN] r56823 - grass/trunk/lib/python/temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 20 06:02:29 PDT 2013


Author: lucadelu
Date: 2013-06-20 06:02:29 -0700 (Thu, 20 Jun 2013)
New Revision: 56823

Modified:
   grass/trunk/lib/python/temporal/abstract_map_dataset.py
   grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
   grass/trunk/lib/python/temporal/aggregation.py
   grass/trunk/lib/python/temporal/create.py
   grass/trunk/lib/python/temporal/extract.py
   grass/trunk/lib/python/temporal/mapcalc.py
   grass/trunk/lib/python/temporal/register.py
   grass/trunk/lib/python/temporal/stds_export.py
   grass/trunk/lib/python/temporal/stds_import.py
   grass/trunk/lib/python/temporal/univar_statistics.py
Log:
fix string format and PEP 8

Modified: grass/trunk/lib/python/temporal/abstract_map_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_map_dataset.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/abstract_map_dataset.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -20,27 +20,33 @@
 from abstract_dataset import *
 from datetime_math import *
 
+
 class AbstractMapDataset(AbstractDataset):
     """!This is the base class for all maps (raster, vector, raster3d).
-    
+
         The temporal extent, the spatial extent and the metadata of maps
-        are stored in the temporal database. Maps can be registered in the temporal
-        database, updated and deleted. 
-        
+        are stored in the temporal database. Maps can be registered in the
+        temporal database, updated and deleted.
+
         This class provides all functionalities that are needed to manage maps
         in the temporal database. That are:
-        - insert() to register the map and therefore its spatio-temporal extent and metadata in the temporal database
-        - update() to update the map spatio-temporal extent and metadata in the temporal database
-        - unregister() to unregister the map from each space time dataset in which this map is registered
+        - insert() to register the map and therefore its spatio-temporal extent
+                   and metadata in the temporal database
+        - update() to update the map spatio-temporal extent and metadata in the
+                   temporal database
+        - unregister() to unregister the map from each space time dataset in
+                       which this map is registered
         - delete() to remove the map from the temporal database
         - Methods to set relative and absolute time stamps
-        - Abstract methods that must be implemented in the map specific subclasses
+        - Abstract methods that must be implemented in the map specific
+          subclasses
     """
     def __init__(self):
         AbstractDataset.__init__(self)
 
     def get_new_stds_instance(self, ident):
-        """!Return a new space time dataset instance that store maps with the type of this map object (rast, rast3d or vect)
+        """!Return a new space time dataset instance that store maps with the
+           type of this map object (rast, rast3d or vect)
 
            @param ident The identifier of the space time dataset
            @return The new space time dataset instance
@@ -50,11 +56,11 @@
 
     def get_stds_register(self):
         """!Return the space time dataset register table name
-        
+
             Maps can be registered in several different space time datasets.
-            This method returns the name of the register table in the 
+            This method returns the name of the register table in the
             temporal database.
-            
+
             @return The name of the stds register table
         """
         raise ImplementationError(
@@ -63,7 +69,7 @@
     def set_stds_register(self, name):
         """!Set the space time dataset register table name.
 
-           This table stores all space time datasets in 
+           This table stores all space time datasets in
            which this map is registered.
 
            @param name The name of the register table
@@ -72,16 +78,17 @@
             "This method must be implemented in the subclasses")
 
     def check_resolution_with_current_region(self):
-        """!Check if the raster or voxel resolution is 
+        """!Check if the raster or voxel resolution is
            finer than the current resolution
-           
-           - Return "finer" in case the raster/voxel resolution is finer 
+
+           - Return "finer" in case the raster/voxel resolution is finer
              than the current region
-           - Return "coarser" in case the raster/voxel resolution is coarser 
+           - Return "coarser" in case the raster/voxel resolution is coarser
              than the current region
 
-           Vector maps have no resolution, since they store the coordinates directly.
-           
+           Vector maps have no resolution, since they store the coordinates
+           directly.
+
            @return "finer" or "coarser"
         """
         raise ImplementationError(
@@ -89,20 +96,21 @@
 
     def has_grass_timestamp(self):
         """!Check if a grass file based time stamp exists for this map.
-            @return True is the grass file based time stamped exists for this map
+            @return True is the grass file based time stamped exists for this
+                    map
         """
         raise ImplementationError(
             "This method must be implemented in the subclasses")
 
     def write_timestamp_to_grass(self):
-        """!Write the timestamp of this map into the map metadata 
+        """!Write the timestamp of this map into the map metadata
            in the grass file system based spatial database.
         """
         raise ImplementationError(
             "This method must be implemented in the subclasses")
 
     def remove_timestamp_from_grass(self):
-        """!Remove the timestamp from the grass file 
+        """!Remove the timestamp from the grass file
            system based spatial database
         """
         raise ImplementationError(
@@ -117,20 +125,20 @@
             "This method must be implemented in the subclasses")
 
     def read_info(self):
-        """!Read the map info from the grass file system based database and 
+        """!Read the map info from the grass file system based database and
            store the content into a dictionary
         """
         raise ImplementationError(
             "This method must be implemented in the subclasses")
 
     def load(self):
-        """!Load the content of this object from the grass 
+        """!Load the content of this object from the grass
            file system based database"""
         raise ImplementationError(
             "This method must be implemented in the subclasses")
 
     def _convert_timestamp(self):
-        """!Convert the valid time into a grass datetime library 
+        """!Convert the valid time into a grass datetime library
            compatible timestamp string
 
             This methods works for relative and absolute time
@@ -155,13 +163,13 @@
         return start
 
     def get_map_id(self):
-        """!Return the map id. The map id is the unique identifier 
+        """!Return the map id. The map id is the unique identifier
            in grass and must not be equal to the
-           primary key identifier (id) of the map in the database. 
+           primary key identifier (id) of the map in the database.
            Since vector maps may have layer information,
            the unique id is a combination of name, layer and mapset.
 
-           Use get_map_id() every time your need to access the grass map 
+           Use get_map_id() every time your need to access the grass map
            in the file system but not to identify
            map information in the temporal database.
 
@@ -172,15 +180,16 @@
     def build_id(self, name, mapset, layer=None):
         """!Convenient method to build the unique identifier
 
-            Existing layer and mapset definitions in the name 
+            Existing layer and mapset definitions in the name
             string will be reused
-           
+
            @param name The name of the map
            @param mapset The mapset in which the map is located
-           @param layer The layer of the vector map, use None in case no layer exists
+           @param layer The layer of the vector map, use None in case no
+                        layer exists
 
-           @return the id of the map as "name(:layer)@mapset" 
-                  while layer is optional
+           @return the id of the map as "name(:layer)@mapset"
+                   while layer is optional
         """
 
         # Check if the name includes any mapset
@@ -262,16 +271,19 @@
             self.print_topology_shell_info()
 
     def insert(self, dbif=None, execute=True):
-        """!Insert the map content into the database from the internal structure
+        """!Insert the map content into the database from the internal
+           structure
 
-           This functions assures that the timestamp is written to the 
-           grass file system based database in addition to the temporal database entry.
+           This functions assures that the timestamp is written to the
+           grass file system based database in addition to the temporal
+           database entry.
 
            @param dbif The database interface to be used
            @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are 
-                           returned and must be executed by the caller.
-            @return The SQL insert statement in case execute=False, or an empty string otherwise
+                          If False the prepared SQL statements are
+                          returned and must be executed by the caller.
+           @return The SQL insert statement in case execute=False, or an
+                   empty string otherwise
         """
         self.write_timestamp_to_grass()
         return AbstractDataset.insert(self, dbif, execute)
@@ -280,14 +292,16 @@
         """!Update the map content in the database from the internal structure
            excluding None variables
 
-           This functions assures that the timestamp is written to the 
-           grass file system based database in addition to the temporal database entry.
+           This functions assures that the timestamp is written to the
+           grass file system based database in addition to the temporal
+           database entry.
 
            @param dbif The database interface to be used
            @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are 
-                           returned and must be executed by the caller.
-            @return The SQL insert statement in case execute=False, or an empty string otherwise
+                          If False the prepared SQL statements are
+                          returned and must be executed by the caller.
+           @return The SQL insert statement in case execute=False, or an
+                   empty string otherwise
         """
         self.write_timestamp_to_grass()
         return AbstractDataset.update(self, dbif, execute)
@@ -296,14 +310,16 @@
         """!Update the map content in the database from the internal structure
            including None variables
 
-           This functions assures that the timestamp is written to the 
-           grass file system based database in addition to the temporal database entry.
+           This functions assures that the timestamp is written to the
+           grass file system based database in addition to the temporal
+           database entry.
 
            @param dbif The database interface to be used
            @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are 
-                           returned and must be executed by the caller.
-            @return The SQL insert statement in case execute=False, or an empty string otherwise
+                          If False the prepared SQL statements are
+                          returned and must be executed by the caller.
+            @return The SQL insert statement in case execute=False, or an
+                    empty string otherwise
         """
         self.write_timestamp_to_grass()
         return AbstractDataset.update_all(self, dbif, execute)
@@ -311,50 +327,56 @@
     def set_absolute_time(self, start_time, end_time=None, timezone=None):
         """!Set the absolute time with start time and end time
 
-            The end time is optional and must be set to None in case of time instance.
-        
+            The end time is optional and must be set to None in case of time
+            instance.
+
             This method only modifies this object and does not commit
             the modifications to the temporal database.
-            
-           @param start_time a datetime object specifying the start time of the map
-           @param end_time a datetime object specifying the end time of the map, None in case or time instance
+
+           @param start_time a datetime object specifying the start time of the
+                             map
+           @param end_time a datetime object specifying the end time of the
+                           map, None in case or time instance
            @param timezone Thee timezone of the map (not used)
         """
         if start_time and not isinstance(start_time, datetime):
             if self.get_layer() is not None:
-                core.fatal(_("Start time must be of type datetime "
-                             "for %s map <%s> with layer: %s") % \
-                           (self.get_type(), self.get_map_id(), 
-                            self.get_layer()))
+                core.fatal(_("Start time must be of type datetime for %(type)s"
+                             " map <%(id)s> with layer: %(l)s") % {
+                             'type': self.get_type(), 'id': self.get_map_id(), 
+                             'l': self.get_layer()})
             else:
-                core.fatal(_("Start time must be of type "
-                             "datetime ""for %s map <%s>") % \
-                           (self.get_type(), self.get_map_id()))
+                core.fatal(_("Start time must be of type datetime for "
+                             "%(type)s map <%(id)s>") % {
+                             'type': self.get_type(), 'id': self.get_map_id()})
 
         if end_time and not isinstance(end_time, datetime):
             if self.get_layer():
-                core.fatal(_("End time must be of type datetime "
-                             "for %s map <%s> with layer: %s") % \
-                           (self.get_type(), self.get_map_id(), 
-                            self.get_layer()))
+                core.fatal(_("End time must be of type datetime for %(type)s "
+                             "map <%(id)s> with layer: %(l)s") % {
+                             'type': self.get_type(), 'id': self.get_map_id(),
+                             'l': self.get_layer()})
             else:
-                core.fatal(_("End time must be of type datetime "
-                             "for %s map <%s>") % (self.get_type(), 
-                                                   self.get_map_id()))
+                core.fatal(_("End time must be of type datetime for "
+                             "%(type)s map <%(id)s>") % {
+                             'type': self.get_type(), 'id': self.get_map_id()})
 
         if start_time is not None and end_time is not None:
             if start_time > end_time:
                 if self.get_layer():
-                    core.fatal(_("End time must be greater than "
-                                 "start time for %s map <%s> with layer: %s") %\
-                                (self.get_type(), self.get_map_id(), 
-                                 self.get_layer()))
+                    core.fatal(_("End time must be greater than start time for"
+                                 " %(type)s map <%(id)s> with layer: %(l)s") % {
+                                 'type': self.get_type(),
+                                 'id': self.get_map_id(),
+                                 'l': self.get_layer()})
                 else:
-                    core.fatal(_("End time must be greater than "
-                                 "start time for %s map <%s>") % \
-                               (self.get_type(), self.get_map_id()))
+                    core.fatal(_("End time must be greater than start time "
+                                 "for %(type)s map <%(id)s>") % {
+                                 'type': self.get_type(),
+                                 'id': self.get_map_id()})
             else:
-                # Do not create an interval in case start and end time are equal
+                # Do not create an interval in case start and end time are
+                # equal
                 if start_time == end_time:
                     end_time = None
 
@@ -362,20 +384,24 @@
         self.absolute_time.set_start_time(start_time)
         self.absolute_time.set_end_time(end_time)
         self.absolute_time.set_timezone(timezone)
-        
+
         return True
 
-    def update_absolute_time(self, start_time, end_time=None, 
+    def update_absolute_time(self, start_time, end_time=None,
                              timezone=None, dbif=None):
         """!Update the absolute time
 
-            The end time is optional and must be set to None in case of time instance.
+           The end time is optional and must be set to None in case of time
+           instance.
 
-           This functions assures that the timestamp is written to the 
-           grass file system based database in addition to the temporal database entry.
-           
-           @param start_time a datetime object specifying the start time of the map
-           @param end_time a datetime object specifying the end time of the map, None in case or time instance
+           This functions assures that the timestamp is written to the
+           grass file system based database in addition to the temporal
+           database entry.
+
+           @param start_time a datetime object specifying the start time of
+                  the map
+           @param end_time a datetime object specifying the end time of the
+                  map, None in case or time instance
            @param timezone Thee timezone of the map (not used)
            @param dbif The database interface to be used
         """
@@ -392,16 +418,17 @@
 
     def set_relative_time(self, start_time, end_time, unit):
         """!Set the relative time interval
-        
-            The end time is optional and must be set to None in case of time instance.
-            
+
+            The end time is optional and must be set to None in case of time
+            instance.
+
             This method only modifies this object and does not commit
             the modifications to the temporal database.
 
            @param start_time An integer value
            @param end_time An integer value, None in case or time instance
-           @param unit The unit of the relative time. Supported units: 
-                        year(s), month(s), day(s), hour(s), minute(s), second(s)
+           @param unit The unit of the relative time. Supported units:
+                       year(s), month(s), day(s), hour(s), minute(s), second(s)
 
            @return True for success and False otherwise
 
@@ -409,31 +436,32 @@
 
         if not self.check_relative_time_unit(unit):
             if self.get_layer() is not None:
-                core.error(_("Unsupported relative time unit type for %s map "
-                             "<%s> with layer %s: %s") % (self.get_type(), 
-                                                          self.get_id(), 
-                                                          self.get_layer(), 
-                                                          unit))
+                core.error(_("Unsupported relative time unit type for %(type)s"
+                             " map <%(id)s> with layer %(l)s: %(u)s") % {
+                             'type': self.get_type(), 'id': self.get_id(),
+                             'l': self.get_layer(), 'u': unit})
             else:
-                core.error(_("Unsupported relative time unit type for %s map "
-                             "<%s>: %s") % (self.get_type(), self.get_id(), 
-                                            unit))
+                core.error(_("Unsupported relative time unit type for %(type)s"
+                             " map <%(id)s>: %(u)s") % {
+                             'type': self.get_type(), 'id': self.get_id(),
+                             'u': unit})
             return False
 
         if start_time is not None and end_time is not None:
             if int(start_time) > int(end_time):
                 if self.get_layer() is not None:
                     core.error(_("End time must be greater than start time for"
-                                 " %s map <%s> with layer %s") % \
-                               (self.get_type(), self.get_id(), 
-                                self.get_layer()))
+                                 " %(type)s map <%(id)s> with layer %(l)s") % \
+                                 {'type': self.get_type(), 'id': self.get_id(),
+                                  'l': self.get_layer()})
                 else:
                     core.error(_("End time must be greater than start time for"
-                                 " %s map <%s>") % (self.get_type(), 
-                                                    self.get_id()))
+                                 " %(type)s map <%(id)s>") % {
+                                 'type': self.get_type(), 'id': self.get_id()})
                 return False
             else:
-                # Do not create an interval in case start and end time are equal
+                # Do not create an interval in case start and end time are
+                # equal
                 if start_time == end_time:
                     end_time = None
 
@@ -451,10 +479,12 @@
     def update_relative_time(self, start_time, end_time, unit, dbif=None):
         """!Update the relative time interval
 
-            The end time is optional and must be set to None in case of time instance.
+           The end time is optional and must be set to None in case of time
+           instance.
 
-           This functions assures that the timestamp is written to the 
-           grass file system based database in addition to the temporal database entry.
+           This functions assures that the timestamp is written to the
+           grass file system based database in addition to the temporal
+           database entry.
 
            @param start_time An integer value
            @param end_time An integer value, None in case or time instance
@@ -474,19 +504,20 @@
 
     def temporal_buffer(self, increment, update=False, dbif=None):
         """!Create a temporal buffer based on an increment
-        
-           For absolute time the increment must be a string of type "integer unit"
-           Unit can be year, years, month, months, day, days, hour, hours, minute,
-           minutes, day or days.
-        
-           @param increment This is the increment, a string in case of absolute 
+
+           For absolute time the increment must be a string of type "integer
+           unit"
+           Unit can be year, years, month, months, day, days, hour, hours,
+           minute, minutes, day or days.
+
+           @param increment This is the increment, a string in case of absolute
                             time or an integer in case of relative time
-           @param update Perform an immediate database update to store the 
+           @param update Perform an immediate database update to store the
                          modified temporal extent, otherwise only this object
                          will be modified
-                         
+
            Usage:
-           
+
            @code
 
            >>> import grass.temporal as tgis
@@ -547,16 +578,16 @@
 
            @endcode
         """
-        
+
         if self.is_time_absolute():
             start, end, tz = self.get_absolute_time()
-            
+
             new_start = decrement_datetime_by_string(start, increment)
             if end == None:
                 new_end = increment_datetime_by_string(start, increment)
             else:
                 new_end = increment_datetime_by_string(end, increment)
-                
+
             if update:
                 self.update_absolute_time(new_start, new_end, tz, dbif=dbif)
             else:
@@ -573,13 +604,13 @@
                 self.update_relative_time(new_start, new_end, unit, dbif=dbif)
             else:
                 self.set_relative_time(new_start, new_end, unit)
-        
+
     def set_spatial_extent(self, north, south, east, west, top=0, bottom=0):
         """!Set the spatial extent of the map
 
             This method only modifies this object and does not commit
             the modifications to the temporal database.
-            
+
            @param north The northern edge
            @param south The southern edge
            @param east The eastern edge
@@ -601,10 +632,11 @@
             if end is not None:
                 if start >= end:
                     if self.get_layer() is not None:
-                        core.error(_("Map <%s> with layer %s has incorrect "
-                                     "time interval, start time is greater "
-                                     "than end time") % (self.get_map_id(), 
-                                                         self.get_layer()))
+                        core.error(_("Map <%(id)s> with layer %(layer)s has "
+                                     "incorrect time interval, start time is "
+                                     "greater than end time") % {
+                                     'id': self.get_map_id(),
+                                     'layer': self.get_layer()})
                     else:
                         core.error(_("Map <%s> has incorrect time interval, "
                                      "start time is greater than end time") % \
@@ -621,20 +653,21 @@
         """!Delete a map entry from database if it exists
 
             Remove dependent entries:
-            * Remove the map entry in each space time dataset in which this map 
+            * Remove the map entry in each space time dataset in which this map
               is registered
             * Remove the space time dataset register table
 
            @param dbif The database interface to be used
-           @param update Call for each unregister statement the update from 
-                          registered maps of the space time dataset. 
-                          This can slow down the un-registration process significantly.
-           @param execute If True the SQL DELETE and DROP table statements will 
+           @param update Call for each unregister statement the update from
+                          registered maps of the space time dataset.
+                          This can slow down the un-registration process
+                          significantly.
+           @param execute If True the SQL DELETE and DROP table statements will
                            be executed.
-                           If False the prepared SQL statements are 
+                           If False the prepared SQL statements are
                            returned and must be executed by the caller.
 
-           @return The SQL statements if execute=False, else an empty string, 
+           @return The SQL statements if execute=False, else an empty string,
                    None in case of a failure
         """
 
@@ -679,17 +712,17 @@
         return statement
 
     def unregister(self, dbif=None, update=True, execute=True):
-        """! Remove the map entry in each space time dataset in which this map 
+        """! Remove the map entry in each space time dataset in which this map
            is registered
 
            @param dbif The database interface to be used
-           @param update Call for each unregister statement the update from 
-                          registered maps of the space time dataset. This can 
-                          slow down the un-registration process significantly.
-           @param execute If True the SQL DELETE and DROP table statements 
-                           will be executed.
-                           If False the prepared SQL statements are 
-                           returned and must be executed by the caller.
+           @param update Call for each unregister statement the update from
+                         registered maps of the space time dataset. This can
+                         slow down the un-registration process significantly.
+           @param execute If True the SQL DELETE and DROP table statements
+                          will be executed.
+                          If False the prepared SQL statements are
+                          returned and must be executed by the caller.
 
            @return The SQL statements if execute=False, else an empty string
         """
@@ -736,12 +769,13 @@
         return statement
 
     def get_registered_datasets(self, dbif=None):
-        """!Return all space time dataset ids in which this map is registered as
-           dictionary like rows with column "id" or None if this map is not 
+        """!Return all space time dataset ids in which this map is registered
+           as dictionary like rows with column "id" or None if this map is not
            registered in any space time dataset.
 
            @param dbif The database interface to be used
-           @return The SQL rows with the ids of all space time datasets in which this map is registered
+           @return The SQL rows with the ids of all space time datasets in
+                   which this map is registered
         """
         dbif, connected = init_dbif(dbif)
 

Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -19,6 +19,7 @@
 
 ###############################################################################
 
+
 class AbstractSpaceTimeDataset(AbstractDataset):
     """!Abstract space time dataset class
 
@@ -27,9 +28,9 @@
        temporal database exists as well as functions to register or unregister
        raster maps.
 
-       Parts of the temporal logic are implemented in the SQL temporal database,
-       like the computation of the temporal and spatial extent as well as the
-       collecting of metadata.
+       Parts of the temporal logic are implemented in the SQL temporal
+       database, like the computation of the temporal and spatial extent as
+       well as the collecting of metadata.
     """
     def __init__(self, ident):
         AbstractDataset.__init__(self)
@@ -37,7 +38,7 @@
         self.map_counter = 0
 
     def get_new_map_instance(self, ident=None):
-        """!Return a new instance of a map which is associated 
+        """!Return a new instance of a map which is associated
            with the type of this object
 
            @param ident The unique identifier of the new object
@@ -46,16 +47,17 @@
             "This method must be implemented in the subclasses")
 
     def create_map_register_name(self):
-        """!Create the name of the map register table of this space time dataset
-        
-            The name, mapset and the map type are used to create the table name.
-            
-            ATTENTION: It must be assured that the base object has selected its 
+        """!Create the name of the map register table of this space time
+            dataset
+
+            The name, mapset and the map type are used to create the table name
+
+            ATTENTION: It must be assured that the base object has selected its
             content from the database.
-            
+
             @return The name of the map register table
         """
-        
+
         return self.base.get_name() + "_" + \
                 self.base.get_mapset() + "_" + \
                 self.get_new_map_instance(None).get_type() + "_register"
@@ -73,9 +75,9 @@
            This table stores all map names which are registered
            in this space time dataset.
 
-            This method only modifies this object and does not commit
-            the modifications to the temporal database.
-            
+           This method only modifies this object and does not commit
+           the modifications to the temporal database.
+
            @param name The name of the register table
         """
         raise ImplementationError(
@@ -120,18 +122,18 @@
     def set_initial_values(self, temporal_type, semantic_type,
                            title=None, description=None):
         """!Set the initial values of the space time dataset
-        
+
             In addition the command creation string is generated
             an inerted into the metadata object.
-            
+
             This method only modifies this object and does not commit
             the modifications to the temporal database.
-            
+
             The insert() function must be called to commit
             this content into the temporal database.
 
-           @param temporal_type The temporal type of this space 
-                                 time dataset (absolute or relative)
+           @param temporal_type The temporal type of this space
+                                time dataset (absolute or relative)
            @param semantic_type The semantic type of this dataset
            @param title The title
            @param description The description of this dataset
@@ -162,43 +164,43 @@
         command += self.create_command_string()
         self.metadata.set_command(command)
         self.metadata.update(dbif=dbif)
-        
+
     def create_command_string(self):
         """!Create the command string that was used to create this
            space time dataset.
-           
+
            The command string should be set with self.metadata.set_command()
-           
+
            @return The command string
            """
         # The grass module
-        
+
         command = "- %s -\n"%(str(datetime.today().strftime("%Y-%m-%d %H:%M:%S")))
         command += os.path.basename(sys.argv[0])
-        
+
         # We will wrap the command line to fit into 80 character
         length = len(command)
         for token in sys.argv[1:]:
-            
+
             # We need to remove specific characters
             token = token.replace("\'", " ")
             token = token.replace("\"", " ")
-            
+
             # Check for sub strings
             if token.find("=") > 0:
                 first = token.split("=")[0]
                 second = ""
-                
+
                 for t in token.split("=")[1:]:
                     second += t
 
-                token = "%s=\"%s\""%(first, second)
-            
+                token = "%s=\"%s\"" % (first, second)
+
             if length + len(token) >= 76:
-                command += "\n    %s"%(token)
+                command += "\n    %s" % (token)
                 length = len(token) + 4
             else:
-                command += " %s"%(token)
+                command += " %s" % (token)
                 length += len(token) + 1
 
         command += "\n"
@@ -211,7 +213,7 @@
         return self.base.get_semantic_type()
 
     def get_initial_values(self):
-        """!Return the initial values: temporal_type, 
+        """!Return the initial values: temporal_type,
            semantic_type, title, description"""
 
         temporal_type = self.get_temporal_type()
@@ -223,39 +225,41 @@
 
     def get_granularity(self):
         """!Return the granularity of the space time dataset
-        
+
            Granularity can be of absolute time or relative time.
            In case of absolute time a string containing an integer
-           value and the time unit (years, months, days, hours, minuts, seconds).
+           value and the time unit (years, months, days, hours, minuts,
+                                    seconds).
            In case of relative time an integer value is expected.
-           
-           @return The granularity 
+
+           @return The granularity
         """
 
         return self.temporal_extent.get_granularity()
 
     def set_granularity(self, granularity):
         """!Set the granularity
-        
-           The granularity is usually computed by the space time dataset at runtime.
-        
+
+           The granularity is usually computed by the space time dataset at
+           runtime.
+
            Granularity can be of absolute time or relative time.
            In case of absolute time a string containing an integer
-           value and the time unit (years, months, days, hours, minuts, seconds).
+           value and the time unit (years, months, days, hours, minuts,
+                                    seconds).
            In case of relative time an integer value is expected.
-           
+
            This method only modifies this object and does not commit
            the modifications to the temporal database.
-            
+
            @param granularity The granularity of the dataset
         """
 
         temporal_type = self.get_temporal_type()
-        
+
         check = check_granularity_string(granularity, temporal_type)
         if not check:
             core.fatal(_("Wrong granularity: \"%s\"") % str(granularity))
-        
 
         if temporal_type == "absolute":
             self.set_time_to_absolute()
@@ -263,19 +267,19 @@
             self.set_time_to_relative()
         else:
             core.fatal(_("Unknown temporal type \"%s\"") % (temporal_type))
-            
+
         self.temporal_extent.set_granularity(granularity)
 
     def set_relative_time_unit(self, unit):
-        """!Set the relative time unit which may be of type: 
+        """!Set the relative time unit which may be of type:
            years, months, days, hours, minutes or seconds
 
-           All maps registered in a (relative time) 
+           All maps registered in a (relative time)
            space time dataset must have the same unit
-           
-            This method only modifies this object and does not commit
-            the modifications to the temporal database.
-            
+
+           This method only modifies this object and does not commit
+           the modifications to the temporal database.
+
            @param unit The relative time unit
         """
 
@@ -287,7 +291,8 @@
             self.relative_time.set_unit(unit)
 
     def get_map_time(self):
-        """!Return the type of the map time, interval, point, mixed or invalid"""
+        """!Return the type of the map time, interval, point, mixed or invalid
+        """
 
         return self.temporal_extent.get_map_time()
 
@@ -297,7 +302,7 @@
            The map list must be ordered by start time
 
            The temporal type can be:
-           
+
            - point    -> only the start time is present
            - interval -> start and end time
            - invalid  -> No valid time point or interval found
@@ -358,15 +363,17 @@
 
         return gaps
 
-    def print_spatio_temporal_relationships(self, maps=None, spatial=None, dbif=None):
-        """!Print the spatio-temporal relationships for each map of the space time dataset
-           or for each map of the optional list of maps
+    def print_spatio_temporal_relationships(self, maps=None, spatial=None,
+                                            dbif=None):
+        """!Print the spatio-temporal relationships for each map of the space
+           time dataset or for each map of the optional list of maps
 
-           @param maps a ordered by start_time list of map objects, if None the registred
-                       maps of the space time dataset are used
-           @param spatial This indicates if the spatial topology is created as well:
-                          spatial can be None (no spatial topology), "2D" using west, east, 
-                          south, north or "3D" using west, east, south, north, bottom, top
+           @param maps a ordered by start_time list of map objects, if None the
+                       registred maps of the space time dataset are used
+           @param spatial This indicates if the spatial topology is created as
+                          well: spatial can be None (no spatial topology), "2D"
+                          using west, east, south, north or "3D" using west,
+                          east, south, north, bottom, top
            @param dbif The database interface to be used
         """
 
@@ -374,15 +381,15 @@
             maps = self.get_registered_maps_as_objects(
                 where=None, order="start_time", dbif=dbif)
 
-        print_spatio_temporal_topology_relationships(maps1=maps, maps2=maps, 
+        print_spatio_temporal_topology_relationships(maps1=maps, maps2=maps,
                                               spatial=spatial, dbif=dbif)
 
     def count_temporal_relations(self, maps=None, dbif=None):
         """!Count the temporal relations between the registered maps.
 
-           The map list must be ordered by start time. 
-           Temporal relations are counted by analysing the sparse 
-           upper right side temporal relationships matrix.
+           The map list must be ordered by start time.
+           Temporal relations are counted by analysing the sparse upper right
+           side temporal relationships matrix.
 
            @param maps A sorted (start_time) list of AbstractDataset objects
            @param dbif The database interface to be used
@@ -396,11 +403,11 @@
         return count_temporal_topology_relationships(maps)
 
     def check_temporal_topology(self, maps=None, dbif=None):
-        """!Check the temporal topology of all maps of the current space time dataset or
-           of an optional list of maps
+        """!Check the temporal topology of all maps of the current space time
+           dataset or of an optional list of maps
 
            Correct topology means, that time intervals are not overlap or
-           that intervals does not contain other intervals. 
+           that intervals does not contain other intervals.
            Equal time intervals  are not allowed.
 
            The optional map list must be ordered by start time
@@ -423,7 +430,8 @@
            - finished   -> not allowed
            @endverbatim
 
-           @param maps An optional list of AbstractDataset objects, in case of None all maps of the space time dataset are checked
+           @param maps An optional list of AbstractDataset objects, in case of
+                       None all maps of the space time dataset are checked
            @param dbif The database interface to be used
            @return True if topology is correct
         """
@@ -432,7 +440,7 @@
                 where=None, order="start_time", dbif=dbif)
 
         relations = count_temporal_topology_relationships(maps)
-        
+
         if relations == None:
             return False
 
@@ -466,22 +474,22 @@
         return True
 
     def sample_by_dataset(self, stds, method=None, spatial=False, dbif=None):
-        """!Sample this space time dataset with the temporal topology 
+        """!Sample this space time dataset with the temporal topology
            of a second space time dataset
 
-           The sample dataset must have "interval" as temporal map type, 
+           The sample dataset must have "interval" as temporal map type,
            so all sample maps have valid interval time.
 
-           In case spatial is True, the spatial overlap between 
+           In case spatial is True, the spatial overlap between
            temporal related maps is performed. Only
            temporal related and spatial overlapping maps are returned.
 
-           Return all registered maps as ordered (by start_time) object list with
-           "gap" map objects (id==None). Each list entry is a list of map objects
-           which are potentially located in temporal relation to the actual 
-           granule of the second space time dataset.
+           Return all registered maps as ordered (by start_time) object list
+           with "gap" map objects (id==None). Each list entry is a list of map
+           objects which are potentially located in temporal relation to the
+           actual granule of the second space time dataset.
 
-           Each entry in the object list is a dict. The actual sampler 
+           Each entry in the object list is a dict. The actual sampler
            map and its temporal extent (the actual granule) and
            the list of samples are stored:
 
@@ -496,23 +504,26 @@
                    map.print_info()
            @endcode
 
-           A valid temporal topology (no overlapping or inclusion allowed) 
-           is needed to get correct results in case of gaps in the sample dataset.
+           A valid temporal topology (no overlapping or inclusion allowed)
+           is needed to get correct results in case of gaps in the sample
+           dataset.
 
            Gaps between maps are identified as unregistered maps with id==None.
 
-           The objects are initialized with their id's' and the spatio-temporal extent 
-           (temporal type, start time, end time, west, east, south, north, bottom and top).
-           In case more map information are needed, use the select() 
+           The objects are initialized with their id's' and the spatio-temporal
+           extent (temporal type, start time, end time, west, east, south,
+           north, bottom and top).
+           In case more map information are needed, use the select()
            method for each listed object.
 
            @param stds The space time dataset to be used for temporal sampling
-           @param method This option specifies what sample method should be used. 
-                  In case the registered maps are of temporal point type,
-                  only the start time is used for sampling. In case of mixed 
-                  of interval data the user can chose between:
-                  
-                  - start: Select maps of which the start time is 
+           @param method This option specifies what sample method should be
+                         used. In case the registered maps are of temporal
+                         point type, only the start time is used for sampling.
+                         In case of mixed of interval data the user can chose
+                         between:
+
+                  - start: Select maps of which the start time is
                     located in the selection granule
                     @verbatim
                     map    :        s
@@ -525,14 +536,14 @@
                     granule:  s-----------------e
                     @endverbatim
 
-                  - during: Select maps which are temporal 
+                  - during: Select maps which are temporal
                     during the selection granule
                     @verbatim
                     map    :     s-----------e
                     granule:  s-----------------e
                     @endverbatim
 
-                  - overlap: Select maps which temporal overlap 
+                  - overlap: Select maps which temporal overlap
                     the selection granule
                     @verbatim
                     map    :     s-----------e
@@ -542,44 +553,45 @@
                     granule:  s----------e
                     @endverbatim
 
-                  - contain: Select maps which temporally contain 
+                  - contain: Select maps which temporally contain
                     the selection granule
                     @verbatim
                     map    :  s-----------------e
                     granule:     s-----------e
                     @endverbatim
 
-                  - equal: Select maps which temporally equal 
+                  - equal: Select maps which temporally equal
                     to the selection granule
                     @verbatim
                     map    :  s-----------e
                     granule:  s-----------e
                     @endverbatim
 
-                  - follows: Select maps which temporally follow 
+                  - follows: Select maps which temporally follow
                     the selection granule
                     @verbatim
                     map    :              s-----------e
                     granule:  s-----------e
                     @endverbatim
 
-                  - precedes: Select maps which temporally precedes 
+                  - precedes: Select maps which temporally precedes
                     the selection granule
                     @verbatim
                     map    :  s-----------e
                     granule:              s-----------e
                     @endverbatim
 
-                  All these methods can be combined. Method must be of 
+                  All these methods can be combined. Method must be of
                   type tuple including the identification strings.
-                  
-           @param spatial If set True additional the spatial overlapping 
-                           is used for selection -> spatio-temporal relation.
-                           The returned map objects will have temporal and 
-                           spatial extents
+
+           @param spatial If set True additional the spatial overlapping
+                          is used for selection -> spatio-temporal relation.
+                          The returned map objects will have temporal and
+                          spatial extents
            @param dbif The database interface to be used
 
-           @return A list of lists of map objects or None in case nothing was found None
+           @return A list of lists of map objects or None in case nothing was
+                   found None
         """
 
         use_start = False
@@ -623,7 +635,8 @@
                          "dataset must be interval"))
             return None
 
-        # In case points of time are available, disable the interval specific methods
+        # In case points of time are available, disable the interval specific
+        # methods
         if self.get_map_time() == "point":
             use_start = True
             use_during = False
@@ -646,8 +659,8 @@
             start, end = granule.get_temporal_extent_as_tuple()
 
             where = create_temporal_relation_sql_where_statement(
-                start, end, use_start,
-                use_during, use_overlap, use_contain, use_equal, use_follows, use_precedes)
+                    start, end, use_start, use_during, use_overlap,
+                    use_contain, use_equal, use_follows, use_precedes)
 
             maps = self.get_registered_maps_as_objects(
                 where, "start_time", dbif)
@@ -690,63 +703,65 @@
 
         return obj_list
 
-    def get_registered_maps_as_objects_by_granularity(self, gran=None, dbif=None):
-        """!Return all registered maps as ordered (by start_time) object list with
-           "gap" map objects (id==None) for spatio-temporal topological operations 
-           that require the temporal extent only.
-           
+    def get_registered_maps_as_objects_by_granularity(self, gran=None,
+                                                      dbif=None):
+        """!Return all registered maps as ordered (by start_time) object list
+           with "gap" map objects (id==None) for spatio-temporal topological
+           operations that require the temporal extent only.
+
            Each list entry is a list of map objects
            which are potentially located in the actual granule.
-           
-           The granularity of the space time dataset is used as increment in case 
-           the granule is not user defined.
 
-           A valid temporal topology (no overlapping or inclusion allowed) 
+           The granularity of the space time dataset is used as increment in
+           case the granule is not user defined.
+
+           A valid temporal topology (no overlapping or inclusion allowed)
            is needed to get correct results.
-           
-           Space time datasets with interval time, time instances and mixed time 
-           are supported.
 
+           Space time datasets with interval time, time instances and mixed
+           time are supported.
+
            Gaps between maps are identified as unregistered maps with id==None.
 
-           The objects are initialized with their id's' and the spatio-temporal extent 
-           (temporal type, start time, end time, west, east, south, north, bottom and top).
-           In case more map information are needed, use the select() 
+           The objects are initialized with their id's' and the spatio-temporal
+           extent (temporal type, start time, end time, west, east, south,
+           north, bottom and top).
+           In case more map information are needed, use the select()
            method for each listed object.
 
-           @param gran The granularity string to be used, if None the granularity of 
-                        the space time dataset is used.
-                        Absolute time has
-                        the format "number unit", relative time has the format "number". 
-                        The unit in case of absolute time can be one of "second, seconds,
-                        minute, minutes, hour, hours, day, days, week, weeks, month, months,
-                        year, years". The unit of the relative time granule is always the 
-                        space time dataset unit and can not be changed.
+           @param gran The granularity string to be used, if None the
+                       granularity of the space time dataset is used.
+                       Absolute time has the format "number unit", relative
+                       time has the format "number".
+                       The unit in case of absolute time can be one of "second,
+                       seconds, minute, minutes, hour, hours, day, days, week,
+                       weeks, month, months, year, years". The unit of the
+                       relative time granule is always the space time dataset
+                       unit and can not be changed.
            @param dbif The database interface to be used
 
            @return ordered object list, or None in case nothing found
         """
 
-        
         dbif, connected = init_dbif(dbif)
 
         obj_list = []
-        
+
         if gran is None:
             gran = self.get_granularity()
-        
+
         check = check_granularity_string(gran, self.get_temporal_type())
         if not check:
             core.fatal(_("Wrong granularity: \"%s\"") % str(gran))
 
         start, end = self.get_temporal_extent_as_tuple()
-        
+
         if start is None or end is None:
             return None
-        
+
         # Time instances and mixed time
         is_irregular = False
-        
+
         # We need to adjust the end time in case the the dataset has no
         # interval time, so we can catch time instances at the end
         if self.get_map_time() != "interval":
@@ -763,7 +778,8 @@
             else:
                 next = start + gran
 
-            # First we search for intervals that are are equal the granule or contain it
+            # First we search for intervals that are are equal the granule or
+            # contain it
             where = create_temporal_relation_sql_where_statement(
                     start=start, end=next, use_start=False, use_during=False,
                     use_overlap=False, use_contain=True, use_equal=True,
@@ -771,24 +787,24 @@
             rows = self.get_registered_maps("id", where, "start_time", dbif)
 
             found_gap = False
-            
+
             if rows is not None and len(rows) != 0:
                 if len(rows) > 1:
                     core.warning(_("More than one map found in a granule. "
-                                   "Temporal granularity seems to be invalid or"
-                                   " the chosen granularity is not a greatest "
-                                   "common divider of all intervals and gaps "
-                                   "in the dataset."))
+                                   "Temporal granularity seems to be invalid "
+                                   "or the chosen granularity is not a "
+                                   "greatest common divider of all intervals "
+                                   "and gaps in the dataset."))
 
                 maplist = []
                 for row in rows:
-                    
+
                     map = self.get_new_map_instance(row["id"])
 
                     if self.is_time_absolute():
                         map.set_absolute_time(start, next)
                     elif self.is_time_relative():
-                        map.set_relative_time(start, next, 
+                        map.set_relative_time(start, next,
                                               self.get_relative_time_unit())
 
                     maplist.append(copy.copy(map))
@@ -797,24 +813,26 @@
             else:
                 # We may found a gap or a gap after a time instance
                 found_gap = True
-                
-                # Searching for time instances and intervals that are during the 
-                # current granule or overlapping it
+
+                # Searching for time instances and intervals that are during
+                # the current granule or overlapping it
                 where = create_temporal_relation_sql_where_statement(
                         start=start, end=next, use_start=True, use_during=True,
                         use_overlap=True, use_contain=False, use_equal=False,
                         use_follows=False, use_precedes=False)
-                        
-                rows = self.get_registered_maps("id,start_time,end_time", where, "start_time", dbif)
-    
+
+                rows = self.get_registered_maps("id,start_time,end_time",
+                                                where, "start_time", dbif)
+
                 if rows is not None and len(rows) != 0:
-                    # No gap if we found something in the granule with intervaltime
+                    # No gap if we found something in the granule with
+                    # intervaltime
                     if len(rows) > 1:
                         core.warning(_("More than one map found in a granule. "
-                                       "Temporal granularity seems to be invalid or"
-                                       " the chosen granularity is not a greatest "
-                                       "common divider of all time instances "
-                                       "in the dataset."))
+                                       "Temporal granularity seems to be "
+                                       "invalid or the chosen granularity is "
+                                       "not a greatest common divider of all "
+                                       "time instances in the dataset."))
 
                     maplist = []
                     count = 0
@@ -823,33 +841,32 @@
                             if row["end_time"] is not None or row["start_time"] != start:
                                 found_gap = False
                         count += 1
-                        
+
                         map = self.get_new_map_instance(row["id"])
-    
+
                         if self.is_time_absolute():
                             if row["end_time"] is not None or row["start_time"] != start:
                                 map.set_absolute_time(start, next)
                             else:
                                 map.set_absolute_time(start, None)
                         elif self.is_time_relative():
-                            
                             if row["end_time"] is not None or row["start_time"] != start:
-                                map.set_relative_time(start, next, 
-                                                  self.get_relative_time_unit())
+                                map.set_relative_time(start, next,
+                                                 self.get_relative_time_unit())
                             else:
-                                map.set_relative_time(start, None, 
-                                                  self.get_relative_time_unit())
-    
+                                map.set_relative_time(start, None,
+                                                 self.get_relative_time_unit())
+
                         maplist.append(copy.copy(map))
-    
+
                     obj_list.append(copy.copy(maplist))
-                    
-                # In case of irregular time (point, mixed) the last granule 
+
+                # In case of irregular time (point, mixed) the last granule
                 # does not belong to the dataset and will be ignored
                 if is_irregular:
                     if next == end:
                         found_gap = False
-            
+
             # Gap handling
             if found_gap:
                 # Append a map object with None as id to indicate a gap
@@ -858,39 +875,39 @@
                 if self.is_time_absolute():
                     map.set_absolute_time(start, next)
                 elif self.is_time_relative():
-                    map.set_relative_time(start, next, 
-                                         self.get_relative_time_unit())
+                    map.set_relative_time(start, next,
+                                          self.get_relative_time_unit())
 
                 maplist = []
                 maplist.append(copy.copy(map))
 
                 obj_list.append(copy.copy(maplist))
-	
+
             start = next
 
         if connected:
             dbif.close()
-            
 
         if obj_list:
             return obj_list
         return None
 
     def get_registered_maps_as_objects_with_gaps(self, where=None, dbif=None):
-        """!Return all or a subset of the registered maps as 
+        """!Return all or a subset of the registered maps as
            ordered (by start_time) object list with
-           "gap" map objects (id==None) for spatio-temporal topological operations 
-           that require the spatio-temporal extent only.
+           "gap" map objects (id==None) for spatio-temporal topological
+           operations that require the spatio-temporal extent only.
 
            Gaps between maps are identified as maps with id==None
 
-           The objects are initialized with their id's' and the spatio-temporal extent 
-           (temporal type, start time, end time, west, east, south, north, bottom and top).
-           In case more map information are needed, use the select() 
+           The objects are initialized with their id's' and the spatio-temporal
+           extent (temporal type, start time, end time, west, east, south,
+           north, bottom and top).
+           In case more map information are needed, use the select()
            method for each listed object.
 
-           @param where The SQL where statement to select a 
-                         subset of the registered maps without "WHERE"
+           @param where The SQL where statement to select a
+                        subset of the registered maps without "WHERE"
            @param dbif The database interface to be used
 
            @return ordered object list, in case nothing found None is returned
@@ -922,8 +939,8 @@
                         if self.is_time_absolute():
                             map.set_absolute_time(start, end)
                         elif self.is_time_relative():
-                            map.set_relative_time(start, end, 
-                                                  self.get_relative_time_unit())
+                            map.set_relative_time(start, end,
+                                                 self.get_relative_time_unit())
                         obj_list.append(copy.copy(map))
 
         if connected:
@@ -931,22 +948,24 @@
 
         return obj_list
 
-    def get_registered_maps_as_objects_with_temporal_topology(self, where=None, order="start_time", 
-                                       dbif=None):
-        """!Return all or a subset of the registered maps as ordered object list with 
-           spatio-temporal topological relationship informations.
+    def get_registered_maps_as_objects_with_temporal_topology(self, where=None,
+                                                            order="start_time",
+                                                            dbif=None):
+        """!Return all or a subset of the registered maps as ordered object
+           list with spatio-temporal topological relationship informations.
 
-           The objects are initialized with their id's' and the spatio-temporal extent 
-           (temporal type, start time, end time, west, east, south, north, bottom and top).
-           In case more map information are needed, use the select() 
+           The objects are initialized with their id's' and the spatio-temporal
+           extent (temporal type, start time, end time, west, east, south,
+           north, bottom and top).
+           In case more map information are needed, use the select()
            method for each listed object.
 
-           @param where The SQL where statement to select a subset of 
-                         the registered maps without "WHERE"
-           @param order The SQL order statement to be used to order the 
-                         objects in the list without "ORDER BY"
+           @param where The SQL where statement to select a subset of
+                        the registered maps without "WHERE"
+           @param order The SQL order statement to be used to order the
+                        objects in the list without "ORDER BY"
            @param dbif The database interface to be used
-           @return The ordered map object list, 
+           @return The ordered map object list,
                    In case nothing found None is returned
         """
 
@@ -955,28 +974,30 @@
 
         tb = SpatioTemporalTopologyBuilder()
         tb.build(obj_list)
-    
+
         if connected:
             dbif.close()
 
         return obj_list
 
-    def get_registered_maps_as_objects(self, where=None, order="start_time", 
+    def get_registered_maps_as_objects(self, where=None, order="start_time",
                                        dbif=None):
-        """!Return all or a subset of the registered maps as ordered object list for 
-           spatio-temporal topological operations that require the spatio-temporal extent only
+        """!Return all or a subset of the registered maps as ordered object
+           list for spatio-temporal topological operations that require the
+           spatio-temporal extent only
 
-           The objects are initialized with their id's' and the spatio-temporal extent 
-           (temporal type, start time, end time, west, east, south, north, bottom and top).
-           In case more map information are needed, use the select() 
+           The objects are initialized with their id's' and the spatio-temporal
+           extent (temporal type, start time, end time, west, east, south,
+           north, bottom and top).
+           In case more map information are needed, use the select()
            method for each listed object.
 
-           @param where The SQL where statement to select a subset of 
+           @param where The SQL where statement to select a subset of
                          the registered maps without "WHERE"
-           @param order The SQL order statement to be used to order the 
+           @param order The SQL order statement to be used to order the
                          objects in the list without "ORDER BY"
            @param dbif The database interface to be used
-           @return The ordered map object list, 
+           @return The ordered map object list,
                    In case nothing found None is returned
         """
 
@@ -990,17 +1011,17 @@
         has_bt_columns = True
         try:
             rows = self.get_registered_maps(
-                "id,start_time,end_time, west,east,south,north,bottom,top", 
+                "id,start_time,end_time, west,east,south,north,bottom,top",
                 where, order, dbif)
         except:
             try:
                 dbif.rollback()
-                rows = self.get_registered_maps(
-                    "id,start_time,end_time", 
-                    where, order, dbif)
+                rows = self.get_registered_maps("id,start_time,end_time",
+                                                where, order, dbif)
                 has_bt_columns = False
-                core.warning(_("Old temporal database format. The top and bottom column"\
-                               " is missing in the views, using a work around."))
+                core.warning(_("Old temporal database format. The top and "\
+                               "bottom column is missing in the views, using"\
+                               "a work around."))
             except:
                 raise
 
@@ -1015,12 +1036,13 @@
                 # The fast way
                 if has_bt_columns:
                     map.set_spatial_extent(west=row["west"], east=row["east"],
-                    south=row["south"],north=row["north"], bottom=row["bottom"],
-                    top=row["top"])
+                                           south=row["south"], top=row["top"],
+                                           north=row["north"],
+                                           bottom=row["bottom"])
                 # The slow work around
                 else:
                     map.spatial_extent.select(dbif)
-                    
+
                 obj_list.append(copy.copy(map))
 
         if connected:
@@ -1028,20 +1050,21 @@
 
         return obj_list
 
-    def get_registered_maps(self, columns=None, where=None, order=None, dbif=None):
+    def get_registered_maps(self, columns=None, where=None, order=None,
+                            dbif=None):
         """!Return SQL rows of all registered maps.
 
-           In case columns are not specified, each row includes all columns 
+           In case columns are not specified, each row includes all columns
            specified in the datatype specific view.
 
            @param columns Columns to be selected as SQL compliant string
-           @param where The SQL where statement to select a subset 
-                         of the registered maps without "WHERE"
-           @param order The SQL order statement to be used to order the 
-                         objects in the list without "ORDER BY"
+           @param where The SQL where statement to select a subset
+                        of the registered maps without "WHERE"
+           @param order The SQL order statement to be used to order the
+                        objects in the list without "ORDER BY"
            @param dbif The database interface to be used
 
-           @return SQL rows of all registered maps, 
+           @return SQL rows of all registered maps,
                    In case nothing found None is returned
         """
 
@@ -1088,14 +1111,15 @@
     @staticmethod
     def shift_map_list(maps, gran):
         """!Temporally shift each map in the list with the provided granularity
-        
+
            This method does not perform any temporal database operations.
-           
+
            @param maps A list of maps  with initialized temporal extent
            @param gran The granularity to be used for shifting
-           @return The modified map list, None if nothing to shift or wrong granularity
+           @return The modified map list, None if nothing to shift or wrong
+                   granularity
            @code
-           
+
            >>> import grass.temporal as tgis
            >>> maps = []
            >>> for i in range(5):
@@ -1157,9 +1181,9 @@
             return None
 
         if not check_granularity_string(gran, maps[-1].get_temporal_type()):
-            core.error(_("Wrong granularity format: %s"%(gran)))
+            core.error(_("Wrong granularity format: %s" % (gran)))
             return None
-        
+
         for map in maps:
             start, end = map.get_temporal_extent_as_tuple()
             if map.is_time_absolute():
@@ -1172,36 +1196,37 @@
                 if end is not None:
                     end = end + int(gran)
                 map.set_relative_time(start, end, map.get_relative_time_unit())
-            
+
         return maps
-        
+
     def shift(self, gran, dbif=None):
         """!Temporally shift each registered map with the provided granularity
-        
+
            @param gran The granularity to be used for shifting
            @param dbif The database interface to be used
-           @return True something to shift, False if nothing to shift or wrong granularity
-        
+           @return True something to shift, False if nothing to shift or wrong
+                   granularity
+
         """
         if not check_granularity_string(gran, self.get_temporal_type()):
-            core.error(_("Wrong granularity format: %s"%(gran)))
+            core.error(_("Wrong granularity format: %s" % (gran)))
             return False
-            
+
         dbif, connected = init_dbif(dbif)
-        
+
         maps = self.get_registered_maps_as_objects(dbif=dbif)
-        
+
         if maps is None:
             return False
-            
+
         date_list = []
-        
-        # We need to make a dry run to avoid a break 
+
+        # We need to make a dry run to avoid a break
         # in the middle of the update process when the increment
         # results in wrong number of days in a month
         for map in maps:
             start, end = map.get_temporal_extent_as_tuple()
-            
+
             if self.is_time_absolute():
                 start = increment_datetime_by_string(start, gran)
                 if end is not None:
@@ -1210,33 +1235,34 @@
                 start = start + int(gran)
                 if end is not None:
                     end = end + int(gran)
-                    
+
             date_list.append((start, end))
-            
+
         self. _update_map_timestamps(maps, date_list, dbif)
-            
+
         if connected:
             dbif.close()
-            
+
     @staticmethod
     def snap_map_list(maps):
-        """!For each map in the list snap the end time to the start time of its 
+        """!For each map in the list snap the end time to the start time of its
            temporal nearest neighbor in the future.
-           
+
            Maps with equal time stamps are not snapped.
-           
+
            The granularity of the map list will be used to create the end time
            of the last map in case it has a time instance as timestamp.
-           
+
            This method does not perform any temporal database operations.
-           
+
            @param maps A list of maps with initialized temporal extent
-           @return The modified map list, None nothing to shift or wrong granularity
-           
+           @return The modified map list, None nothing to shift or wrong
+                   granularity
+
            Usage:
-           
+
            @code
-           
+
            >>> import grass.temporal as tgis
            >>> maps = []
            >>> for i in range(5):
@@ -1296,122 +1322,128 @@
         """
         if maps is None or len(maps) == 0:
             return None
-        
+
         # We need to sort the maps temporally by start time
         maps = sorted(maps, key=AbstractDatasetComparisonKeyStartTime)
 
         for i in range(len(maps) - 1):
             start, end = maps[i].get_temporal_extent_as_tuple()
             start_next, end = maps[i + 1].get_temporal_extent_as_tuple()
-            
+
             # Maps with equal time stamps can not be snapped
             if start != start_next:
                 if maps[i].is_time_absolute():
                     maps[i].set_absolute_time(start, start_next)
                 elif maps[i].is_time_relative():
-                    maps[i].set_relative_time(start, start_next, maps[i].get_relative_time_unit())
+                    maps[i].set_relative_time(start, start_next,
+                                              maps[i].get_relative_time_unit())
             else:
                 if maps[i].is_time_absolute():
                     maps[i].set_absolute_time(start, end)
                 elif maps[i].is_time_relative():
-                    maps[i].set_relative_time(start, end, maps[i].get_relative_time_unit())
+                    maps[i].set_relative_time(start, end,
+                                              maps[i].get_relative_time_unit())
         # Last map
         start, end = maps[-1].get_temporal_extent_as_tuple()
-        # We increment the start time with the dataset 
+        # We increment the start time with the dataset
         # granularity if the end time is None
         if end is None:
             if maps[-1].is_time_absolute():
                 gran = compute_absolute_time_granularity(maps)
-                end =  increment_datetime_by_string(start, gran)
+                end = increment_datetime_by_string(start, gran)
                 maps[-1].set_absolute_time(start, end)
             elif maps[-1].is_time_relative():
                 gran = compute_relative_time_granularity(maps)
                 end = start + gran
-                maps[-1].set_relative_time(start, end, maps[-1].get_relative_time_unit())
-            
+                maps[-1].set_relative_time(start, end,
+                                           maps[-1].get_relative_time_unit())
+
         return maps
-        
+
     def snap(self, dbif=None):
-        """!For each registered map snap the end time to the start time of its 
-           temporal nearest neighbor in the future
-           
+        """!For each registered map snap the end time to the start time of
+           its temporal nearest neighbor in the future
+
            Maps with equal time stamps are not snapped
-        
+
            @param dbif The database interface to be used
-        
+
         """
         dbif, connected = init_dbif(dbif)
-        
+
         maps = self.get_registered_maps_as_objects(dbif=dbif)
-        
+
         if maps is None:
             return
-            
+
         date_list = []
-        
+
         for i in range(len(maps) - 1):
             start, end = maps[i].get_temporal_extent_as_tuple()
             start_next, end = maps[i + 1].get_temporal_extent_as_tuple()
-            
+
             # Maps with equal time stamps can not be snapped
             if start != start_next:
                 date_list.append((start, start_next))
             else:
                 # Keep the original time stamps
                 date_list.append((start, end))
-        
+
         # Last map
         start, end = maps[-1].get_temporal_extent_as_tuple()
-        # We increment the start time with the dataset 
+        # We increment the start time with the dataset
         # granularity if the end time is None
         if end is None:
             if self.is_time_absolute():
-                end =  increment_datetime_by_string(start, self.get_granularity())
+                end =  increment_datetime_by_string(start,
+                                                    self.get_granularity())
             elif self.is_time_relative():
                 end = start + self.get_granularity()
-        
+
         date_list.append((start, end))
-        
+
         self. _update_map_timestamps(maps, date_list, dbif)
-        
+
         if connected:
             dbif.close()
-            
+
     def _update_map_timestamps(self, maps, date_list, dbif):
         """!Update the timestamps of maps with the start and end time
            stored in the date_list.
-           
+
            The number of dates in the list must be equal to the number
            of maps.
-           
+
            @param maps A list of map objects
            @param date_list A list with date tuples (start_time, end_time)
            @param dbif The database interface to be used
         """
-    
+
         datatsets_to_modify = {}
         # Now update the maps
         count = 0
         for map in maps:
             start = date_list[count][0]
-            end   = date_list[count][1]
+            end = date_list[count][1]
             map.select(dbif)
             count += 1
-            
+
             if self.is_time_absolute():
-                map.update_absolute_time(start_time=start, end_time=end, dbif=dbif)
+                map.update_absolute_time(start_time=start, end_time=end,
+                                         dbif=dbif)
             elif self.is_time_relative():
                 map.update_relative_time(start_time=start, end_time=end,
-                                         unit=self.get_relative_time_unit(), dbif=dbif)
-                
+                                         unit=self.get_relative_time_unit(),
+                                         dbif=dbif)
+
             # Save the datasets that must be updated
             datasets = map.get_registered_datasets(dbif)
             if datasets:
                 for dataset in datasets:
                     datatsets_to_modify[dataset["id"]] = dataset["id"]
-        
+
         self.update_from_registered_maps(dbif)
-        
+
         # Update affected datasets
         if datatsets_to_modify:
             for dataset in datatsets_to_modify:
@@ -1419,8 +1451,7 @@
                     ds = self.get_new_instance(ident=dataset)
                     ds.select(dbif)
                     ds.update_from_registered_maps(dbif)
-            
-        
+
     def rename(self, ident, dbif=None):
         """!Rename the space time dataset
 
@@ -1435,27 +1466,28 @@
 
         # SELECT all needed information from the database
         self.select(dbif)
-        
+
         # We need to select the registered maps here
         maps = self.get_registered_maps_as_objects(None, "start_time", dbif)
-        
+
         # Safe old identifier
         old_ident = self.get_id()
         # We need to rename the old table
         old_map_register_table = self.get_map_register()
-        
+
         # Set new identifier
         self.set_id(ident)
         # Create map register table name from new identifier
         new_map_register_table = self.create_map_register_name()
         # Set new map register table name
         self.set_map_register(new_map_register_table)
-        
-        # Get the update statement, we update the table entry of the old identifier
+
+        # Get the update statement, we update the table entry of the old
+        # identifier
         statement = self.update(dbif, execute=False, ident=old_ident)
-        
+
         # We need to rename the raster register table
-        statement += "ALTER TABLE %s RENAME TO \'%s\';\n"%\
+        statement += "ALTER TABLE %s RENAME TO \'%s\';\n" % \
                      (old_map_register_table, new_map_register_table)
 
         # We need to rename the space time dataset in the maps register table
@@ -1464,35 +1496,35 @@
                 map.select()
                 statement += "UPDATE %s SET id = \'%s\' WHERE id = \'%s\';\n"%\
                              (map.get_stds_register(), ident, old_ident)
-                         
-        
+
         # Execute the accumulated statements
         dbif.execute_transaction(statement)
-        
+
         if connected:
             dbif.close()
-    
+
     def delete(self, dbif=None, execute=True):
         """!Delete a space time dataset from the temporal database
 
-           This method removes the space time dataset from the temporal 
+           This method removes the space time dataset from the temporal
            database and drops its map register table
 
            @param dbif The database interface to be used
-           @param execute If True the SQL DELETE and DROP table 
-                           statements will be executed.
-                           If False the prepared SQL statements are returned 
-                           and must be executed by the caller.
+           @param execute If True the SQL DELETE and DROP table
+                          statements will be executed.
+                          If False the prepared SQL statements are returned
+                          and must be executed by the caller.
 
            @return The SQL statements if execute == False, else an empty string
         """
         # First we need to check if maps are registered in this dataset and
         # unregister them
 
-        # Commented because of performance issue calling g.message thousend times
-        #core.verbose(_("Delete space time %s  dataset <%s> from temporal "
+        # Commented because of performance issue calling g.message thousend
+        # times
+        # core.verbose(_("Delete space time %s  dataset <%s> from temporal "
         #               "database") % \
-        #             (self.get_new_map_instance(ident=None).get_type(), 
+        #             (self.get_new_map_instance(ident=None).get_type(),
         #              self.get_id()))
 
         statement = ""
@@ -1538,9 +1570,9 @@
             This method takes care of the registration of a map
             in a space time dataset.
 
-            In case the map is already registered this function 
+            In case the map is already registered this function
             will break with a warning and return False.
-            
+
             This method raises a ScriptError in case of a fatal error
 
            @param map The AbstractMapDataset object that should be registered
@@ -1553,26 +1585,27 @@
             dbif.close()
             core.fatal(_("Only maps with absolute or relative valid time can "
                          "be registered"))
-        # Commented because of performance issue calling g.message thousend times
+        # Commented because of performance issue calling g.message thousend
+        # times
         #if map.get_layer():
         #    core.verbose(_("Register %s map <%s> with layer %s in space "
-        #                   "time %s dataset <%s>") % (map.get_type(), 
-        #                                              map.get_map_id(), 
-        #                                              map.get_layer(), 
-        #                                              map.get_type(), 
+        #                   "time %s dataset <%s>") % (map.get_type(),
+        #                                              map.get_map_id(),
+        #                                              map.get_layer(),
+        #                                              map.get_type(),
         #                                              self.get_id()))
         #else:
         #    core.verbose(_("Register %s map <%s> in space time %s "
         #                   "dataset <%s>") % (map.get_type(), map.get_map_id(),
-        #                                       map.get_type(), self.get_id()))
+        #                                      map.get_type(), self.get_id()))
 
         # First select all data from the database
         map.select(dbif)
 
         if not map.check_for_correct_time():
             if map.get_layer():
-                core.fatal(_("Map <%s> with layer %s has invalid time")
-                           % (map.get_map_id(), map.get_layer()))
+                core.fatal(_("Map <%(id)s> with layer %(l)s has invalid time")
+                           % {'id': map.get_map_id(), 'l': map.get_layer()})
             else:
                 core.fatal(_("Map <%s> has invalid time") % (map.get_map_id()))
 
@@ -1597,15 +1630,16 @@
         # Check temporal types
         if stds_ttype != map_ttype:
             if map.get_layer():
-                core.fatal(_("Temporal type of space time dataset <%s> and "
-                             "map <%s> with layer %s are different") % \
-                           (self.get_id(), map.get_map_id(), map.get_layer()))
+                core.fatal(_("Temporal type of space time dataset <%(id)s> and"
+                             " map <%(map)s> with layer %(l)s are different") \
+                             % {'id': self.get_id(), 'map': map.get_map_id(),
+                                'l': map.get_layer()})
             else:
-                core.fatal(_("Temporal type of space time dataset <%s> and "
-                             "map <%s> are different") % \
-                           (self.get_id(), map.get_map_id()))
+                core.fatal(_("Temporal type of space time dataset <%(id)s> and"
+                             " map <%(map)s> are different") % {
+                             'id': self.get_id(), 'map': map.get_map_id()})
 
-        # In case no map has been registered yet, set the 
+        # In case no map has been registered yet, set the
         # relative time unit from the first map
         if (self.metadata.get_number_of_maps() is None or \
             self.metadata.get_number_of_maps() == 0) and \
@@ -1625,12 +1659,14 @@
         if self.is_time_relative() and (stds_rel_time_unit != map_rel_time_unit):
             if map.get_layer():
                 core.fatal(_("Relative time units of space time dataset "
-                             "<%s> and map <%s> with layer %s are different") %\
-                            (self.get_id(), map.get_map_id(), map.get_layer()))
+                             "<%(id)s> and map <%(map)s> with layer %(l)s are"
+                             " different") % {'id': self.get_id(),
+                                              'map': map.get_map_id(),
+                                              'l': map.get_layer()})
             else:
                 core.fatal(_("Relative time units of space time dataset "
-                             "<%s> and map <%s> are different") % \
-                           (self.get_id(), map.get_map_id()))
+                             "<%(id)s> and map <%(map)s> are different") % \
+                             {'id': self.get_id(), 'map': map.get_map_id()})
 
         if stds_mapset != map_mapset:
             dbif.close()
@@ -1656,18 +1692,19 @@
                     dbif.close()
 
                 if map.get_layer() is not None:
-                    core.warning(_("Map <%s> with layer %s is already "
-                                   "registered.") % (map.get_map_id(), 
-                                                     map.get_layer()))
+                    core.warning(_("Map <%(map)s> with layer %(l)s is already "
+                                   "registered.") % {'map': map.get_map_id(),
+                                                     'l': map.get_layer()})
                 else:
-                    core.warning(_("Map <%s> is already registered.")
-                        % (map.get_map_id()))
+                    core.warning(_("Map <%s> is already registered.") % (
+                                 map.get_map_id()))
                 return False
 
         # Create tables
         sql_path = get_sql_template_path()
 
-        # We need to create the map raster register table precedes we can register the map
+        # We need to create the map raster register table precedes we can
+        # register the map
         if map_register_table is None:
             # Create a unique id
             uuid_rand = "map_" + str(uuid.uuid4()).replace("-", "")
@@ -1676,8 +1713,8 @@
                 self.get_type() + "_register"
 
             # Read the SQL template
-            sql = open(os.path.join(sql_path, 
-                                    "map_stds_register_table_template.sql"), 
+            sql = open(os.path.join(sql_path,
+                                    "map_stds_register_table_template.sql"),
                                     'r').read()
             # Create the raster, raster3d and vector tables
             sql = sql.replace("GRASS_MAP", map.get_type())
@@ -1708,8 +1745,8 @@
             # Create table name
             stds_register_table = self.create_map_register_name()
             # Read the SQL template
-            sql = open(os.path.join(sql_path, 
-                                    "stds_map_register_table_template.sql"), 
+            sql = open(os.path.join(sql_path,
+                                    "stds_map_register_table_template.sql"),
                                     'r').read()
             # Create the raster, raster3d and vector tables
             sql = sql.replace("GRASS_MAP", map.get_type())
@@ -1775,7 +1812,7 @@
 
         # increase the counter
         self.map_counter += 1
-        
+
         return True
 
     def unregister_map(self, map, dbif=None, execute=True):
@@ -1786,12 +1823,12 @@
 
            @param map The map object to unregister
            @param dbif The database interface to be used
-           @param execute If True the SQL DELETE and DROP table 
+           @param execute If True the SQL DELETE and DROP table
                            statements will be executed.
-                           If False the prepared SQL statements are 
+                           If False the prepared SQL statements are
                            returned and must be executed by the caller.
 
-           @return The SQL statements if execute == False, else an empty 
+           @return The SQL statements if execute == False, else an empty
                    string, None in case of a failure
         """
 
@@ -1829,14 +1866,16 @@
             # Break if the map is not registered
             if row is None:
                 if map.get_layer() is not None:
-                    core.warning(_("Map <%s> with layer %s is not registered "
-                                   "in space time dataset <%s>") % \
-                                 (map.get_map_id(), map.get_layer(), 
-                                  self.base.get_id()))
+                    core.warning(_("Map <%(map)s> with layer %(l)s is not "
+                                   "registered in space time dataset "
+                                   "<%(base)s>") % {'map': map.get_map_id(),
+                                                    'l': map.get_layer(),
+                                                    'base': self.base.get_id()})
                 else:
-                    core.warning(_("Map <%s> is not registered in space "
-                                   "time dataset <%s>") % (map.get_map_id(), 
-                                                           self.base.get_id()))
+                    core.warning(_("Map <%(map)s> is not registered in space "
+                                   "time dataset <%(base)s>") % {
+                                   'map': map.get_map_id(),
+                                   'base': self.base.get_id()})
                 if connected == True:
                     dbif.close()
                 return ""
@@ -1877,13 +1916,15 @@
 
     def update_from_registered_maps(self, dbif=None):
         """!This methods updates the spatial and temporal extent as well as
-           type specific metadata. It should always been called after maps are registered
-           or unregistered/deleted from the space time dataset.
+           type specific metadata. It should always been called after maps
+           are registered or unregistered/deleted from the space time dataset.
 
-           The update of the temporal extent checks if the end time is set correctly.
-           In case the registered maps have no valid end time (None) the maximum start time
-           will be used. If the end time is earlier than the maximum start time, it will
-           be replaced by the maximum start time.
+           The update of the temporal extent checks if the end time is set
+           correctly.
+           In case the registered maps have no valid end time (None) the
+           maximum start time
+           will be used. If the end time is earlier than the maximum start
+           time, it will be replaced by the maximum start time.
 
            An other solution to automate this is to use the deactivated trigger
            in the SQL files. But this will result in a huge performance issue
@@ -1914,8 +1955,8 @@
 
         # Update the spatial and temporal extent from registered maps
         # Read the SQL template
-        sql = open(os.path.join(sql_path, 
-                   "update_stds_spatial_temporal_extent_template.sql"), 
+        sql = open(os.path.join(sql_path,
+                   "update_stds_spatial_temporal_extent_template.sql"),
                    'r').read()
         sql = sql.replace(
             "GRASS_MAP", self.get_new_map_instance(None).get_type())
@@ -1948,7 +1989,7 @@
         else:
             start_time, end_time, unit = self.get_relative_time()
 
-        # In case no end time is set, use the maximum start time of 
+        # In case no end time is set, use the maximum start time of
         # all registered maps as end time
         if end_time is None:
             use_start_time = True

Modified: grass/trunk/lib/python/temporal/aggregation.py
===================================================================
--- grass/trunk/lib/python/temporal/aggregation.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/aggregation.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -34,8 +34,10 @@
 
        @param sp The space time raster dataset to select aps from
        @param dbif The temporal database interface to use
-       @param start The start time of the sample interval, may be relative or absolute
-       @param end The end time of the sample interval, may be relative or absolute
+       @param start The start time of the sample interval, may be relative or
+              absolute
+       @param end The end time of the sample interval, may be relative or
+              absolute
        @param sampling The sampling methods to use
     """
 
@@ -77,13 +79,13 @@
         use_follows = False
         use_precedes = False
 
-    where = create_temporal_relation_sql_where_statement(start, end, 
-                                                         use_start, 
-                                                         use_during, 
-                                                         use_overlap, 
-                                                         use_contain, 
-                                                         use_equal, 
-                                                         use_follows, 
+    where = create_temporal_relation_sql_where_statement(start, end,
+                                                         use_start,
+                                                         use_during,
+                                                         use_overlap,
+                                                         use_contain,
+                                                         use_equal,
+                                                         use_follows,
                                                          use_precedes)
 
     rows = sp.get_registered_maps("id", where, "start_time", dbif)
@@ -100,17 +102,21 @@
 ###############################################################################
 
 
-def aggregate_raster_maps(inputs, base, start, end, count, method, 
+def aggregate_raster_maps(inputs, base, start, end, count, method,
                           register_null, dbif):
     """!Aggregate a list of raster input maps with r.series
 
        @param inputs The names of the raster maps to be aggregated
        @param base The basename of the new created raster maps
-       @param start The start time of the sample interval, may be relative or absolute
-       @param end The end time of the sample interval, may be relative or absolute
-       @param count The number to be attached to the basename of the new created raster map
+       @param start The start time of the sample interval, may be relative or
+                    absolute
+       @param end The end time of the sample interval, may be relative or
+                  absolute
+       @param count The number to be attached to the basename of the new
+                    created raster map
        @param method The aggreation method to be used by r.series
-       @param register_null If true null maps will be registered in the space time raster dataset, if false not
+       @param register_null If true null maps will be registered in the space
+                            time raster dataset, if false not
        @param dbif The temporal database interface to use
     """
 
@@ -128,11 +134,12 @@
             new_map.delete(dbif)
             new_map = RasterDataset(map_id)
         else:
-            core.error(_("Raster map <%s> is already in temporal database, use overwrite flag to overwrite"))
+            core.error(_("Raster map <%s> is already in temporal database, " \
+                         "use overwrite flag to overwrite"))
             return
 
-    core.verbose(_("Compute aggregation of maps between %s - %s" % (
-        str(start), str(end))))
+    core.verbose(_("Compute aggregation of maps between %(st)s - %(end)s" % {
+                   'st': str(start), 'end': str(end)}))
 
     # Create the r.series input file
     filename = core.tempfile(True)
@@ -145,7 +152,7 @@
     file.close()
     # Run r.series
     ret = core.run_command("r.series", flags="z", file=filename,
-                           output=output, overwrite=core.overwrite(), 
+                           output=output, overwrite=core.overwrite(),
                            method=method)
 
     if ret != 0:

Modified: grass/trunk/lib/python/temporal/create.py
===================================================================
--- grass/trunk/lib/python/temporal/create.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/create.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -27,27 +27,29 @@
 
 ###############################################################################
 
+
 def create_space_time_dataset(name, type, temporaltype, title, descr, semantic,
                               dbif=None, overwrite=False):
     """!Create a new space time dataset
-    
+
        This function is sensitive to the settings in grass.core.overwrite to
        overwrute existing space time datasets.
-    
+
        @param name The name of the new space time dataset
-       @param type The type (strds, stvds, str3ds) of the new space time dataset
+       @param type The type (strds, stvds, str3ds) of the new space time
+                   dataset
        @param temporaltype The temporal type (relative or absolute)
        @param title The title
        @param descr The dataset description
        @param semantic Semantical information
        @param dbif The temporal database interface to be used
        @param overwrite Flag to allow overwriting
-       
+
        @return The new created space time dataset
-       
+
        This function will raise a ScriptError in case of an error.
     """
-    
+
     #Get the current mapset to create the id of the space time dataset
 
     mapset = core.gisenv()["MAPSET"]
@@ -60,20 +62,22 @@
     if sp.is_in_db(dbif) and overwrite == False:
         if connected:
             dbif.close()
-        core.fatal(_("Space time %s dataset <%s> is already in the database. "
-                      "Use the overwrite flag.") %
-                    (sp.get_new_map_instance(None).get_type(), name))
+        core.fatal(_("Space time %(sp)s dataset <%(name)s> is already in the"
+                      " database. Use the overwrite flag.") % {
+                      'sp': sp.get_new_map_instance(None).get_type(),
+                      'name': name})
         return None
 
     if sp.is_in_db(dbif) and overwrite == True:
-        core.warning(_("Overwrite space time %s dataset <%s> "
-                     "and unregister all maps.") %
-                   (sp.get_new_map_instance(None).get_type(), name))
+        core.warning(_("Overwrite space time %(sp)s dataset <%(name)s> and "
+                       "unregister all maps.") % {
+                       'sp': sp.get_new_map_instance(None).get_type(),
+                       'name': name})
         sp.delete(dbif)
         sp = sp.get_new_instance(id)
 
     core.verbose(_("Create new space time %s dataset.") %
-                  sp.get_new_map_instance(None).get_type())
+                   sp.get_new_map_instance(None).get_type())
 
     sp.set_initial_values(temporal_type=temporaltype, semantic_type=semantic,
                           title=title, description=descr)

Modified: grass/trunk/lib/python/temporal/extract.py
===================================================================
--- grass/trunk/lib/python/temporal/extract.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/extract.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -17,24 +17,29 @@
 
 ############################################################################
 
+
 def extract_dataset(input, output, type, where, expression, base, nprocs=1,
                     register_null=False, layer=1,
                     vtype="point,line,boundary,centroid,area,face"):
     """!Extract a subset of a space time raster, raster3d or vector dataset
 
-       A mapcalc expression can be provided to process the temporal extracted maps.
+       A mapcalc expression can be provided to process the temporal extracted
+       maps.
        Mapcalc expressions are supported for raster and raster3d maps.
 
        @param input The name of the input space time raster/raster3d dataset
-       @param output The name of the extracted new space time raster/raster3d dataset
+       @param output The name of the extracted new space time raster/raster3d
+                     dataset
        @param type The type of the dataset: "raster", "raster3d" or vector
        @param where The temporal SQL WHERE statement for subset extraction
-       @param expression The r(3).mapcalc expression or the v.extract where statement
+       @param expression The r(3).mapcalc expression or the v.extract where
+                         statement
        @param base The base name of the new created maps in case a mapclac
-              expression is provided
-       @param nprocs The number of parallel processes to be used for mapcalc processing
+                   expression is provided
+       @param nprocs The number of parallel processes to be used for mapcalc
+                     processing
        @param register_null Set this number True to register empty maps
-             (only raster and raster3d maps)
+                            (only raster and raster3d maps)
        @param layer The vector layer number to be used when no timestamped
               layer is present, default is 1
        @param vtype The feature type to be extracted for vector maps, default
@@ -67,7 +72,8 @@
 
     if not sp.is_in_db(dbif):
         dbif.close()
-        core.fatal(_("Space time %s dataset <%s> not found") % (type, id))
+        core.fatal(_("Space time %(type)s dataset <%(id)s> not found") % {
+                     'type': type, 'id': id})
 
     if expression and not base:
         dbif.close()
@@ -86,8 +92,9 @@
     if new_sp.is_in_db():
         if not core.overwrite():
             dbif.close()
-            core.fatal(_("Space time %s dataset <%s> is already in database,"
-                         " use overwrite flag to overwrite") % (type, out_id))
+            core.fatal(_("Space time %(type)s dataset <%(id)s> is already in "
+                         "database, use overwrite flag to overwrite") % {
+                         'type': type, 'id': out_id})
     if type == "vector":
         rows = sp.get_registered_maps(
             "id,name,mapset,layer", where, "start_time", dbif)
@@ -109,7 +116,7 @@
             for row in rows:
                 count += 1
 
-                if count%10 == 0:
+                if count % 10 == 0:
                     core.percent(count, num_rows, 1)
 
                 map_name = "%s_%i" % (base, count)
@@ -135,8 +142,8 @@
                         new_map.delete(dbif)
                         new_map = sp.get_new_map_instance(map_id)
                     else:
-                        core.error(_("Map <%s> is already in temporal database,"
-                                     " use overwrite flag to overwrite") %
+                        core.error(_("Map <%s> is already in temporal database"
+                                     ", use overwrite flag to overwrite") %
                                     (new_map.get_map_id()))
                         continue
 
@@ -158,19 +165,19 @@
                         proc_list.append(Process(target=run_vector_extraction,
                                                  args=(row["name"] + "@" + \
                                                        row["mapset"],
-                                                 map_name, row["layer"], 
+                                                 map_name, row["layer"],
                                                  vtype, expression)))
                     else:
                         proc_list.append(Process(target=run_vector_extraction,
                                                  args=(row["name"] + "@" + \
                                                        row["mapset"],
-                                                 map_name, layer, vtype, 
+                                                 map_name, layer, vtype,
                                                  expression)))
 
                 proc_list[proc_count].start()
                 proc_count += 1
 
-                # Join processes if the maximum number of processes are 
+                # Join processes if the maximum number of processes are
                 # reached or the end of the loop is reached
                 if proc_count == nprocs or proc_count == num_rows:
                     proc_count = 0
@@ -209,8 +216,8 @@
         count = 0
         for row in rows:
             count += 1
-            
-            if count%10 == 0:
+
+            if count % 10 == 0:
                 core.percent(count, num_rows, 1)
 
             old_map = sp.get_new_map_instance(row["id"])
@@ -224,7 +231,8 @@
                     # Read the raster map data
                     new_map.load()
 
-                    # In case of a empty map continue, do not register empty maps
+                    # In case of a empty map continue, do not register empty
+                    # maps
                     if type == "raster" or type == "raster3d":
                         if new_map.metadata.get_min() is None and \
                             new_map.metadata.get_max() is None:
@@ -279,16 +287,19 @@
 
 ###############################################################################
 
+
 def run_mapcalc2d(expr):
     """Helper function to run r.mapcalc in parallel"""
     return core.run_command("r.mapcalc", expression=expr,
                             overwrite=core.overwrite(), quiet=True)
 
+
 def run_mapcalc3d(expr):
     """Helper function to run r3.mapcalc in parallel"""
     return core.run_command("r3.mapcalc", expression=expr,
                             overwrite=core.overwrite(), quiet=True)
 
+
 def run_vector_extraction(input, output, layer, type, where):
     """Helper function to run r.mapcalc in parallel"""
     return core.run_command("v.extract", input=input, output=output,

Modified: grass/trunk/lib/python/temporal/mapcalc.py
===================================================================
--- grass/trunk/lib/python/temporal/mapcalc.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/mapcalc.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -18,28 +18,30 @@
 ############################################################################
 
 
-def dataset_mapcalculator(inputs, output, type, expression, base, method, 
+def dataset_mapcalculator(inputs, output, type, expression, base, method,
                           nprocs=1, register_null=False, spatial=False):
-    """!Perform map-calculations of maps from different space time 
-       raster/raster3d datasets, using a specific sampling method 
+    """!Perform map-calculations of maps from different space time
+       raster/raster3d datasets, using a specific sampling method
        to select temporal related maps.
 
-       A mapcalc expression must be provided to process the temporal 
-       selected maps. Temporal operators are available in addition to 
+       A mapcalc expression must be provided to process the temporal
+       selected maps. Temporal operators are available in addition to
        the r.mapcalc operators:
-       
+
        Supported operators for relative and absolute time are:
-       - td() - the time delta of the current interval in days 
-         and fractions of days or the unit in case of relative time
-       - start_time() - The start time of the interval from the begin of the time 
-         series in days and fractions of days or the unit in case of relative time
-       - end_time() - The end time of the current interval from the begin of the time 
-         series in days and fractions of days or the unit in case of relative time
-         
+       - td() - the time delta of the current interval in days
+                and fractions of days or the unit in case of relative time
+       - start_time() - The start time of the interval from the begin of
+                        the time series in days and fractions of days or the
+                        unit in case of relative time
+       - end_time() - The end time of the current interval from the begin of
+                      the time series in days and fractions of days or the
+                      unit in case of relative time
+
        Supported operators for absolute time:
        - start_doy() - Day of year (doy) from the start time [1 - 366]
-       - start_dow() - Day of week (dow) from the start time [1 - 7], 
-         the start of the week is monday == 1
+       - start_dow() - Day of week (dow) from the start time [1 - 7],
+                       the start of the week is monday == 1
        - start_year() - The year of the start time [0 - 9999]
        - start_month() - The month of the start time [1 - 12]
        - start_week() - Week of year of the start time [1 - 54]
@@ -49,8 +51,8 @@
        - start_second() - The second of the start time [0 - 59]
 
        - end_doy() - Day of year (doy) from the end time [1 - 366]
-       - end_dow() - Day of week (dow) from the end time [1 - 7], 
-         the start of the week is monday == 1
+       - end_dow() - Day of week (dow) from the end time [1 - 7],
+                     the start of the week is monday == 1
        - end_year() - The year of the end time [0 - 9999]
        - end_month() - The month of the end time [1 - 12]
        - end_week() - Week of year of the end time [1 - 54]
@@ -58,16 +60,15 @@
        - end_hour() - The hour of the end time [0 - 23]
        - end_minute() - The minute of the end time [0 - 59]
        - end_second() - The minute of the end time [0 - 59]
-       
 
        @param inputs The names of the input space time raster/raster3d datasets
        @param output The name of the extracted new space time raster(3d) dataset
        @param type The type of the dataset: "raster" or "raster3d"
        @param expression The r(3).mapcalc expression
-       @param base The base name of the new created maps in case a 
+       @param base The base name of the new created maps in case a
               mapclac expression is provided
        @param method The method to be used for temporal sampling
-       @param nprocs The number of parallel processes to be used for 
+       @param nprocs The number of parallel processes to be used for
               mapcalc processing
        @param register_null Set this number True to register empty maps
        @param spatial Check spatial overlap
@@ -94,12 +95,13 @@
 
     if not first_input.is_in_db(dbif):
         dbif.close()
-        core.fatal(_("Space time %s dataset <%s> not found") % (type, id))
+        core.fatal(_("Space time %(t)s dataset <%(i)s> not found") % {'t': type,
+                                                                      'i': id})
 
     # Fill the object with data from the temporal database
     first_input.select(dbif)
 
-    # All additional inputs in reverse sorted order to avoid 
+    # All additional inputs in reverse sorted order to avoid
     # wrong name substitution
     input_name_list = input_name_list[1:]
     input_name_list.sort()
@@ -117,8 +119,8 @@
 
         if not sp.is_in_db(dbif):
             dbif.close()
-            core.fatal(_("Space time %s dataset <%s> not "
-                         "found in temporal database") % (type, id))
+            core.fatal(_("Space time %(t)s dataset <%(i)s> not "
+                         "found in temporal database") % {'t': type, 'i': id})
 
         sp.select(dbif)
 
@@ -136,8 +138,9 @@
     if new_sp.is_in_db(dbif):
         if not core.overwrite():
             dbif.close()
-            core.fatal(_("Space time %s dataset <%s> is already in database, "
-                         "use overwrite flag to overwrite") % (type, out_id))
+            core.fatal(_("Space time %(t)s dataset <%(i)s> is already in "
+                         "database, use overwrite flag to overwrite") % {'t': type,
+                                                                         'i': out_id})
 
     # Sample all inputs by the first input and create a sample matrix
     if spatial:
@@ -154,7 +157,7 @@
         has_samples = False
         for dataset in input_list:
             list = dataset.sample_by_dataset(stds=first_input,
-                                             method=method, spatial=spatial, 
+                                             method=method, spatial=spatial,
                                              dbif=dbif)
 
             # In case samples are not found
@@ -192,7 +195,7 @@
                                    "computation. Use t.rast.aggregate.ds to "
                                    "create synchronous raster datasets."))
 
-                # Store all maps! This includes non existent maps, 
+                # Store all maps! This includes non existent maps,
                 # identified by id == None
                 map_name_list.append(maplist[0].get_name())
 
@@ -235,17 +238,17 @@
         for i in range(num):
 
             count += 1
-            if count%10 == 0:
+            if count % 10 == 0:
                 core.percent(count, num, 1)
 
             # Create the r.mapcalc statement for the current time step
             map_name = "%s_%i" % (base, count)
             # Remove spaces and new lines
             expr = expression.replace(" ", "")
-            
+
             # Check that all maps are in the sample
             valid_maps = True
-            # Replace all dataset names with their map names of the 
+            # Replace all dataset names with their map names of the
             # current time step
             for j in range(len(map_matrix)):
                 if map_matrix[j][i] is None:
@@ -258,7 +261,7 @@
             if not valid_maps:
                 continue
 
-            # Create the new map id and check if the map is already 
+            # Create the new map id and check if the map is already
             # in the database
             map_id = map_name + "@" + mapset
 
@@ -282,9 +285,10 @@
             else:
                 start, end, unit = sample_map_list[i].get_relative_time()
                 new_map.set_relative_time(start, end, unit)
-            
+
             # Parse the temporal expressions
-            expr = _operator_parser(expr, sample_map_list[0], sample_map_list[i])
+            expr = _operator_parser(expr, sample_map_list[0],
+                                    sample_map_list[i])
             # Add the output map name
             expr = "%s=%s" % (map_name, expr)
 
@@ -335,11 +339,12 @@
         # collect empty maps to remove them
         empty_maps = []
 
-        # Insert maps in the temporal database and in the new space time dataset
+        # Insert maps in the temporal database and in the new space time
+        # dataset
         for new_map in map_list:
 
             count += 1
-            if count%10 == 0:
+            if count % 10 == 0:
                 core.percent(count, num, 1)
 
             # Read the map data
@@ -384,34 +389,38 @@
 
 def _run_mapcalc2d(expr):
     """Helper function to run r.mapcalc in parallel"""
-    return core.run_command("r.mapcalc", expression=expr, 
+    return core.run_command("r.mapcalc", expression=expr,
                             overwrite=core.overwrite(), quiet=True)
 
 ###############################################################################
 
+
 def _run_mapcalc3d(expr):
     """Helper function to run r3.mapcalc in parallel"""
-    return core.run_command("r3.mapcalc", expression=expr, 
+    return core.run_command("r3.mapcalc", expression=expr,
                             overwrite=core.overwrite(), quiet=True)
 
 ###############################################################################
 
+
 def _operator_parser(expr, first, current):
-    """This method parses the expression string and substitutes 
+    """This method parses the expression string and substitutes
        the temporal operators with numerical values.
-       
+
        Supported operators for relative and absolute time are:
-       * td() - the time delta of the current interval in days 
+       * td() - the time delta of the current interval in days
          and fractions of days or the unit in case of relative time
-       * start_time() - The start time of the interval from the begin of the time 
-         series in days and fractions of days or the unit in case of relative time
-       * end_time() - The end time of the current interval from the begin of the time 
-         series in days and fractions of days or the unit in case of relative time
-         
+       * start_time() - The start time of the interval from the begin of the
+                        time series in days and fractions of days or the unit
+                        in case of relative time
+       * end_time() - The end time of the current interval from the begin of
+                      the time series in days and fractions of days or the
+                      unit in case of relative time
+
        Supported operators for absolute time:
        * start_doy() - Day of year (doy) from the start time [1 - 366]
-       * start_dow() - Day of week (dow) from the start time [1 - 7], 
-         the start of the week is monday == 1
+       * start_dow() - Day of week (dow) from the start time [1 - 7],
+                       the start of the week is monday == 1
        * start_year() - The year of the start time [0 - 9999]
        * start_month() - The month of the start time [1 - 12]
        * start_week() - Week of year of the start time [1 - 54]
@@ -421,8 +430,8 @@
        * start_second() - The second of the start time [0 - 59]
 
        * end_doy() - Day of year (doy) from the end time [1 - 366]
-       * end_dow() - Day of week (dow) from the end time [1 - 7], 
-         the start of the week is monday == 1
+       * end_dow() - Day of week (dow) from the end time [1 - 7],
+                     the start of the week is monday == 1
        * end_year() - The year of the end time [0 - 9999]
        * end_month() - The month of the end time [1 - 12]
        * end_week() - Week of year of the end time [1 - 54]
@@ -430,28 +439,29 @@
        * end_hour() - The hour of the end time [0 - 23]
        * end_minute() - The minute of the end time [0 - 59]
        * end_second() - The minute of the end time [0 - 59]
-       
+
        The modified expression is returned.
-       
+
     """
     is_time_absolute = first.is_time_absolute()
-    
+
     expr = _parse_td_operator(expr, is_time_absolute, first, current)
     expr = _parse_start_time_operator(expr, is_time_absolute, first, current)
     expr = _parse_end_time_operator(expr, is_time_absolute, first, current)
     expr = _parse_start_operators(expr, is_time_absolute, current)
     expr = _parse_end_operators(expr, is_time_absolute, current)
-    
+
     return expr
 
 ###############################################################################
 
+
 def _parse_start_operators(expr, is_time_absolute, current):
     """
        Supported operators for absolute time:
        * start_doy() - Day of year (doy) from the start time [1 - 366]
-       * start_dow() - Day of week (dow) from the start time [1 - 7], 
-         the start of the week is monday == 1
+       * start_dow() - Day of week (dow) from the start time [1 - 7],
+                       the start of the week is monday == 1
        * start_year() - The year of the start time [0 - 9999]
        * start_month() - The month of the start time [1 - 12]
        * start_week() - Week of year of the start time [1 - 54]
@@ -460,67 +470,77 @@
        * start_minute() - The minute of the start time [0 - 59]
        * start_second() - The second of the start time [0 - 59]
     """
-    
+
     start, end, tz = current.get_absolute_time()
-        
+
     if expr.find("start_year()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         expr = expr.replace("start_year()", str(start.year))
-        
+
     if expr.find("start_month()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         expr = expr.replace("start_month()", str(start.month))
-        
+
     if expr.find("start_week()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         expr = expr.replace("start_week()", str(start.isocalendar()[1]))
-        
+
     if expr.find("start_day()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         expr = expr.replace("start_day()", str(start.day))
-        
+
     if expr.find("start_hour()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         expr = expr.replace("start_hour()", str(start.hour))
-        
+
     if expr.find("start_minute()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         expr = expr.replace("start_minute()", str(start.minute))
-        
+
     if expr.find("start_second()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         expr = expr.replace("start_second()", str(start.second))
-        
+
     if expr.find("start_dow()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         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:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("start_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("start_*")))
         year = datetime(start.year, 1, 1)
         delta = start - year
-        
+
         expr = expr.replace("start_doy()", str(delta.days + 1))
-        
+
     return expr
 
 ###############################################################################
 
+
 def _parse_end_operators(expr, is_time_absolute, current):
     """
        Supported operators for absolute time:
        - end_doy() - Day of year (doy) from the end time [1 - 366]
-       - end_dow() - Day of week (dow) from the end time [1 - 7], 
-         the start of the week is monday == 1
+       - end_dow() - Day of week (dow) from the end time [1 - 7],
+                     the start of the week is monday == 1
        - end_year() - The year of the end time [0 - 9999]
        - end_month() - The month of the end time [1 - 12]
        - end_week() - Week of year of the end time [1 - 54]
@@ -528,98 +548,109 @@
        - end_hour() - The hour of the end time [0 - 23]
        - end_minute() - The minute of the end time [0 - 59]
        - end_second() - The minute of the end time [0 - 59]
-       
-       In case of time instances the end_* expression will be replaced by null()
+
+       In case of time instances the end_* expression will be replaced by
+       null()
     """
-    
+
     start, end, tz = current.get_absolute_time()
-        
+
     if expr.find("end_year()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_year()", "null()")
         else:
             expr = expr.replace("end_year()", str(end.year))
-        
+
     if expr.find("end_month()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_month()", "null()")
         else:
             expr = expr.replace("end_month()", str(end.month))
-        
+
     if expr.find("end_week()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_week()", "null()")
         else:
             expr = expr.replace("end_week()", str(end.isocalendar()[1]))
-        
+
     if expr.find("end_day()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_day()", "null()")
         else:
             expr = expr.replace("end_day()", str(end.day))
-        
+
     if expr.find("end_hour()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_hour()", "null()")
         else:
             expr = expr.replace("end_hour()", str(end.hour))
-        
+
     if expr.find("end_minute()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_minute()", "null()")
         else:
             expr = expr.replace("end_minute()", str(end.minute))
-        
+
     if expr.find("end_second()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_second()", "null()")
         else:
             expr = expr.replace("end_second()", str(end.second))
-        
+
     if expr.find("end_dow()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_dow()", "null()")
         else:
             expr = expr.replace("end_dow()", str(end.isoweekday()))
-        
+
     if expr.find("end_doy()") >= 0:
         if not is_time_absolute:
-            core.fatal(_("The temporal operators <%s> supports only absolute time."%("end_*")))
+            core.fatal(_("The temporal operators <%s> supports only absolute"\
+                         "time." % ("end_*")))
         if not end:
             expr = expr.replace("end_doy()", "null()")
         else:
             year = datetime(end.year, 1, 1)
             delta = end - year
-            
+
             expr = expr.replace("end_doy()", str(delta.days + 1))
-        
+
     return expr
 
 ###############################################################################
 
+
 def _parse_td_operator(expr, is_time_absolute, first, current):
     """Parse the time delta operator td(). This operator
        represents the size of the current sample time interval
        in days and fraction of days for absolute time,
        and in relative units in case of relative time.
-       
-       In case of time instances, the td() operator will be of type null(). 
+
+       In case of time instances, the td() operator will be of type null().
     """
     if expr.find("td()") >= 0:
         td = "null()"
@@ -632,17 +663,18 @@
             if end != None:
                 td = end - start
         expr = expr.replace("td()", str(td))
-        
+
     return expr
 
 ###############################################################################
 
+
 def _parse_start_time_operator(expr, is_time_absolute, first, current):
     """Parse the start_time() operator. This operator represent 
     the time difference between the start time of the sample space time
-    raster dataset and the start time of the current sample interval or instance. The time
-    is measured  in days and fraction of days for absolute time,
-    and in relative units in case of relative time."""
+    raster dataset and the start time of the current sample interval or
+    instance. The time is measured  in days and fraction of days for absolute
+    time, and in relative units in case of relative time."""
     if expr.find("start_time()") >= 0:
         if is_time_absolute:
             start1, end, tz = first.get_absolute_time()
@@ -653,18 +685,19 @@
             start, end, unit = current.get_relative_time()
             x = start - start1
         expr = expr.replace("start_time()", str(x))
-        
+
     return expr
 
 ###############################################################################
 
+
 def _parse_end_time_operator(expr, is_time_absolute, first, current):
-    """Parse the end_time() operator. This operator represent 
+    """Parse the end_time() operator. This operator represent
     the time difference between the start time of the sample space time
     raster dataset and the end time of the current sample interval. The time
     is measured  in days and fraction of days for absolute time,
     and in relative units in case of relative time.
-    
+
     The end_time() will be represented by null() in case of a time instance.
     """
     if expr.find("end_time()") >= 0:
@@ -680,6 +713,5 @@
             if end:
                 x = end - start1
         expr = expr.replace("end_time()", str(x))
-        
+
     return expr
-

Modified: grass/trunk/lib/python/temporal/register.py
===================================================================
--- grass/trunk/lib/python/temporal/register.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/register.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -32,10 +32,10 @@
     type, name, maps=None, file=None, start=None,
     end=None, unit=None, increment=None, dbif=None,
         interval=False, fs="|"):
-    """!Use this method to register maps in space time datasets. 
+    """!Use this method to register maps in space time datasets.
 
-       Additionally a start time string and an increment string can be specified
-       to assign a time interval automatically to the maps.
+       Additionally a start time string and an increment string can be
+       specified to assign a time interval automatically to the maps.
 
        It takes care of the correct update of the space time datasets from all
        registered maps.
@@ -43,22 +43,22 @@
        @param type The type of the maps rast, rast3d or vect
        @param name The name of the space time dataset
        @param maps A comma separated list of map names
-       @param file Input file one map with start and optional end time, 
-                    one per line
+       @param file Input file one map with start and optional end time,
+                   one per line
        @param start The start date and time of the first raster map
                     (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd",
                     format relative is integer 5)
        @param end The end date and time of the first raster map
-                   (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd",
-                   format relative is integer 5)
+                  (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd",
+                  format relative is integer 5)
        @param unit The unit of the relative time: years, months, days,
-                    hours, minutes, seconds
+                   hours, minutes, seconds
        @param increment Time increment between maps for time stamp creation
-                         (format absolute: NNN seconds, minutes, hours, days,
-                         weeks, months, years; format relative: 1.0)
+                        (format absolute: NNN seconds, minutes, hours, days,
+                        weeks, months, years; format relative: 1.0)
        @param dbif The database interface to be used
        @param interval If True, time intervals are created in case the start
-                        time and an increment is provided
+                       time and an increment is provided
        @param fs Field separator used in input file
     """
 
@@ -66,18 +66,20 @@
     end_time_in_file = False
 
     if maps and file:
-        core.fatal(_("%s= and %s= are mutually exclusive") % ("maps", "file"))
+        core.fatal(_("%(m)s= and %(f)s= are mutually exclusive") % {'m': "maps",
+                                                                    'f': "file"})
 
     if end and increment:
-        core.fatal(_("%s= and %s= are mutually exclusive") % (
-            "end", "increment"))
+        core.fatal(_("%(e)s= and %(i)s= are mutually exclusive") % {'e': "end",
+                   'i': "increment"})
 
     if end and not start:
-        core.fatal(_("Please specify %s= and %s=") % ("start_time",
-                                                      "end_time"))
+        core.fatal(_("Please specify %(st)s= and %(e)s=") % {'st': "start_time",
+                                                             'e': "end_time"})
 
     if not maps and not file:
-        core.fatal(_("Please specify %s= or %s=") % ("maps", "file"))
+        core.fatal(_("Please specify %(m)s= or %(f)s=") % {'m': "maps",
+                                                           'f': "file"})
 
     # We may need the mapset
     mapset = core.gisenv()["MAPSET"]
@@ -107,15 +109,17 @@
 
         if not sp.is_in_db(dbif):
             dbif.close()
-            core.fatal(_("Space time %s dataset <%s> no found") %
-                       (sp.get_new_map_instance(None).get_type(), name))
+            core.fatal(_("Space time %(sp)s dataset <%(name)s> no found") %
+                         {'sp': sp.get_new_map_instance(None).get_type(),
+                          'name': name})
 
         if sp.is_time_relative() and not unit:
             dbif.close()
-            core.fatal(_("Space time %s dataset <%s> with relative time found, "
-                         "but no relative unit set for %s maps") %
-                       (sp.get_new_map_instance(None).get_type(),
-                        name, sp.get_new_map_instance(None).get_type()))
+            core.fatal(_("Space time %(sp)s dataset <%(name)s> with relative"
+                         " time found, but no relative unit set for %(sp)s "
+                         "maps") % {
+                         'sp': sp.get_new_map_instance(None).get_type(),
+                         'name': name})
 
     # We need a dummy map object to build the map ids
     dummy = dataset_factory(type, None)
@@ -183,7 +187,7 @@
     core.message(_("Gathering map informations"))
 
     for count in range(len(maplist)):
-        if count%50 == 0:
+        if count % 50 == 0:
             core.percent(count, num_maps, 1)
 
         # Get a new instance of the map type
@@ -204,13 +208,16 @@
             if start == "" or start is None:
                 dbif.close()
                 if map.get_layer():
-                    core.fatal(_("Unable to register %s map <%s> with layer %s. "
-                                 "The map has no valid time and the start time is not set.") %
-                               (map.get_type(), map.get_map_id(), map.get_layer()))
+                    core.fatal(_("Unable to register %(t)s map <%(id)s> with "
+                                 "layer %(l)s. The map has no valid time and "
+                                 "the start time is not set.") % {
+                                 't': map.get_type(), 'id': map.get_map_id(),
+                                 'l': map.get_layer()})
                 else:
-                    core.fatal(_("Unable to register %s map <%s>. The map has no valid"
-                                 " time and the start time is not set.") %
-                               (map.get_type(), map.get_map_id()))
+                    core.fatal(_("Unable to register %(t)s map <%(id)s>. The"
+                                 " map has no valid time and the start time "
+                                 "is not set.") % {'t': map.get_type(),
+                                                   'id': map.get_map_id()})
 
             if unit:
                 map.set_time_to_relative()
@@ -219,52 +226,57 @@
 
         else:
             is_in_db = True
-            
             # Check the overwrite flag
-            if not core.overwrite():                        
+            if not core.overwrite():
                 if map.get_layer():
-                    core.warning(_("Map is already registered in temporal database. "
-                                   "Unable to update %s map <%s> with layer %s. "
-                                   "Overwrite flag is not set.") %
-                               (map.get_type(), map.get_map_id(), str(map.get_layer())))
+                    core.warning(_("Map is already registered in temporal "
+                                   "database. Unable to update %(t)s map "
+                                   "<%(id)s> with layer %(l)s. Overwrite flag"
+                                   " is not set.") % {'t': map.get_type(),
+                                                      'id': map.get_map_id(),
+                                                      'l': str(map.get_layer())})
                 else:
-                    core.warning(_("Map is already registered in temporal database. "
-                                   "Unable to update %s map <%s>. "
-                                   "Overwrite flag is not set.") %
-                               (map.get_type(), map.get_map_id()))
-                
+                    core.warning(_("Map is already registered in temporal "
+                                   "database. Unable to update %(t)s map "
+                                   "<%(id)s>. Overwrite flag is not set.") % {
+                                   't': map.get_type(), 'id': map.get_map_id()})
+
                 # Simple registration is allowed
                 if name:
                     map_object_list.append(map)
                 # Jump to next map
                 continue
-            
+
             # Select information from temporal database
             map.select(dbif)
-            
+
             # Save the datasets that must be updated
             datasets = map.get_registered_datasets(dbif)
             if datasets:
                 for dataset in datasets:
                     datatsets_to_modify[dataset["id"]] = dataset["id"]
-                
+
                 if name and map.get_temporal_type() != sp.get_temporal_type():
                     dbif.close()
                     if map.get_layer():
-                        core.fatal(_("Unable to update %s map <%s> with layer. "
-                                     "The temporal types are different.") %
-                                   (map.get_type(), map.get_map_id(), map.get_layer()))
+                        core.fatal(_("Unable to update %(t)s map <%(id)s> "
+                                     "with layer %(l)s. The temporal types "
+                                     "are different.") % {'t': map.get_type(),
+                                                        'id': map.get_map_id(),
+                                                        'l': map.get_layer()})
                     else:
-                        core.fatal(_("Unable to update %s map <%s>. "
+                        core.fatal(_("Unable to update %(t)s map <%(id)s>. "
                                      "The temporal types are different.") %
-                                   (map.get_type(), map.get_map_id()))
+                                     {'t': map.get_type(),
+                                      'id': map.get_map_id()})
 
         # Load the data from the grass file database
         map.load()
 
         # Set the valid time
         if start:
-            # In case the time is in the input file we ignore the increment counter
+            # In case the time is in the input file we ignore the increment
+            # counter
             if start_time_in_file:
                 count = 1
             assign_valid_time_to_map(ttype=map.get_temporal_type(),
@@ -279,7 +291,8 @@
             #  Gather the SQL insert statement
             statement += map.insert(dbif=dbif, execute=False)
 
-        # Sqlite3 performace better for huge datasets when committing in small chunks
+        # Sqlite3 performace better for huge datasets when committing in
+        # small chunks
         if dbif.dbmi.__name__ == "sqlite3":
             if count % 100 == 0:
                 if statement is not None and statement != "":
@@ -304,7 +317,7 @@
         num_maps = len(map_object_list)
         core.message(_("Register maps in the space time raster dataset"))
         for map in map_object_list:
-            if count%50 == 0:
+            if count % 50 == 0:
                 core.percent(count, num_maps, 1)
             sp.register_map(map=map, dbif=dbif)
             count += 1
@@ -314,7 +327,7 @@
         core.message(_("Update space time raster dataset"))
         sp.update_from_registered_maps(dbif)
         sp.update_command_string(dbif=dbif)
-    
+
     # Update affected datasets
     if datatsets_to_modify:
         for dataset in datatsets_to_modify:
@@ -335,7 +348,8 @@
 
 ###############################################################################
 
-def assign_valid_time_to_map(ttype, map, start, end, unit, increment=None, mult=1, interval=False):
+def assign_valid_time_to_map(ttype, map, start, end, unit, increment=None,
+                             mult=1, interval=False):
     """!Assign the valid time to a map dataset
 
        @param ttype The temporal type which should be assigned

Modified: grass/trunk/lib/python/temporal/stds_export.py
===================================================================
--- grass/trunk/lib/python/temporal/stds_export.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/stds_export.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -76,8 +76,8 @@
                 gdal_type = "UInt32"
             else:
                 gdal_type = "Int32"
-            ret = core.run_command("r.out.gdal", flags="c", input=name, 
-                                   output=out_name, nodata=nodata, 
+            ret = core.run_command("r.out.gdal", flags="c", input=name,
+                                   output=out_name, nodata=nodata,
                                    type=gdal_type, format="GTiff")
         else:
             ret = core.run_command("r.out.gdal", flags="c",
@@ -140,8 +140,8 @@
         # Write the filename, the start_time and the end_time
         list_file.write(string)
         # Export the vector map with v.out.ogr
-        ret = core.run_command("v.out.ogr", input=name, 
-                               dsn=(name + ".xml"), layer=layer, format="GML")
+        ret = core.run_command("v.out.ogr", input=name, dsn=(name + ".xml"),
+                               layer=layer, format="GML")
         if ret != 0:
             shutil.rmtree(new_cwd)
             tar.close()
@@ -210,7 +210,7 @@
 ############################################################################
 
 
-def export_stds(input, output, compression, workdir, where, format_="pack", 
+def export_stds(input, output, compression, workdir, where, format_="pack",
                 type_="strds"):
     """
             !Export space time datasets as tar archive with optional compression
@@ -249,8 +249,8 @@
     sp = dataset_factory(type_, id)
 
     if sp.is_in_db() == False:
-        core.fatal(_("Space time %s dataset <%s> not found") % (
-            sp.get_new_map_instance(None).get_type(), id))
+        core.fatal(_("Space time %(sp)s dataset <%(i)s> not found") % {
+                     'sp': sp.get_new_map_instance(None).get_type(), 'i': id})
 
     # Save current working directory path
     old_cwd = os.getcwd()
@@ -309,16 +309,17 @@
     init_file = open(init_file_name, "w")
     # Create the init string
     string = ""
-     # This is optional, if not present strds will be assumed for backward 
+     # This is optional, if not present strds will be assumed for backward
      # compatibility
-    string += "%s=%s\n" % ("stds_type", sp.get_type()) 
-     # This is optional, if not present gtiff will be assumed for 
+    string += "%s=%s\n" % ("stds_type", sp.get_type())
+     # This is optional, if not present gtiff will be assumed for
      # backward compatibility
-    string += "%s=%s\n" % ("format", format_) 
+    string += "%s=%s\n" % ("format", format_)
     string += "%s=%s\n" % ("temporal_type", sp.get_temporal_type())
     string += "%s=%s\n" % ("semantic_type", sp.get_semantic_type())
     if sp.is_time_relative():
-	string += "%s=%s\n" % ("relative_time_unit", sp.get_relative_time_unit())
+        string += "%s=%s\n" % ("relative_time_unit",
+                               sp.get_relative_time_unit())
     string += "%s=%s\n" % ("number_of_maps", sp.metadata.get_number_of_maps())
     north, south, east, west, top, bottom = sp.get_spatial_extent_as_tuple()
     string += "%s=%s\n" % ("north", north)

Modified: grass/trunk/lib/python/temporal/stds_import.py
===================================================================
--- grass/trunk/lib/python/temporal/stds_import.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/stds_import.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -32,13 +32,9 @@
 @author Soeren Gebbert
 """
 
-import shutil
 import os
 import os.path
 import tarfile
-import tempfile
-import time
-import filecmp
 
 import core
 from space_time_datasets import *
@@ -57,6 +53,7 @@
 
 ############################################################################
 
+
 def _import_raster_maps_from_geotiff(maplist, overr, exp, location, link):
     impflags = ""
     if overr:
@@ -93,8 +90,9 @@
 
 ############################################################################
 
+
 def _import_raster_maps(maplist):
-    # We need to disable the projection check because of its 
+    # We need to disable the projection check because of its
     # simple implementation
     impflags = "o"
     for row in maplist:
@@ -111,6 +109,7 @@
 
 ############################################################################
 
+
 def _import_vector_maps_from_gml(maplist, overr, exp, location, link):
     impflags = "o"
     if exp or location:
@@ -129,8 +128,9 @@
 
 ############################################################################
 
+
 def _import_vector_maps(maplist):
-    # We need to disable the projection check because of its 
+    # We need to disable the projection check because of its
     # simple implementation
     impflags = "o"
     for row in maplist:
@@ -152,8 +152,8 @@
         imported_maps[name] = name
 ############################################################################
 
-def import_stds(
-    input, output, extrdir, title=None, descr=None, location=None,
+
+def import_stds(input, output, extrdir, title=None, descr=None, location=None,
         link=False, exp=False, overr=False, create=False, stds_type="strds"):
     """!Import space time datasets of type raster and vector
 
@@ -161,18 +161,18 @@
         @param output The name of the output space time dataset
         @param extrdir The extraction directory
         @param title The title of the new created space time dataset
-        @param descr The description of the new created 
-                            space time dataset
+        @param descr The description of the new created
+                     space time dataset
         @param location The name of the location that should be created,
                         maps are imported into this location
         @param link Switch to link raster maps instead importing them
         @param exp Extend location extents based on new dataset
         @param overr Override projection (use location's projection)
-        @param create Create the location specified by the "location" 
+        @param create Create the location specified by the "location"
                       parameter and exit.
                       Do not import the space time datasets.
-        @param stds_type The type of the space time dataset that 
-                          should be imported
+        @param stds_type The type of the space time dataset that
+                         should be imported
     """
 
     global raise_on_error
@@ -224,7 +224,8 @@
             else:
                 core.fatal(_("Projection information does not match. Aborting."))
 
-    # Create a new location based on the projection information and switch into it
+    # Create a new location based on the projection information and switch
+    # into it
     old_env = core.gisenv()
     if location:
         try:
@@ -237,8 +238,8 @@
                 os.chdir(old_cwd)
                 return
         except Exception as e:
-            core.fatal(_("Unable to create location %s. Reason: %s")
-                       % (location, str(e)))
+            core.fatal(_("Unable to create location %(l)s. Reason: %(e)s")
+                         % {'l': location, 'e': str(e)})
         # Switch to the new created location
         ret = core.run_command("g.mapset", mapset="PERMANENT",
                                location=location,
@@ -300,8 +301,10 @@
         if "temporal_type" not in init or \
            "semantic_type" not in init or \
            "number_of_maps" not in init:
-            core.fatal(_("Key words %s, %s or %s not found in init file.") %
-                       ("temporal_type", "semantic_type", "number_of_maps"))
+            core.fatal(_("Key words %(t)s, %(s)s or %(n)s not found in init"
+                         " file.") % {'t': "temporal_type",
+                                      's': "semantic_type",
+                                      'n': "number_of_maps"})
 
         if line_count != int(init["number_of_maps"]):
             core.fatal(_("Number of maps mismatch in init and list file."))
@@ -346,9 +349,9 @@
         id = output + "@" + mapset
         sp = dataset_factory(_type, id)
         if sp.is_in_db() and core.overwrite() == False:
-            core.fatal(_("Space time %s dataset <%s> is already in the "
-                         "database. Use the overwrite flag.") % \
-                        (_type, sp.get_id()))
+            core.fatal(_("Space time %(t)s dataset <%(sp)s> is already in the "
+                         "database. Use the overwrite flag.") % {'t': _type,
+                                                                 'sp': sp.get_id()})
 
         # Import the maps
         if _type == "strds":
@@ -366,27 +369,27 @@
 
         # Create the space time dataset
         if sp.is_in_db() and core.overwrite() == True:
-            core.info(_("Overwrite space time %s dataset "
-                        "<%s> and unregister all maps.") % \
-                       (sp.get_new_map_instance(None).get_type(), sp.get_id()))
+            core.info(_("Overwrite space time %(sp)s dataset "
+                        "<%(id)s> and unregister all maps.") % {
+                        'sp': sp.get_new_map_instance(None).get_type(),
+                        'id': sp.get_id()})
             sp.delete()
             sp = sp.get_new_instance(id)
 
         temporal_type = init["temporal_type"]
         semantic_type = init["semantic_type"]
         relative_time_unit = None
-        
-        if temporal_type == "relative":        
+        if temporal_type == "relative":
             if "relative_time_unit" not in init:
-                core.fatal(_("Key word %s not found in init file.") %("relative_time_unit"))
+                core.fatal(_("Key word %s not found in init file.") % ("relative_time_unit"))
             relative_time_unit = init["relative_time_unit"]
             sp.set_relative_time_unit(relative_time_unit)
-        
+
         core.verbose(_("Create space time %s dataset.") %
                      sp.get_new_map_instance(None).get_type())
 
-        sp.set_initial_values(temporal_type=temporal_type, 
-                              semantic_type=semantic_type, title=title, 
+        sp.set_initial_values(temporal_type=temporal_type,
+                              semantic_type=semantic_type, title=title,
                               description=descr)
         sp.insert()
 
@@ -394,7 +397,7 @@
         fs = "|"
         register_maps_in_space_time_dataset(
             type=sp.get_new_map_instance(None).get_type(),
-            name=output, file=list_file_name, start="file", 
+            name=output, file=list_file_name, start="file",
             end="file", unit=relative_time_unit, dbif=None, fs=fs)
 
         os.chdir(old_cwd)
@@ -408,5 +411,5 @@
             ret = core.run_command("g.mapset", mapset=old_env["MAPSET"],
                                    location=old_env["LOCATION_NAME"],
                                    gisdbase=old_env["GISDBASE"])
-        
+
         core.set_raise_on_error(old_state)

Modified: grass/trunk/lib/python/temporal/univar_statistics.py
===================================================================
--- grass/trunk/lib/python/temporal/univar_statistics.py	2013-06-20 12:13:46 UTC (rev 56822)
+++ grass/trunk/lib/python/temporal/univar_statistics.py	2013-06-20 13:02:29 UTC (rev 56823)
@@ -29,7 +29,8 @@
 ###############################################################################
 
 
-def print_gridded_dataset_univar_statistics(type, input, where, extended, header, fs):
+def print_gridded_dataset_univar_statistics(type, input, where, extended,
+                                            header, fs):
     """!Print univariate statistics for a space time raster or raster3d dataset
 
        @param type Must be "strds" or "str3ds"
@@ -55,8 +56,8 @@
 
     if sp.is_in_db(dbif) == False:
         dbif.close()
-        core.fatal(_("Space time %s dataset <%s> not found") % (
-            sp.get_new_map_instance(None).get_type(), id))
+        core.fatal(_("Space time %(sp)s dataset <%(i)s> not found") % {
+                     'sp': sp.get_new_map_instance(None).get_type(), 'i': id})
 
     sp.select(dbif)
 
@@ -65,8 +66,8 @@
 
     if not rows:
         dbif.close()
-        core.fatal(_("Space time %s dataset <%s> is empty") % (
-            sp.get_new_map_instance(None).get_type(), id))
+        core.fatal(_("Space time %(sp)s dataset <%(i)s> is empty") % {
+                     'sp': sp.get_new_map_instance(None).get_type(), 'i': id})
 
     if header == True:
         print "id" + fs + "start" + fs + "end" + fs + "mean" + fs + \
@@ -115,13 +116,13 @@
 ###############################################################################
 
 
-def print_vector_dataset_univar_statistics(input, twhere, layer, type, column, 
+def print_vector_dataset_univar_statistics(input, twhere, layer, type, column,
                                            where, extended, header, fs):
     """!Print univariate statistics for a space time vector dataset
 
        @param input The name of the space time dataset
        @param twhere A temporal database where statement
-       @param layer The layer number used in case no layer is present 
+       @param layer The layer number used in case no layer is present
               in the temporal dataset
        @param type options: point,line,boundary,centroid,area
        @param column The name of the attribute column
@@ -146,8 +147,8 @@
 
     if sp.is_in_db(dbif) == False:
         dbif.close()
-        core.fatal(_("Space time %s dataset <%s> not found") % (
-            sp.get_new_map_instance(None).get_type(), id))
+        core.fatal(_("Space time %(sp)s dataset <%(i)s> not found") % {
+                     'sp': sp.get_new_map_instance(None).get_type(), 'i': id})
 
     sp.select(dbif)
 
@@ -156,8 +157,8 @@
 
     if not rows:
         dbif.close()
-        core.fatal(_("Space time %s dataset <%s> is empty") % (
-            sp.get_new_map_instance(None).get_type(), id))
+        core.fatal(_("Space time %(sp)s dataset <%(i)s> is empty") % {
+                     'sp': sp.get_new_map_instance(None).get_type(), 'i': id})
 
     string = ""
     if header == True:
@@ -191,7 +192,7 @@
             mylayer = layer
 
         stats = core.parse_command("v.univar", map=id, where=where,
-                                   column=column, layer=mylayer, 
+                                   column=column, layer=mylayer,
                                    type=type, flags=flags)
 
         string = ""
@@ -211,11 +212,11 @@
                     str(stats["mean_abs"]) + fs + \
                     str(stats["population_stddev"]) + fs + \
                     str(stats["population_variance"])
-                    
+
                     string += fs + str(stats["population_coeff_variation"]) + \
                     fs + str(stats["sample_stddev"]) + fs + \
                     str(stats["sample_variance"])
-                    
+
                     string += fs + str(stats["kurtosis"]) + fs + \
                     str(stats["skewness"])
                 else:



More information about the grass-commit mailing list