[GRASS-SVN] r69027 - in grass/branches/releasebranch_7_2: lib/python/temporal lib/python/temporal/testsuite temporal/t.rast.algebra temporal/t.rast.algebra/testsuite temporal/t.select

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 22 12:13:51 PDT 2016


Author: huhabla
Date: 2016-07-22 12:13:51 -0700 (Fri, 22 Jul 2016)
New Revision: 69027

Modified:
   grass/branches/releasebranch_7_2/lib/python/temporal/temporal_algebra.py
   grass/branches/releasebranch_7_2/lib/python/temporal/temporal_operator.py
   grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster3d_algebra.py
   grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster_algebra.py
   grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster_base_algebra.py
   grass/branches/releasebranch_7_2/lib/python/temporal/temporal_vector_algebra.py
   grass/branches/releasebranch_7_2/lib/python/temporal/testsuite/unittests_temporal_algebra_grs.py
   grass/branches/releasebranch_7_2/lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py
   grass/branches/releasebranch_7_2/temporal/t.rast.algebra/t.rast.algebra.py
   grass/branches/releasebranch_7_2/temporal/t.rast.algebra/testsuite/test_raster_algebra.py
   grass/branches/releasebranch_7_2/temporal/t.rast.algebra/testsuite/test_raster_algebra_granularity.py
   grass/branches/releasebranch_7_2/temporal/t.select/t.select.py
Log:
temporal framework: Code cleanup, better readability, better dry-run implementation, dry-run tests


Modified: grass/branches/releasebranch_7_2/lib/python/temporal/temporal_algebra.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/temporal_algebra.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/temporal_algebra.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -582,7 +582,7 @@
     t_QUOTE              = r'[\"\']'
 
     # These are the things that should be ignored.
-    t_ignore = ' \t'
+    t_ignore = ' \t\n'
 
     # Read time string and convert it into a date object
     def t_DATETIME(self, t):
@@ -650,12 +650,13 @@
 
     # Handle errors.
     def t_error(self, t):
-        raise SyntaxError("syntax error on line %d near '%s'" %
-            (t.lineno, t.value))
+        raise SyntaxError("syntax error on line %d position %i near '%s'" %
+                          (t.lineno, t.lexpos, t.value))
 
     # Build the lexer
     def build(self,**kwargs):
-        self.lexer = lex.lex(module=self, optimize=False, debug=False, **kwargs)
+        self.lexer = lex.lex(module=self, optimize=False,
+                             nowarn=True, debug=0, **kwargs)
 
     # Just for testing
     def test(self,data):
@@ -794,7 +795,8 @@
 
         # Check if spatio-temporal operators are present in the expression
         if "{" in expression or "}" in expression:
-            self.msgr.error(_("Spatio temporal operators are not supported in granularity algebra mode"))
+            self.msgr.error(_("Spatio-temporal topological operators are not"
+                              " supported in granularity algebra mode"))
             return False
 
         # detect all STDS
@@ -879,8 +881,7 @@
         self.expression = expression
         self.parser.parse(expression)
 
-        if self.dry_run is True:
-            return self.process_chain_dict
+        return self.process_chain_dict
 
     def generate_map_name(self):
         """Generate an unique  map name and register it in the objects map list
@@ -897,8 +898,10 @@
         self.names[name] = name
         return name
 
-    def generate_new_map(self, base_map, bool_op='and',
-                         copy=True,  rename=True,
+    def generate_new_map(self, base_map,
+                         bool_op='and',
+                         copy=True,
+                         rename=True,
                          remove=False):
         """Generate a new map using the spatio-temporal extent of the base map
 
@@ -919,7 +922,7 @@
         # Create new map based on the related map list.
         map_new = base_map.get_new_instance(mapname)
         # Set initial map extend of new vector map.
-        self.overlay_map_extent(map_new, base_map, bool_op = bool_op, copy = copy)
+        self.overlay_map_extent(map_new, base_map, bool_op=bool_op, copy=copy)
         if not rename:
             name = base_map.get_id()
             map_new.set_id(name)
@@ -929,8 +932,12 @@
         map_new.uid = name
         return map_new
 
-    def overlay_map_extent(self, mapA, mapB, bool_op = None, temp_op = 'l',
-                            copy = False):
+    def overlay_map_extent(self,
+                           mapA,
+                           mapB,
+                           bool_op=None,
+                           temp_op='l',
+                           copy=False):
         """Compute the spatio-temporal extent of two topological related maps
 
            :param mapA: The first map
@@ -1003,7 +1010,10 @@
                     returncode = 0
         return(returncode)
 
-    def set_temporal_extent_list(self, maplist, topolist = ["EQUAL"], temporal = 'l' ):
+    def set_temporal_extent_list(self,
+                                 maplist,
+                                 topolist=["EQUAL"],
+                                 temporal='l' ):
         """ Change temporal extent of map list based on temporal relations to
                 other map list and given temporal operator.
 
@@ -1083,7 +1093,9 @@
                 self.msgr.message(_("Removing un-needed or empty %s maps"%(key)))
                 self._remove_maps(map_names[key],  key)
 
-    def _remove_maps(self,  namelist,  map_type):
+    def _remove_maps(self,
+                     namelist,
+                     map_type):
         """Remove maps of specific type
 
             :param namelist: List of map names to be removed
@@ -1105,17 +1117,20 @@
                 if self.dry_run is False:
                     m.run()
 
-    def check_stds(self, input, clear=False,  stds_type=None,  check_type=True):
+    def check_stds(self,
+                   input,
+                   clear=False,
+                   stds_type=None,
+                   check_type=True):
         """ Check if input space time dataset exist in database and return its map list.
 
-            :param input: Name of space time data set as string or list of maps.
-            :param clear: Reset the stored conditional values to empty list.
-            :param check_type: Check the type of the space time dataset to match the global stds type
-            :param stds_type: The type of the space time dataset to be opened, if not provided
-                                          then self.stdstype will be used
+        :param input: Name of space time data set as string or list of maps.
+        :param clear: Reset the stored conditional values to empty list.
+        :param check_type: Check the type of the space time dataset to match the global stds type
+        :param stds_type: The type of the space time dataset to be opened, if not provided
+                                      then self.stdstype will be used
 
-            :return: List of maps.
-
+        :return: List of maps.
         """
         if isinstance(input, str):
             # Check for mapset in given stds input.
@@ -1129,7 +1144,7 @@
             else:
                 stds = dataset_factory(self.stdstype, id_input)
             # Check for occurrence of space time dataset.
-            if stds.is_in_db(dbif=self.dbif) == False:
+            if stds.is_in_db(dbif=self.dbif) is False:
                 raise FatalError(_("Space time %s dataset <%s> not found") %
                     (stds.get_new_map_instance(None).get_type(), id_input))
             else:
@@ -1153,9 +1168,9 @@
                     if "condition_value" not in dir(map_i):
                         map_i.condition_value = []
                     # Set and check global temporal type variable and map.
-                    if map_i.is_time_absolute() and self.temporaltype == None:
+                    if map_i.is_time_absolute() and self.temporaltype is None:
                         self.temporaltype = 'absolute'
-                    elif map_i.is_time_relative() and self.temporaltype == None:
+                    elif map_i.is_time_relative() and self.temporaltype is None:
                         self.temporaltype = 'relative'
                     elif map_i.is_time_absolute() and self.temporaltype == 'relative':
                         self.msgr.fatal(_("Wrong temporal type of space time dataset <%s> \
@@ -1165,11 +1180,11 @@
                         self.msgr.fatal(_("Wrong temporal type of space time dataset <%s> \
                                       <%s> time is required") %
                                      (id_input, self.temporaltype))
-        elif isinstance(input,  self.mapclass):
+        elif isinstance(input, self.mapclass):
             # Check if the input is a single map and return it as list with one entry.
             maplist = [input]
 
-        elif isinstance(input,  list):
+        elif isinstance(input, list):
             maplist = input
             # Create map_value as empty list item.
             for map_i in maplist:
@@ -1194,9 +1209,15 @@
 
         return(maplist)
 
-    def get_temporal_topo_list(self, maplistA, maplistB = None, topolist = ["EQUAL"],
-                               assign_val = False, count_map = False, compare_bool = False,
-                               compop = None, aggregate = None):
+    def get_temporal_topo_list(self,
+                               maplistA,
+                               maplistB=None,
+                               topolist=["EQUAL"],
+                               assign_val=False,
+                               count_map=False,
+                               compare_bool=False,
+                               compop=None,
+                               aggregate=None):
         """Build temporal topology for two space time data sets, copy map objects
           for given relation into map list.
 
@@ -1397,9 +1418,12 @@
 
         return(resultlist)
 
-    def assign_bool_value(self,  map_i, tbrelations, topolist = ["EQUAL"]):
+    def assign_bool_value(self,
+                          map_i,
+                          tbrelations,
+                          topolist=["EQUAL"]):
         """ Function to assign boolean map value based on the map_values from the
-                compared map list by topological relationships.
+        compared map list by topological relationships.
 
           :param map_i: Map object with temporal extent.
           :param tbrelations: List of temporal relation to map_i.
@@ -1428,7 +1452,12 @@
 
         return(resultbool)
 
-    def compare_bool_value(self,  map_i, tbrelations, compop, aggregate,  topolist = ["EQUAL"]):
+    def compare_bool_value(self,
+                           map_i,
+                           tbrelations,
+                           compop,
+                           aggregate,
+                           topolist=["EQUAL"]):
         """ Function to evaluate two map lists with boolean values by boolean
             comparison operator.
 
@@ -1498,8 +1527,12 @@
 
         return(p.relations, p.temporal, p.function,  p.aggregate)
 
-    def perform_temporal_selection(self, maplistA, maplistB, topolist = ["EQUAL"],
-                                   inverse = False, assign_val = False):
+    def perform_temporal_selection(self,
+                                   maplistA,
+                                   maplistB,
+                                   topolist=["EQUAL"],
+                                   inverse=False,
+                                   assign_val=False):
         """This function performs temporal selection operation.
 
           :param maplistA:   List of maps representing the left side of a temporal
@@ -1579,7 +1612,11 @@
         resultlist = sorted(resultlist, key = AbstractDatasetComparisonKeyStartTime)
         return(resultlist)
 
-    def set_granularity(self, maplistA, maplistB, toperator = 'l', topolist = ["EQUAL"]):
+    def set_granularity(self,
+                        maplistA,
+                        maplistB,
+                        toperator='l',
+                        topolist=["EQUAL"]):
         """This function sets the temporal extends of a list of maps based on
              another map list.
 
@@ -1848,7 +1885,7 @@
                 map_i.condition_value = boolname
         return(maplist)
 
-    def eval_map_list(self, maplist ,thenlist, topolist = ["EQUAL"]):
+    def eval_map_list(self, maplist ,thenlist, topolist=["EQUAL"]):
         """ This function transfers boolean values from temporal expression
              from one map list to another by their topology. These boolean
              values are added to the maps as condition_value.
@@ -1874,7 +1911,7 @@
 
         return(resultlist)
 
-    def build_condition_list(self, tvarexpr, thenlist,  topolist = ["EQUAL"]):
+    def build_condition_list(self, tvarexpr, thenlist,  topolist=["EQUAL"]):
         """ This function evaluates temporal variable expressions of a conditional
              expression in two steps.
              At first it combines stepwise the single conditions by their relations with LALR.
@@ -1957,7 +1994,7 @@
              A recursive function is used to evaluate comparison statements
              from left to right in the given conditional list.
 
-             For example:
+             For example::
 
                   - [True,  '||', False, '&&', True]  -> True
                   - [True,  '||', False, '&&', False] -> False
@@ -2089,11 +2126,11 @@
                             m.flags["overwrite"].value = self.overwrite
 
                             if map_i.get_type() == 'raster':
-                                m.inputs["raster"].value = map_i.get_id(),  newident
+                                m.inputs["raster"].value = map_i.get_id(), newident
                             elif map_i.get_type() == 'raster3d':
-                                m.inputs["raster_3d"].value = map_i.get_id(),  newident
+                                m.inputs["raster_3d"].value = map_i.get_id(), newident
                             elif map_i.get_type() == 'vector':
-                                m.inputs["vector"].value = map_i.get_id(),  newident
+                                m.inputs["vector"].value = map_i.get_id(), newident
 
                             # Add the process description to the dict
                             self.process_chain_dict["processes"].append(m.get_dict())
@@ -2206,7 +2243,7 @@
         expr : STRDS LPAREN stds RPAREN
         """
         if self.run:
-            t[0] = self.check_stds(t[3], stds_type = "strds",  check_type=False)
+            t[0] = self.check_stds(t[3], stds_type = "strds", check_type=False)
         else:
             t[0] = t[3]
             if self.debug:
@@ -2219,7 +2256,7 @@
         expr : STR3DS LPAREN stds RPAREN
         """
         if self.run:
-            t[0] = self.check_stds(t[3], stds_type = "str3ds",  check_type=False)
+            t[0] = self.check_stds(t[3], stds_type = "str3ds", check_type=False)
         else:
             t[0] = t[3]
             if self.debug:
@@ -2233,7 +2270,7 @@
         """
         if self.run:
             print(t[3])
-            t[0] = self.check_stds(t[3], stds_type = "stvds",  check_type=False)
+            t[0] = self.check_stds(t[3], stds_type = "stvds", check_type=False)
         else:
             t[0] = t[3]
             if self.debug:
@@ -2332,8 +2369,9 @@
         if self.run:
             maplistA   = self.check_stds(t[1])
             maplistB   = self.check_stds(t[3])
-            resultlist = self.get_temporal_topo_list(maplistA, maplistB,
-                                                     count_map = True)
+            resultlist = self.get_temporal_topo_list(maplistA,
+                                                     maplistB,
+                                                     count_map=True)
             t[0] = resultlist
 
     def p_t_hash2(self,t):
@@ -2348,8 +2386,10 @@
             maplistA   = self.check_stds(t[1])
             maplistB   = self.check_stds(t[3])
             topolist   = self.eval_toperator(t[2], optype='hash')[0]
-            resultlist = self.get_temporal_topo_list(maplistA, maplistB, topolist,
-                                                     count_map = True)
+            resultlist = self.get_temporal_topo_list(maplistA,
+                                                     maplistB,
+                                                     topolist,
+                                                     count_map=True)
             t[0] = resultlist
 
     def p_t_hash_paren(self, t):
@@ -2431,7 +2471,7 @@
         #    A # B == 2
         #    td(A) < 31
         """
-        t_var_expr : t_td_var comp_op number
+        t_var_expr : t_td_var   comp_op number
                    | t_hash_var comp_op number
         """
         if self.run:
@@ -2493,18 +2533,18 @@
         # TODO:  Implement statement in backward direction:
         # TIME comp_op START_TIME LPAREN stds RPAREN
         """
-        t_var_expr : START_TIME LPAREN stds RPAREN comp_op TIME
-                   | START_DATE LPAREN stds RPAREN comp_op DATE
+        t_var_expr : START_TIME     LPAREN stds RPAREN comp_op TIME
+                   | START_DATE     LPAREN stds RPAREN comp_op DATE
                    | START_DATETIME LPAREN stds RPAREN comp_op DATETIME
-                   | END_TIME LPAREN stds RPAREN comp_op TIME
-                   | END_DATE LPAREN stds RPAREN comp_op DATE
-                   | END_DATETIME LPAREN stds RPAREN comp_op DATETIME
-                   | START_TIME LPAREN expr RPAREN comp_op TIME
-                   | START_DATE LPAREN expr RPAREN comp_op DATE
+                   | END_TIME       LPAREN stds RPAREN comp_op TIME
+                   | END_DATE       LPAREN stds RPAREN comp_op DATE
+                   | END_DATETIME   LPAREN stds RPAREN comp_op DATETIME
+                   | START_TIME     LPAREN expr RPAREN comp_op TIME
+                   | START_DATE     LPAREN expr RPAREN comp_op DATE
                    | START_DATETIME LPAREN expr RPAREN comp_op DATETIME
-                   | END_TIME LPAREN expr RPAREN comp_op TIME
-                   | END_DATE LPAREN expr RPAREN comp_op DATE
-                   | END_DATETIME LPAREN expr RPAREN comp_op DATETIME
+                   | END_TIME       LPAREN expr RPAREN comp_op TIME
+                   | END_DATE       LPAREN expr RPAREN comp_op DATE
+                   | END_DATETIME   LPAREN expr RPAREN comp_op DATETIME
         """
         if self.run:
             # Check input maplist.
@@ -2627,7 +2667,7 @@
         # The temporal topology relation equals is implicit
         # Examples:
         #    A {!:} B  # Select the part of A that is temporally unequal to B
-        #    A  {:} B  # Select the part of A that is temporally equal B
+        #    A { :} B  # Select the part of A that is temporally equal B
         #    A {!:, equals} B          # Select the part of A that is temporally unequal to B
         #    A {!:, during} B          # Select the part of A that is temporally not during B
         #    A {:, overlaps} B         # Select the part of A that temporally overlaps B
@@ -2734,8 +2774,8 @@
             elseresult   = self.eval_condition_list(elsecond, inverse = True)
 
             # Combine and sort else and then statement to result map list.
-            combilist = thenresult + elseresult
-            resultlist = sorted(combilist, key = AbstractDatasetComparisonKeyStartTime)
+            combilist    = thenresult + elseresult
+            resultlist   = sorted(combilist, key = AbstractDatasetComparisonKeyStartTime)
             # Clear the map and conditional values of the map list.
             resultlist   = self.check_stds(resultlist, clear = True)
             # Return resulting map list.
@@ -2763,7 +2803,7 @@
             elselist     = self.check_stds(t[9])
             # Get temporal conditional statement.
             tvarexpr     = t[5]
-            topolist     = self.eval_toperator(t[3],  optype = 'relation')[0]
+            topolist     = self.eval_toperator(t[3],  optype='relation')[0]
             thencond     = self.build_condition_list(tvarexpr, thenlist, topolist)
             thenresult   = self.eval_condition_list(thencond)
             elsecond     = self.build_condition_list(tvarexpr, elselist, topolist)
@@ -2793,8 +2833,8 @@
         # buff_t(A : B, "10 minutes")  # Select the part of A that is temporally
         #                                equal to B and create a buffer of 10 minutes around
         """
-        expr : BUFF_T LPAREN stds COMMA QUOTE number NAME QUOTE RPAREN
-             | BUFF_T LPAREN expr COMMA QUOTE number NAME QUOTE RPAREN
+        expr : BUFF_T LPAREN stds COMMA QUOTE  number NAME QUOTE RPAREN
+             | BUFF_T LPAREN expr COMMA QUOTE  number NAME QUOTE RPAREN
              | BUFF_T LPAREN stds COMMA number RPAREN
              | BUFF_T LPAREN expr COMMA number RPAREN
         """
@@ -2815,7 +2855,7 @@
 
         if self.debug:
             if len(t) == 10:
-                print(str(t[3]) + "* = buff_t(", str(t[3]), "," , '"', str(t[6]), str(t[7]), '"', ")")
+                print(str(t[3]) + "* = buff_t(", str(t[3]), ",", '"', str(t[6]), str(t[7]), '"', ")")
             elif len(t) == 7:
                 print(str(t[3]) + "* = buff_t(", str(t[3]), ",", str(t[5]), ")")
 
@@ -2843,8 +2883,8 @@
         # tshift(A : B, "10 minutes")  # Shift the selection from A temporally
         #                                by 10 minutes.
         """
-        expr : TSHIFT LPAREN stds COMMA QUOTE number NAME QUOTE RPAREN
-             | TSHIFT LPAREN expr COMMA QUOTE number NAME QUOTE RPAREN
+        expr : TSHIFT LPAREN stds COMMA QUOTE  number NAME QUOTE RPAREN
+             | TSHIFT LPAREN expr COMMA QUOTE  number NAME QUOTE RPAREN
              | TSHIFT LPAREN stds COMMA number RPAREN
              | TSHIFT LPAREN expr COMMA number RPAREN
         """
@@ -2857,7 +2897,8 @@
             elif len(t) == 7:
                 increment = str(t[5])
             # Perform shifting.
-            shiftlist = AbstractSpaceTimeDataset.shift_map_list(maplist, increment)
+            shiftlist = AbstractSpaceTimeDataset.shift_map_list(maplist,
+                                                                increment)
             t[0] = shiftlist
         else:
             t[0] = t[3] + "*"
@@ -2871,8 +2912,8 @@
     # Handle errors.
     def p_error(self, t):
         if t:
-            raise SyntaxError("syntax error on line %d, token %s near '%s' expression '%s'" %
-                             (t.lineno, t.type, t.value, self.expression))
+            raise SyntaxError("syntax error on line %d, position %i token %s near '%s' expression '%s'" %
+                              (t.lineno, t.lexpos, t.type, t.value, self.expression))
         else:
             raise SyntaxError("Unexpected syntax error")
 

Modified: grass/branches/releasebranch_7_2/lib/python/temporal/temporal_operator.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/temporal_operator.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/temporal_operator.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -254,7 +254,8 @@
 
     # Build the lexer
     def build(self,**kwargs):
-        self.lexer = lex.lex(module=self, **kwargs)
+        self.lexer = lex.lex(module=self, optimize=False,
+                             nowarn=True, debug=0, **kwargs)
 
     # Just for testing
     def test(self,data):
@@ -274,7 +275,7 @@
     def __init__(self):
         self.lexer = TemporalOperatorLexer()
         self.lexer.build()
-        self.parser = yacc.yacc(module=self)
+        self.parser = yacc.yacc(module=self, debug=0)
         self.relations = None   # Temporal relations (equals, contain, during, ...)
         self.temporal  = None   # Temporal operation (intersect, left, right, ...)
         self.function  = None   # Actual operation (+, -, /, *, ... )

Modified: grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster3d_algebra.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster3d_algebra.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster3d_algebra.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -53,6 +53,8 @@
         self.expression = expression
         self.parser.parse(expression)
 
+        return self.process_chain_dict
+
     ######################### Temporal functions ##############################
 
     def p_statement_assign(self, t):

Modified: grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster_algebra.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster_algebra.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster_algebra.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -95,8 +95,7 @@
         self.expression = expression
         self.parser.parse(expression)
 
-        if self.dry_run is True:
-            return self.process_chain_dict
+        return self.process_chain_dict
 
     ######################### Temporal functions ##############################
 

Modified: grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster_base_algebra.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster_base_algebra.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/temporal_raster_base_algebra.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -143,9 +143,14 @@
                  register_null=False,
                  dry_run=False, nprocs=1):
 
-        TemporalAlgebraParser.__init__(self, pid=pid, run=run, debug=debug,
-                                       spatial=spatial, register_null=register_null,
-                                       dry_run=dry_run, nprocs=nprocs)
+        TemporalAlgebraParser.__init__(self,
+                                       pid=pid,
+                                       run=run,
+                                       debug=debug,
+                                       spatial=spatial,
+                                       register_null=register_null,
+                                       dry_run=dry_run,
+                                       nprocs=nprocs)
 
     def check_null(self, t):
         try:
@@ -160,30 +165,30 @@
                                compare_cmd=False,  compop=None, aggregate=None,
                                new=False,  convert=False,  operator_cmd=False):
         """Build temporal topology for two space time data sets, copy map objects
-          for given relation into map list.
+        for given relation into map list.
 
-          :param maplistA: List of maps.
-          :param maplistB: List of maps.
-          :param topolist: List of strings of temporal relations.
-          :param assign_val: Boolean for assigning a boolean map value based on
-                            the map_values from the compared map list by
-                            topological relationships.
-          :param count_map: Boolean if the number of topological related maps
-                           should be returned.
-          :param compare_bool: Boolean for comparing boolean map values based on
-                            related map list and compariosn operator.
-          :param compare_cmd: Boolean for comparing command list values based on
-                            related map list and compariosn operator.
-          :param compop: Comparison operator, && or ||.
-          :param aggregate: Aggregation operator for relation map list, & or |.
-          :param new: Boolean if new temporary maps should be created.
-          :param convert: Boolean if conditional values should be converted to
-                        r.mapcalc command strings.
-          :param operator_cmd: Boolean for aggregate arithmetic operators implicitly
-                        in command list values based on related map lists.
+        :param maplistA: List of maps.
+        :param maplistB: List of maps.
+        :param topolist: List of strings of temporal relations.
+        :param assign_val: Boolean for assigning a boolean map value based on
+                        the map_values from the compared map list by
+                        topological relationships.
+        :param count_map: Boolean if the number of topological related maps
+                       should be returned.
+        :param compare_bool: Boolean for comparing boolean map values based on
+                        related map list and compariosn operator.
+        :param compare_cmd: Boolean for comparing command list values based on
+                        related map list and compariosn operator.
+        :param compop: Comparison operator, && or ||.
+        :param aggregate: Aggregation operator for relation map list, & or |.
+        :param new: Boolean if new temporary maps should be created.
+        :param convert: Boolean if conditional values should be converted to
+                    r.mapcalc command strings.
+        :param operator_cmd: Boolean for aggregate arithmetic operators implicitly
+                    in command list values based on related map lists.
 
-          :return: List of maps from maplistA that fulfil the topological relationships
-                  to maplistB specified in topolist.
+        :return: List of maps from maplistA that fulfil the topological relationships
+              to maplistB specified in topolist.
         """
         topologylist = ["EQUAL", "FOLLOWS", "PRECEDES", "OVERLAPS", "OVERLAPPED",
                         "DURING", "STARTS", "FINISHES", "CONTAINS", "STARTED",
@@ -206,7 +211,7 @@
         spatialdict = {'strds' : '2D', 'stvds' : '2D', 'str3ds' : '3D'}
         # Build spatial temporal topology
         if self.spatial:
-            tb.build(maplistA, maplistB, spatial = spatialdict[self.stdstype])
+            tb.build(maplistA, maplistB, spatial=spatialdict[self.stdstype])
         else:
             tb.build(maplistA, maplistB)
         # Iterate through maps in maplistA and search for relationships given
@@ -244,19 +249,19 @@
 
     def build_command_string(self, map_i,  relmap, operator = None, cmd_type = None):
         """This function build the r.mapcalc command string for conditionals,
-            spatial variable combinations and boolean comparisons.
+        spatial variable combinations and boolean comparisons.
 
-            For Example: 'if(a1 == 1, b1, c2)' or 'exist(a1) && sin(b1)'
+        For Example: 'if(a1 == 1, b1, c2)' or 'exist(a1) && sin(b1)'
 
-            :param map_i: map object with temporal extent and built relations.
-            :param relmap: map object with defined temporal relation to map_i.
-            :param operator: String representing operator between two spatial variables
-                            (&&,||,+,-,*,/).
-            :param cmd_type: map object with defined temporal relation to map_i:
-                            condition, conclusion or operator.
+        :param map_i: map object with temporal extent and built relations.
+        :param relmap: map object with defined temporal relation to map_i.
+        :param operator: String representing operator between two spatial variables
+                        (&&,||,+,-,*,/).
+        :param cmd_type: map object with defined temporal relation to map_i:
+                        condition, conclusion or operator.
 
-            :return: the resulting command string for conditionals or spatial variable
-                combinations
+        :return: the resulting command string for conditionals or spatial variable
+            combinations
         """
         def sub_cmdstring(map_i):
             """This function search for command string in a map object and
@@ -289,25 +294,27 @@
             if operator == None:
                 self.msgr.fatal("Error: Can't build command string for map %s, operator is missing"
                     %(map_i.get_map_id()))
-            cmdstring = "(%s %s %s)" %(leftsub, operator,  rightsub)
+            cmdstring = "(%s %s %s)" %(leftsub, operator, rightsub)
         return(cmdstring)
 
     def compare_cmd_value(self,  map_i, tbrelations, compop, aggregate,
-                                                topolist = ["EQUAL"],  convert = False):
+                          topolist = ["EQUAL"],  convert = False):
         """ Function to evaluate two map lists with boolean values by boolean
-            comparison operator. Extended temporal algebra version with command
-            list builder for temporal raster algebra.
+        comparison operator.
 
-            :param map_i: Map object with temporal extent.
-            :param tbrelations: List of temporal relation to map_i.
-            :param topolist: List of strings for given temporal relations.
-            :param compop: Comparison operator, && or ||.
-            :param aggregate: Aggregation operator for relation map list, & or |.
-            :param convert: Boolean if conditional values should be converted to
-                        r.mapcalc command strings.
+        Extended temporal algebra version with command
+        list builder for temporal raster algebra.
 
-            :return: Map object with conditional value that has been evaluated by
-                        comparison operators.
+        :param map_i: Map object with temporal extent.
+        :param tbrelations: List of temporal relation to map_i.
+        :param topolist: List of strings for given temporal relations.
+        :param compop: Comparison operator, && or ||.
+        :param aggregate: Aggregation operator for relation map list, & or |.
+        :param convert: Boolean if conditional values should be converted to
+                    r.mapcalc command strings.
+
+        :return: Map object with conditional value that has been evaluated by
+                    comparison operators.
         """
         # Build comandlist list with elements from related maps and given relation operator.
         if convert and "condition_value" in dir(map_i):
@@ -346,13 +353,13 @@
     def operator_cmd_value(self,  map_i, tbrelations, operator, topolist = ["EQUAL"]):
         """ Function to evaluate two map lists by given arithmetic operator.
 
-            :param map_i: Map object with temporal extent.
-            :param tbrelations: List of temporal relation to map_i.
-            :param topolist: List of strings for given temporal relations.
-            :param operator: Arithmetic operator, +-*/%.
+        :param map_i: Map object with temporal extent.
+        :param tbrelations: List of temporal relation to map_i.
+        :param topolist: List of strings for given temporal relations.
+        :param operator: Arithmetic operator, +-*/%.
 
-            :return: Map object with command list with  operators that has been
-                        evaluated by implicit aggregration.
+        :return: Map object with command list with  operators that has been
+                    evaluated by implicit aggregration.
         """
         # Build comandlist list with elements from related maps and given relation operator.
         leftcmd = map_i
@@ -375,20 +382,20 @@
     def set_temporal_extent_list(self, maplist, topolist=["EQUAL"], temporal='l' ,
                                  cmd_bool=False, cmd_type=None,  operator=None):
         """ Change temporal extent of map list based on temporal relations to
-                other map list and given temporal operator.
+        other map list and given temporal operator.
 
-            :param maplist: List of map objects for which relations has been build
-                                        correctely.
-            :param topolist: List of strings of temporal relations.
-            :param temporal: The temporal operator specifying the temporal
-                                            extent operation (intersection, union, disjoint
-                                            union, right reference, left reference).
-            :param cmd_bool: Boolean if command string should be merged for related maps.
-            :param cmd_type: map object with defined temporal relation to map_i:
-                            condition, conclusion or operator.
-            :param operator: String defining the type of operator.
+        :param maplist: List of map objects for which relations has been build
+                                    correctely.
+        :param topolist: List of strings of temporal relations.
+        :param temporal: The temporal operator specifying the temporal
+                                        extent operation (intersection, union, disjoint
+                                        union, right reference, left reference).
+        :param cmd_bool: Boolean if command string should be merged for related maps.
+        :param cmd_type: map object with defined temporal relation to map_i:
+                        condition, conclusion or operator.
+        :param operator: String defining the type of operator.
 
-            :return: Map list with specified temporal extent and optional command string.
+        :return: Map list with specified temporal extent and optional command string.
         """
         resultdict = {}
 
@@ -396,8 +403,10 @@
             # Loop over temporal related maps and create overlay modules.
             tbrelations = map_i.get_temporal_relations()
             # Generate an intermediate map for the result map list.
-            map_new = self.generate_new_map(base_map=map_i, bool_op='and',
-                                            copy=True,  rename=True)
+            map_new = self.generate_new_map(base_map=map_i,
+                                            bool_op='and',
+                                            copy=True,
+                                            rename=True)
 
             # Combine temporal and spatial extents of intermediate map with related maps.
             for topo in topolist:
@@ -405,10 +414,13 @@
                     for map_j in (tbrelations[topo]):
                         if temporal == 'r':
                             # Generate an intermediate map for the result map list.
-                            map_new = self.generate_new_map(base_map=map_i, bool_op='and',
-                                                            copy=True,  rename=True)
+                            map_new = self.generate_new_map(base_map=map_i,
+                                                            bool_op='and',
+                                                            copy=True,
+                                                            rename=True)
                         # Create overlayed map extent.
-                        returncode = self.overlay_map_extent(map_new, map_j, 'and',
+                        returncode = self.overlay_map_extent(map_new, map_j,
+                                                             'and',
                                                              temp_op = temporal)
 
                         # Stop the loop if no temporal or spatial relationship exist.
@@ -444,33 +456,34 @@
                                  conclusion_topolist=["EQUAL"],
                                  temporal='l', null=False):
         """This function build the r.mapcalc command strings for spatial conditionals.
-            For Example: 'if(a1 == 1, b1, c2)'
+        For Example: 'if(a1 == 1, b1, c2)'
 
-            :param iflist: Map list with temporal extents and command list.
-            :param thenlist: Map list with temporal extents and command list or numeric string.
-            :param elselist: Map list with temporal extents and command list or numeric string.
-            :param condition_topolist: List of strings for given temporal relations between
-                            conditions and conclusions.
-            :param conclusion_topolist: List of strings for given temporal relations between
-                            conditions (then and else).
-            :param temporal: The temporal operator specifying the temporal
-                                            extent operation (intersection, union, disjoint
-                                            union, right reference, left reference).
-            :param null: Boolean if null map support should be activated.
+        :param iflist: Map list with temporal extents and command list.
+        :param thenlist: Map list with temporal extents and command list or numeric string.
+        :param elselist: Map list with temporal extents and command list or numeric string.
+        :param condition_topolist: List of strings for given temporal relations between
+                        conditions and conclusions.
+        :param conclusion_topolist: List of strings for given temporal relations between
+                        conditions (then and else).
+        :param temporal: The temporal operator specifying the temporal
+                                        extent operation (intersection, union, disjoint
+                                        union, right reference, left reference).
+        :param null: Boolean if null map support should be activated.
 
-            :return: map list with resulting command string for given condition type.
+        :return: map list with resulting command string for given condition type.
         """
         resultlist = []
         # First merge conclusion command maplists or strings.
         # Check if alternative conclusion map list is given.
         if all([isinstance(thenlist, list), isinstance(elselist, list)]):
             # Build conclusion command map list.
-            conclusiontopolist = self.get_temporal_topo_list(thenlist, elselist,  conclusion_topolist)
+            conclusiontopolist = self.get_temporal_topo_list(thenlist, elselist,
+                                                             conclusion_topolist)
             conclusionlist = self.set_temporal_extent_list(conclusiontopolist,
-                                                           topolist = conclusion_topolist,
-                                                           temporal = temporal ,
-                                                           cmd_bool = True,
-                                                           cmd_type = "conclusion")
+                                                           topolist=conclusion_topolist,
+                                                           temporal=temporal ,
+                                                           cmd_bool=True,
+                                                           cmd_type="conclusion")
         # Check if any conclusion is a numeric statements.
         elif any([isinstance(thenlist, str), isinstance(elselist, str)]):
             conclusionlist = []
@@ -482,7 +495,7 @@
                     # Create r.mapcalc expression string for the operation.
                     cmdstring = self.build_command_string(map_i,
                                                           numinput,
-                                                          cmd_type = 'conclusion')
+                                                          cmd_type='conclusion')
                     # Conditional append of module command.
                     map_i.cmd_list = cmdstring
                     # Append map to result map list.
@@ -495,7 +508,7 @@
                     # Create r.mapcalc expression string for the operation.
                     cmdstring = self.build_command_string(numinput,
                                                           map_i,
-                                                          cmd_type = 'conclusion')
+                                                          cmd_type='conclusion')
                     # Conditional append of module command.
                     map_i.cmd_list = cmdstring
                     # Append map to result map list.
@@ -513,7 +526,7 @@
                 # Create r.mapcalc expression string for the operation.
                 cmdstring = self.build_command_string(map_i,
                                                       conclusionlist,
-                                                      cmd_type = 'condition')
+                                                      cmd_type='condition')
                 # Conditional append of module command.
                 map_i.cmd_list = cmdstring
                 # Append map to result map list.
@@ -521,7 +534,8 @@
             return(resultlist)
         elif isinstance(conclusionlist,  list):
             # Build result command map list between conditions and conclusions.
-            conditiontopolist = self.get_temporal_topo_list(iflist, conclusionlist,
+            conditiontopolist = self.get_temporal_topo_list(iflist,
+                                                            conclusionlist,
                                                             topolist=condition_topolist)
             resultlist = self.set_temporal_extent_list(conditiontopolist,
                                                        topolist=condition_topolist,
@@ -554,7 +568,7 @@
                         new_map = RasterDataset(map_name)
                     else:
                         new_map = Raster3DDataset(map_name)
-                    if new_map.map_exists() and self.overwrite == False:
+                    if new_map.map_exists() and self.overwrite is False:
                         self.msgr.fatal("Error maps with basename %s exist. "
                                         "Use --o flag to overwrite existing file"%map_name)
                 map_test_list = []
@@ -565,10 +579,10 @@
                         # Change map name to given basename.
                         # Create deepcopy of r.mapcalc module.
 
-                        map_test = map_i.get_new_instance(newident + "@" + self.mapset)
-                        map_test.set_temporal_extent(map_i.get_temporal_extent())
-                        map_test.set_spatial_extent(map_i.get_spatial_extent())
-                        map_test_list.append(map_test)
+                        new_map = map_i.get_new_instance(newident + "@" + self.mapset)
+                        new_map.set_temporal_extent(map_i.get_temporal_extent())
+                        new_map.set_spatial_extent(map_i.get_spatial_extent())
+                        map_test_list.append(new_map)
 
                         m = copy.deepcopy(self.m_mapcalc)
                         m_expression = newident + "=" + map_i.cmd_list
@@ -582,18 +596,16 @@
 
                     elif map_i.map_exists():
                         # Copy map if it exists b = a
-                        map_test = map_i.get_new_instance(newident + "@" + self.mapset)
-                        map_test.set_temporal_extent(map_i.get_temporal_extent())
-                        map_test.set_spatial_extent(map_i.get_spatial_extent())
-                        map_test_list.append(map_test)
+                        new_map = map_i.get_new_instance(newident + "@" + self.mapset)
+                        new_map.set_temporal_extent(map_i.get_temporal_extent())
+                        new_map.set_spatial_extent(map_i.get_spatial_extent())
+                        map_test_list.append(new_map)
 
                         m = copy.deepcopy(self.m_mapcalc)
                         m_expression = newident + "=" + map_i.get_map_id()
                         m.inputs["expression"].value = str(m_expression)
                         m.flags["overwrite"].value = self.overwrite
-
                         #print(m.get_bash())
-
                         self.process_chain_dict["processes"].append(m.get_dict())
 
                         if self.dry_run is False:
@@ -622,7 +634,9 @@
 
                     # Put the map into the process dictionary
                     start, end = map_i.get_temporal_extent_as_tuple()
-                    self.process_chain_dict["register"].append((map_i.get_name(), str(start), str(end)))
+                    self.process_chain_dict["register"].append((map_i.get_name(),
+                                                                str(start),
+                                                                str(end)))
 
                     if self.dry_run is False:
                         # Get meta data from grass database.
@@ -650,6 +664,7 @@
                     # Register map in result space time dataset.
                     if self.dry_run is False:
                         success = resultstds.register_map(map_i, dbif)
+
                 if self.dry_run is False:
                     resultstds.update_from_registered_maps(dbif)
 
@@ -701,23 +716,29 @@
             print("map(" + t[3] + ")")
 
     def p_arith1_operation(self, t):
+        # A % B
+        # A / B
+        # A * B
+        # A % td(B)
+        # A * td(B)
+        # A / td(B)
         """
-        expr : stds MOD stds
-             | expr MOD stds
-             | stds MOD expr
-             | expr MOD expr
-             | stds DIV stds
-             | expr DIV stds
-             | stds DIV expr
-             | expr DIV expr
+        expr : stds MOD  stds
+             | expr MOD  stds
+             | stds MOD  expr
+             | expr MOD  expr
+             | stds DIV  stds
+             | expr DIV  stds
+             | stds DIV  expr
+             | expr DIV  expr
              | stds MULT stds
              | expr MULT stds
              | stds MULT expr
              | expr MULT expr
-             | stds MOD t_td_var
-             | expr MOD t_td_var
-             | stds DIV t_td_var
-             | expr DIV t_td_var
+             | stds MOD  t_td_var
+             | expr MOD  t_td_var
+             | stds DIV  t_td_var
+             | expr DIV  t_td_var
              | stds MULT t_td_var
              | expr MULT t_td_var
         """
@@ -731,13 +752,16 @@
             resultlist = []
             for map_i in topolist:
                 # Generate an intermediate map for the result map list.
-                map_new = self.generate_new_map(base_map=map_i, bool_op='and', copy=True)
+                map_new = self.generate_new_map(base_map=map_i,
+                                                bool_op='and',
+                                                copy=True)
                 # Loop over temporal related maps and create overlay modules.
                 tbrelations = map_i.get_temporal_relations()
                 count = 0
                 for map_j in (tbrelations['EQUAL']):
                     # Create overlayed map extent.
-                    returncode = self.overlay_map_extent(map_new, map_j, 'and', \
+                    returncode = self.overlay_map_extent(map_new, map_j,
+                                                         'and',
                                                          temp_op='l')
                     # Stop the loop if no temporal or spatial relationship exist.
                     if returncode == 0:
@@ -767,23 +791,29 @@
                 print(map.cmd_list)
 
     def p_arith1_operation_numeric1(self, t):
+        # A % 1
+        # A / 4
+        # A * 5
+        # A % map(b1)
+        # A * map(b2)
+        # A / map(b3)
         """
-        expr : stds MOD number
-             | expr MOD number
-             | stds DIV number
-             | expr DIV number
+        expr : stds MOD  number
+             | expr MOD  number
+             | stds DIV  number
+             | expr DIV  number
              | stds MULT number
              | expr MULT number
-             | stds MOD numberstr
-             | expr MOD numberstr
-             | stds DIV numberstr
-             | expr DIV numberstr
+             | stds MOD  numberstr
+             | expr MOD  numberstr
+             | stds DIV  numberstr
+             | expr DIV  numberstr
              | stds MULT numberstr
              | expr MULT numberstr
-             | stds MOD mapexpr
-             | expr MOD mapexpr
-             | stds DIV mapexpr
-             | expr DIV mapexpr
+             | stds MOD  mapexpr
+             | expr MOD  mapexpr
+             | stds DIV  mapexpr
+             | expr DIV  mapexpr
              | stds MULT mapexpr
              | expr MULT mapexpr
         """
@@ -812,25 +842,31 @@
 
 
     def p_arith1_operation_numeric2(self, t):
+        # 1 % A
+        # 4 / A
+        # 5 * A
+        # map(b1) % A
+        # map(b4) / A
+        # map(b5) * A
         """
-        expr : number MOD stds
-             | number MOD expr
-             | number DIV stds
-             | number DIV expr
-             | number MULT stds
-             | number MULT expr
-             | numberstr MOD stds
-             | numberstr MOD expr
-             | numberstr DIV stds
-             | numberstr DIV expr
+        expr : number    MOD  stds
+             | number    MOD  expr
+             | number    DIV  stds
+             | number    DIV  expr
+             | number    MULT stds
+             | number    MULT expr
+             | numberstr MOD  stds
+             | numberstr MOD  expr
+             | numberstr DIV  stds
+             | numberstr DIV  expr
              | numberstr MULT stds
              | numberstr MULT expr
-             | mapexpr MOD stds
-             | mapexpr MOD expr
-             | mapexpr DIV stds
-             | mapexpr DIV expr
-             | mapexpr MULT stds
-             | mapexpr MULT expr
+             | mapexpr   MOD  stds
+             | mapexpr   MOD  expr
+             | mapexpr   DIV  stds
+             | mapexpr   DIV  expr
+             | mapexpr   MULT stds
+             | mapexpr   MULT expr
         """
         # Check input stds.
         maplist = self.check_stds(t[3])
@@ -857,6 +893,10 @@
 
 
     def p_arith2_operation(self, t):
+        # A + B
+        # A - B
+        # A + td(B)
+        # A - td(B)
         """
         expr : stds ADD stds
              | expr ADD stds
@@ -881,14 +921,18 @@
             resultlist = []
             for map_i in topolist:
                 # Generate an intermediate map for the result map list.
-                map_new = self.generate_new_map(base_map=map_i, bool_op='and', copy=True)
+                map_new = self.generate_new_map(base_map=map_i,
+                                                bool_op='and',
+                                                copy=True)
 
                 # Loop over temporal related maps and create overlay modules.
                 tbrelations = map_i.get_temporal_relations()
                 count = 0
                 for map_j in (tbrelations['EQUAL']):
                     # Create overlayed map extent.
-                    returncode = self.overlay_map_extent(map_new, map_j, 'and',
+                    returncode = self.overlay_map_extent(map_new,
+                                                         map_j,
+                                                         'and',
                                                          temp_op='l')
                     # Stop the loop if no temporal or spatial relationship exist.
                     if returncode == 0:
@@ -901,7 +945,8 @@
                         name = self.generate_map_name()
 
                     # Create r.mapcalc expression string for the operation.
-                    cmdstring = self.build_command_string(map_i, map_j,
+                    cmdstring = self.build_command_string(map_i,
+                                                          map_j,
                                                           operator=t[2],
                                                           cmd_type="operator")
                     # Conditional append of module command.
@@ -919,6 +964,10 @@
                 print(map.cmd_list)
 
     def p_arith2_operation_numeric1(self, t):
+        # A + 2
+        # A - 3
+        # A + map(b4)
+        # A - map(b5)
         """
         expr : stds ADD number
              | expr ADD number
@@ -957,19 +1006,23 @@
                 print(map.cmd_list)
 
     def p_arith2_operation_numeric2(self, t):
+        # 2 + A
+        # 3 - A
+        # map(b2) + A
+        # map(b3) - A
         """
-        expr : number ADD stds
-             | number ADD expr
-             | number SUB stds
-             | number SUB expr
+        expr : number    ADD stds
+             | number    ADD expr
+             | number    SUB stds
+             | number    SUB expr
              | numberstr ADD stds
              | numberstr ADD expr
              | numberstr SUB stds
              | numberstr SUB expr
-             | mapexpr ADD stds
-             | mapexpr ADD expr
-             | mapexpr SUB stds
-             | mapexpr SUB expr
+             | mapexpr   ADD stds
+             | mapexpr   ADD expr
+             | mapexpr   SUB stds
+             | mapexpr   SUB expr
         """
         # Check input stds.
         maplist = self.check_stds(t[3])
@@ -995,6 +1048,10 @@
                 print(map.cmd_list)
 
     def p_arith1_operation_relation(self, t):
+        # A {*, equal, l} B
+        # A {*, equal, l} td(B)
+        # A {*, equal, l} B {/, during, r} C
+        # A {*, equal, l} B {/, equal, l}  C {/, during, r} D
         """
         expr : stds T_ARITH1_OPERATOR stds
              | expr T_ARITH1_OPERATOR stds
@@ -1007,12 +1064,16 @@
             # Check input stds.
             maplistA = self.check_stds(t[1])
             maplistB = self.check_stds(t[3])
-            relations, temporal, function, aggregate = self.eval_toperator(t[2],  optype='raster')
+            relations, temporal, function, aggregate = self.eval_toperator(t[2], optype='raster')
             # Build conditional values based on topological relationships.
-            complist = self.get_temporal_topo_list(maplistA, maplistB, topolist=relations,
-                                                   operator_cmd=True, compop=function)
+            complist = self.get_temporal_topo_list(maplistA,
+                                                   maplistB,
+                                                   topolist=relations,
+                                                   operator_cmd=True,
+                                                   compop=function)
             # Set temporal extent based on topological relationships.
-            resultlist = self.set_temporal_extent_list(complist, topolist=relations,
+            resultlist = self.set_temporal_extent_list(complist,
+                                                       topolist=relations,
                                                        temporal=temporal)
 
         t[0] = resultlist
@@ -1022,6 +1083,10 @@
                 print(map.cmd_list)
 
     def p_arith2_operation_relation(self, t):
+        # A {+, equal, l} B
+        # A {+, equal, l} td(b)
+        # A {+, equal, l} B {-, during, r} C
+        # A {+, equal, l} B {+, equal, l}  C {-, during, r} D
         """
         expr : stds T_ARITH2_OPERATOR stds
              | expr T_ARITH2_OPERATOR stds
@@ -1034,12 +1099,16 @@
             # Check input stds.
             maplistA = self.check_stds(t[1])
             maplistB = self.check_stds(t[3])
-            relations, temporal, function, aggregate = self.eval_toperator(t[2],  optype = 'raster')
+            relations, temporal, function, aggregate = self.eval_toperator(t[2], optype='raster')
             # Build conditional values based on topological relationships.
-            complist = self.get_temporal_topo_list(maplistA, maplistB, topolist=relations,
-                                                   operator_cmd=True, compop=function)
+            complist = self.get_temporal_topo_list(maplistA,
+                                                   maplistB,
+                                                   topolist=relations,
+                                                   operator_cmd=True,
+                                                   compop=function)
             # Set temporal extent based on topological relationships.
-            resultlist = self.set_temporal_extent_list(complist, topolist=relations,
+            resultlist = self.set_temporal_extent_list(complist,
+                                                       topolist=relations,
                                                        temporal=temporal)
 
         t[0] = resultlist
@@ -1049,6 +1118,11 @@
                 print(map.cmd_list)
 
     def p_arith_operation_numeric_string(self, t):
+        # 1 + 1
+        # 1 - 1
+        # 1 * 1
+        # 1 / 1
+        # 1 % 1
         """
         numberstr : number ADD number
                   | number SUB number
@@ -1086,7 +1160,6 @@
 
 
     def p_mapcalc_operation1(self, t):
-        # Examples:
         # sin(A)
         # log(B)
         """
@@ -1116,7 +1189,6 @@
                 print(map.cmd_list)
 
     def p_mapexpr_operation(self, t):
-        # Examples:
         # sin(map(a))
         """
         mapexpr : mapcalc_arith LPAREN mapexpr RPAREN
@@ -1133,7 +1205,6 @@
             print(mapstring)
 
     def p_s_var_expr_1(self, t):
-        # Examples:
         #   isnull(A)
         """
         s_var_expr : ISNULL LPAREN stds RPAREN
@@ -1162,7 +1233,6 @@
                 print(map.cmd_list)
 
     def p_s_var_expr_2(self, t):
-        # Examples:
         #   isntnull(A)
         """
         s_var_expr : ISNTNULL LPAREN stds RPAREN
@@ -1191,7 +1261,6 @@
                 print(map.cmd_list)
 
     def p_s_var_expr_3(self, t):
-        # Examples:
         #   A <= 2
         """
         s_var_expr : stds comp_op number
@@ -1220,7 +1289,6 @@
                 print(map.cmd_list)
 
     def p_s_var_expr_4(self, t):
-        # Examples:
         #   exist(B)
         """
         s_var_expr : EXIST LPAREN stds RPAREN
@@ -1249,12 +1317,11 @@
                 print(map.cmd_list)
 
     def p_s_var_expr_comp(self, t):
-        # Examples:
         #   A <= 2 || B == 10
         #   A < 3 && A > 1
         """
         s_var_expr : s_var_expr AND AND s_var_expr
-                   | s_var_expr OR OR s_var_expr
+                   | s_var_expr OR  OR  s_var_expr
         """
         if self.run:
             # Check input stds.
@@ -1265,12 +1332,16 @@
             function = t[2] + t[3]
             aggregate = t[2]
             # Build conditional values based on topological relationships.
-            complist = self.get_temporal_topo_list(s_var_exprA, s_var_exprB, topolist=relations,
-                                                   compare_cmd=True, compop=function,
+            complist = self.get_temporal_topo_list(s_var_exprA,
+                                                   s_var_exprB,
+                                                   topolist=relations,
+                                                   compare_cmd=True,
+                                                   compop=function,
                                                    aggregate=aggregate)
             # Set temporal extent based on topological relationships.
-            resultlist = self.set_temporal_extent_list(complist, topolist = relations,
-                                temporal = temporal)
+            resultlist = self.set_temporal_extent_list(complist,
+                                                       topolist=relations,
+                                                       temporal=temporal)
 
             t[0] = resultlist
 
@@ -1279,7 +1350,6 @@
                 print(map.cmd_list)
 
     def p_s_var_expr_comp_op(self, t):
-        # Examples:
         #   A <= 2 {||} B == 10
         #   A < 3 {&&, equal} A > 1
         """
@@ -1290,13 +1360,17 @@
             s_var_exprA = self.check_stds(t[1])
             s_var_exprB = self.check_stds(t[3])
             # Evaluate temporal comparison operator.
-            relations, temporal, function, aggregate = self.eval_toperator(t[2],  optype='boolean')
+            relations, temporal, function, aggregate = self.eval_toperator(t[2], optype='boolean')
             # Build conditional values based on topological relationships.
-            complist = self.get_temporal_topo_list(s_var_exprA, s_var_exprB, topolist=relations,
-                                                   compare_cmd=True, compop=function,
+            complist = self.get_temporal_topo_list(s_var_exprA,
+                                                   s_var_exprB,
+                                                   topolist=relations,
+                                                   compare_cmd=True,
+                                                   compop=function,
                                                    aggregate=aggregate)
             # Set temporal extent based on topological relationships.
-            resultlist = self.set_temporal_extent_list(complist, topolist=relations,
+            resultlist = self.set_temporal_extent_list(complist,
+                                                       topolist=relations,
                                                        temporal=temporal)
 
             t[0] = resultlist
@@ -1306,22 +1380,23 @@
                 print(map.cmd_list)
 
     def p_s_expr_condition_if(self, t):
-        # Examples:
         #   if(s_var_expr, B)
         #   if(A == 1, B)
         """
-        expr : IF LPAREN s_var_expr COMMA stds RPAREN
-             | IF LPAREN s_var_expr COMMA expr RPAREN
+        expr : IF LPAREN s_var_expr  COMMA stds RPAREN
+             | IF LPAREN s_var_expr  COMMA expr RPAREN
              | IF LPAREN ts_var_expr COMMA stds RPAREN
              | IF LPAREN ts_var_expr COMMA expr RPAREN
         """
         ifmaplist = self.check_stds(t[3])
         thenmaplist = self.check_stds(t[5])
-        resultlist = self.build_condition_cmd_list(ifmaplist, thenmaplist,
+        resultlist = self.build_condition_cmd_list(ifmaplist,
+                                                   thenmaplist,
                                                    elselist=None,
                                                    condition_topolist=["EQUAL"],
                                                    conclusion_topolist=["EQUAL"],
-                                                   temporal='r', null=False)
+                                                   temporal='r',
+                                                   null=False)
         t[0] = resultlist
 
         if self.debug:
@@ -1329,14 +1404,13 @@
                 print(map.cmd_list)
 
     def p_s_numeric_condition_if(self, t):
-        # Examples:
         #   if(s_var_expr, 1)
         #   if(A == 5, 10)
         """
-        expr : IF LPAREN s_var_expr COMMA number RPAREN
-             | IF LPAREN s_var_expr COMMA NULL LPAREN RPAREN RPAREN
+        expr : IF LPAREN s_var_expr  COMMA number RPAREN
+             | IF LPAREN s_var_expr  COMMA NULL   LPAREN RPAREN RPAREN
              | IF LPAREN ts_var_expr COMMA number RPAREN
-             | IF LPAREN ts_var_expr COMMA NULL LPAREN RPAREN RPAREN
+             | IF LPAREN ts_var_expr COMMA NULL   LPAREN RPAREN RPAREN
         """
         ifmaplist = self.check_stds(t[3])
         resultlist = []
@@ -1348,7 +1422,8 @@
         # Iterate over condition map list.
         for map_i in ifmaplist:
             # Create r.mapcalc expression string for the operation.
-            cmdstring = self.build_command_string(map_i, numinput, cmd_type = 'condition')
+            cmdstring = self.build_command_string(map_i, numinput,
+                                                  cmd_type='condition')
             # Conditional append of module command.
             map_i.cmd_list = cmdstring
             # Append map to result map list.
@@ -1361,23 +1436,24 @@
                 print(map.cmd_list)
 
     def p_s_expr_condition_if_relation(self, t):
-        # Examples:
         #   if({equal||during}, s_var_expr, A)
         """
-        expr : IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA stds RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA expr RPAREN
+        expr : IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA stds RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA expr RPAREN
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA stds RPAREN
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr RPAREN
         """
         relations, temporal, function,  aggregation = self.eval_toperator(t[3],
-                                                                                        optype = 'relation')
+                                                                          optype='relation')
         ifmaplist = self.check_stds(t[5])
         thenmaplist = self.check_stds(t[7])
-        resultlist = self.build_condition_cmd_list(ifmaplist, thenmaplist,
+        resultlist = self.build_condition_cmd_list(ifmaplist,
+                                                   thenmaplist,
                                                    elselist=None,
                                                    condition_topolist=relations,
                                                    conclusion_topolist=["EQUAL"],
-                                                   temporal='r', null=False)
+                                                   temporal='r',
+                                                   null=False)
         t[0] = resultlist
 
         if self.debug:
@@ -1385,13 +1461,12 @@
                 print(map.cmd_list)
 
     def p_s_expr_condition_elif(self, t):
-        # Examples:
         #   if(s_var_expr, A, B)
         """
-        expr : IF LPAREN s_var_expr COMMA stds COMMA stds RPAREN
-             | IF LPAREN s_var_expr COMMA stds COMMA expr RPAREN
-             | IF LPAREN s_var_expr COMMA expr COMMA stds RPAREN
-             | IF LPAREN s_var_expr COMMA expr COMMA expr RPAREN
+        expr : IF LPAREN s_var_expr  COMMA stds COMMA stds RPAREN
+             | IF LPAREN s_var_expr  COMMA stds COMMA expr RPAREN
+             | IF LPAREN s_var_expr  COMMA expr COMMA stds RPAREN
+             | IF LPAREN s_var_expr  COMMA expr COMMA expr RPAREN
              | IF LPAREN ts_var_expr COMMA stds COMMA stds RPAREN
              | IF LPAREN ts_var_expr COMMA stds COMMA expr RPAREN
              | IF LPAREN ts_var_expr COMMA expr COMMA stds RPAREN
@@ -1402,11 +1477,13 @@
         thenmaplist = self.check_stds(t[5])
         elsemaplist = self.check_stds(t[7])
         # Create conditional command map list.
-        resultlist = self.build_condition_cmd_list(ifmaplist, thenmaplist,
+        resultlist = self.build_condition_cmd_list(ifmaplist,
+                                                   thenmaplist,
                                                    elselist=elsemaplist,
                                                    condition_topolist=["EQUAL"],
                                                    conclusion_topolist=["EQUAL"],
-                                                   temporal='r', null=False)
+                                                   temporal='r',
+                                                   null=False)
 
         t[0] = resultlist
 
@@ -1415,21 +1492,19 @@
                 print(map.cmd_list)
 
     def p_s_numeric_condition_elif(self, t):
-        # Examples:
         #   if(s_var_expr, 1, 2)
         #   if(A == 5, 10, 0)
         """
-        expr : IF LPAREN s_var_expr COMMA number COMMA number RPAREN
-             | IF LPAREN s_var_expr COMMA NULL LPAREN RPAREN COMMA number RPAREN
-             | IF LPAREN s_var_expr COMMA number COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN s_var_expr COMMA NULL LPAREN RPAREN COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN ts_var_expr COMMA number COMMA number RPAREN
-             | IF LPAREN ts_var_expr COMMA NULL LPAREN RPAREN COMMA number RPAREN
-             | IF LPAREN ts_var_expr COMMA number COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN ts_var_expr COMMA NULL LPAREN RPAREN COMMA NULL LPAREN RPAREN RPAREN
+        expr : IF LPAREN s_var_expr  COMMA number COMMA  number RPAREN
+             | IF LPAREN s_var_expr  COMMA NULL   LPAREN RPAREN COMMA  number RPAREN
+             | IF LPAREN s_var_expr  COMMA number COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN s_var_expr  COMMA NULL   LPAREN RPAREN COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN ts_var_expr COMMA number COMMA  number RPAREN
+             | IF LPAREN ts_var_expr COMMA NULL   LPAREN RPAREN COMMA  number RPAREN
+             | IF LPAREN ts_var_expr COMMA number COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN ts_var_expr COMMA NULL   LPAREN RPAREN COMMA  NULL   LPAREN RPAREN RPAREN
         """
         ifmaplist = self.check_stds(t[3])
-        resultlist = []
         # Select input for r.mapcalc expression based on length of PLY object.
         if len(t) == 9:
             numthen = t[5]
@@ -1447,10 +1522,13 @@
         numelse = str(numelse)
         print(numthen + " " +numelse )
         # Create conditional command map list.
-        resultlist = self.build_condition_cmd_list(ifmaplist, numthen,  numelse,
+        resultlist = self.build_condition_cmd_list(ifmaplist,
+                                                   numthen,
+                                                   numelse,
                                                    condition_topolist=["EQUAL"],
                                                    conclusion_topolist=["EQUAL"],
-                                                   temporal='r', null=False)
+                                                   temporal='r',
+                                                   null=False)
 
         t[0] = resultlist
 
@@ -1459,26 +1537,25 @@
                 print(map.cmd_list)
 
     def p_s_numeric_expr_condition_elif(self, t):
-        # Examples:
         #   if(s_var_expr, 1, A)
         #   if(A == 5 && C > 5, A, null())
         """
-        expr : IF LPAREN s_var_expr COMMA number COMMA stds RPAREN
-             | IF LPAREN s_var_expr COMMA NULL LPAREN RPAREN COMMA stds RPAREN
-             | IF LPAREN s_var_expr COMMA number COMMA expr RPAREN
-             | IF LPAREN s_var_expr COMMA NULL LPAREN RPAREN COMMA expr RPAREN
-             | IF LPAREN s_var_expr COMMA stds COMMA number RPAREN
-             | IF LPAREN s_var_expr COMMA stds COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN s_var_expr COMMA expr COMMA number RPAREN
-             | IF LPAREN s_var_expr COMMA expr COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN ts_var_expr COMMA number COMMA stds RPAREN
-             | IF LPAREN ts_var_expr COMMA NULL LPAREN RPAREN COMMA stds RPAREN
-             | IF LPAREN ts_var_expr COMMA number COMMA expr RPAREN
-             | IF LPAREN ts_var_expr COMMA NULL LPAREN RPAREN COMMA expr RPAREN
-             | IF LPAREN ts_var_expr COMMA stds COMMA number RPAREN
-             | IF LPAREN ts_var_expr COMMA stds COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN ts_var_expr COMMA expr COMMA number RPAREN
-             | IF LPAREN ts_var_expr COMMA expr COMMA NULL LPAREN RPAREN RPAREN
+        expr : IF LPAREN s_var_expr  COMMA number COMMA  stds   RPAREN
+             | IF LPAREN s_var_expr  COMMA NULL   LPAREN RPAREN COMMA  stds   RPAREN
+             | IF LPAREN s_var_expr  COMMA number COMMA  expr   RPAREN
+             | IF LPAREN s_var_expr  COMMA NULL   LPAREN RPAREN COMMA  expr   RPAREN
+             | IF LPAREN s_var_expr  COMMA stds   COMMA  number RPAREN
+             | IF LPAREN s_var_expr  COMMA stds   COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN s_var_expr  COMMA expr   COMMA  number RPAREN
+             | IF LPAREN s_var_expr  COMMA expr   COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN ts_var_expr COMMA number COMMA  stds   RPAREN
+             | IF LPAREN ts_var_expr COMMA NULL   LPAREN RPAREN COMMA  stds   RPAREN
+             | IF LPAREN ts_var_expr COMMA number COMMA  expr   RPAREN
+             | IF LPAREN ts_var_expr COMMA NULL   LPAREN RPAREN COMMA  expr   RPAREN
+             | IF LPAREN ts_var_expr COMMA stds   COMMA  number RPAREN
+             | IF LPAREN ts_var_expr COMMA stds   COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN ts_var_expr COMMA expr   COMMA  number RPAREN
+             | IF LPAREN ts_var_expr COMMA expr   COMMA  NULL   LPAREN RPAREN RPAREN
         """
         ifmaplist = self.check_stds(t[3])
         # Select input for r.mapcalc expression based on length of PLY object.
@@ -1498,10 +1575,13 @@
                 elseinput = str(t[7] + t[8] + t[9])
 
         # Create conditional command map list.
-        resultlist = self.build_condition_cmd_list(ifmaplist, theninput,  elseinput,
+        resultlist = self.build_condition_cmd_list(ifmaplist,
+                                                   theninput,
+                                                   elseinput,
                                                    condition_topolist=["EQUAL"],
                                                    conclusion_topolist=["EQUAL"],
-                                                   temporal='r', null=False)
+                                                   temporal='r',
+                                                   null=False)
 
         t[0] = resultlist
 
@@ -1510,28 +1590,27 @@
                 print(map.cmd_list)
 
     def p_s_numeric_expr_condition_elif_relation(self, t):
-        # Examples:
         #   if({during},s_var_expr, 1, A)
         #   if({during}, A == 5, A, null())
         """
-        expr : IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA number COMMA stds RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA NULL LPAREN RPAREN COMMA stds RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA number COMMA expr RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA NULL LPAREN RPAREN COMMA expr RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA stds COMMA number RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA stds COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA expr COMMA number RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA expr COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA number COMMA stds RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA NULL LPAREN RPAREN COMMA stds RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA number COMMA expr RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA NULL LPAREN RPAREN COMMA expr RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA stds COMMA number RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA stds COMMA NULL LPAREN RPAREN RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr COMMA number RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr COMMA NULL LPAREN RPAREN RPAREN
+        expr : IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA number COMMA  stds   RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA NULL   LPAREN RPAREN COMMA  stds   RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA number COMMA  expr   RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA NULL   LPAREN RPAREN COMMA  expr   RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA stds   COMMA  number RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA stds   COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA expr   COMMA  number RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA expr   COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA number COMMA  stds   RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA NULL   LPAREN RPAREN COMMA  stds   RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA number COMMA  expr   RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA NULL   LPAREN RPAREN COMMA  expr   RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA stds   COMMA  number RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA stds   COMMA  NULL   LPAREN RPAREN RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr   COMMA  number RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr   COMMA  NULL   LPAREN RPAREN RPAREN
         """
-        relations, temporal, function,  aggregation = self.eval_toperator(t[3],  optype = 'relation')
+        relations, temporal, function,  aggregation = self.eval_toperator(t[3], optype='relation')
         ifmaplist = self.check_stds(t[5])
         # Select input for r.mapcalc expression based on length of PLY object.
         if len(t) == 11:
@@ -1550,10 +1629,13 @@
                 elseinput = str(t[9] + t[10] + t[11])
 
         # Create conditional command map list.
-        resultlist = self.build_condition_cmd_list(ifmaplist, theninput,  elseinput,
+        resultlist = self.build_condition_cmd_list(ifmaplist,
+                                                   theninput,
+                                                   elseinput,
                                                    condition_topolist=relations,
                                                    conclusion_topolist=["EQUAL"],
-                                                   temporal='r', null=False)
+                                                   temporal='r',
+                                                   null=False)
 
         t[0] = resultlist
 
@@ -1561,30 +1643,31 @@
             for map in resultlist:
                 print(map.cmd_list)
 
-
     def p_s_expr_condition_elif_relation(self, t):
-        # Examples:
         #   if({equal||during}, s_var_expr, A, B)
         """
-        expr : IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA stds COMMA stds RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA stds COMMA expr RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA expr COMMA stds RPAREN
-             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr COMMA expr COMMA expr RPAREN
+        expr : IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA stds COMMA stds RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA stds COMMA expr RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA expr COMMA stds RPAREN
+             | IF LPAREN T_REL_OPERATOR COMMA s_var_expr  COMMA expr COMMA expr RPAREN
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA stds COMMA stds RPAREN
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA stds COMMA expr RPAREN
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr COMMA stds RPAREN
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr COMMA expr RPAREN
         """
-        relations, temporal, function, aggregation = self.eval_toperator(t[3],  optype = 'relation')
+        relations, temporal, function, aggregation = self.eval_toperator(t[3], optype='relation')
         ifmaplist = self.check_stds(t[5])
         thenmaplist = self.check_stds(t[7])
         elsemaplist = self.check_stds(t[9])
 
         # Create conditional command map list.
-        resultlist = self.build_condition_cmd_list(ifmaplist, thenmaplist,  elsemaplist,
+        resultlist = self.build_condition_cmd_list(ifmaplist,
+                                                   thenmaplist,
+                                                   elsemaplist,
                                                    condition_topolist=relations,
                                                    conclusion_topolist=["EQUAL"],
-                                                   temporal='r', null=False)
+                                                   temporal='r',
+                                                   null=False)
 
         t[0] = resultlist
 
@@ -1600,18 +1683,18 @@
         #  IMPORTANT: Only the intersection of map lists in conditionals are
         #  exported.
         """
-        ts_var_expr : s_var_expr AND AND t_var_expr
-                    | t_var_expr AND AND s_var_expr
-                    | t_var_expr OR OR s_var_expr
-                    | s_var_expr OR OR t_var_expr
+        ts_var_expr : s_var_expr  AND AND t_var_expr
+                    | t_var_expr  AND AND s_var_expr
+                    | t_var_expr  OR  OR  s_var_expr
+                    | s_var_expr  OR  OR  t_var_expr
                     | ts_var_expr AND AND s_var_expr
                     | ts_var_expr AND AND t_var_expr
-                    | ts_var_expr OR OR s_var_expr
-                    | ts_var_expr OR OR t_var_expr
-                    | s_var_expr AND AND ts_var_expr
-                    | t_var_expr AND AND ts_var_expr
-                    | s_var_expr OR OR ts_var_expr
-                    | t_var_expr OR OR ts_var_expr
+                    | ts_var_expr OR  OR  s_var_expr
+                    | ts_var_expr OR  OR  t_var_expr
+                    | s_var_expr  AND AND ts_var_expr
+                    | t_var_expr  AND AND ts_var_expr
+                    | s_var_expr  OR  OR  ts_var_expr
+                    | t_var_expr  OR  OR  ts_var_expr
         """
         if self.run:
             # Check input stds.
@@ -1622,12 +1705,16 @@
             function = t[2] + t[3]
             aggregate = t[2]
             # Build conditional values based on topological relationships.
-            complist = self.get_temporal_topo_list(s_var_exprA, s_var_exprB,
-                                                   topolist=relations, compare_cmd=True,
-                                                   compop=function, aggregate=aggregate,
+            complist = self.get_temporal_topo_list(s_var_exprA,
+                                                   s_var_exprB,
+                                                   topolist=relations,
+                                                   compare_cmd=True,
+                                                   compop=function,
+                                                   aggregate=aggregate,
                                                    convert=True)
             # Set temporal extent based on topological relationships.
-            resultlist = self.set_temporal_extent_list(complist, topolist=relations,
+            resultlist = self.set_temporal_extent_list(complist,
+                                                       topolist=relations,
                                                        temporal=temporal)
 
         t[0] = resultlist

Modified: grass/branches/releasebranch_7_2/lib/python/temporal/temporal_vector_algebra.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/temporal_vector_algebra.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/temporal_vector_algebra.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -370,8 +370,8 @@
                     vectormap = VectorDataset(vectorname + "@" + get_current_mapset())
                     if vectormap.map_exists() and self.overwrite == False:
                         self.msgr.fatal(_("Error vector maps with basename %s exist. "
-                                      "Use --o flag to overwrite existing file") \
-                                      %(vectorname))
+                                          "Use --o flag to overwrite existing file") \
+                                          %(vectorname))
                 for map_i in t[3]:
                     if "cmd_list" in dir(map_i):
                         # Execute command list.
@@ -381,7 +381,7 @@
                                 # otherwise v.overlay will break
                                 if cmd.name == "v.overlay":
                                     for name in (cmd.inputs["ainput"].value,
-                                                    cmd.inputs["binput"].value):
+                                                 cmd.inputs["binput"].value):
                                         #self.msgr.message("Check if map <" + name + "> exists")
                                         if name.find("@") < 0:
                                             name = name + "@" + get_current_mapset()
@@ -400,10 +400,11 @@
                             # print the command that will be executed
                             self.msgr.message("Run command:\n" + cmd.get_bash())
                             cmd.run()
+
                             if cmd.popen.returncode != 0:
-                                self.msgr.fatal(_("Error starting %s : \n%s") \
-                                                    %(cmd.get_bash(), \
-                                                    cmd.popen.stderr))
+                                self.msgr.fatal(_("Error starting %s : \n%s")
+                                                  %(cmd.get_bash(),
+                                                  cmd.popen.stderr))
                             mapname = cmd.outputs['output'].value
                             if mapname.find("@") >= 0:
                                 map_test = map_i.get_new_instance(mapname)
@@ -438,9 +439,10 @@
                             newident = self.basename + "_" + str(count)
                             map_result = map_i.get_new_instance(newident + "@" + self.mapset)
 
-                            if map_test.map_exists() and self.overwrite == False:
-                                self.msgr.fatal("Error raster maps with basename %s exist. Use --o flag to overwrite existing file" \
-                                                    %(mapname))
+                            if map_test.map_exists() and self.overwrite is False:
+                                self.msgr.fatal("Error raster maps with basename %s exist. "
+                                                "Use --o flag to overwrite existing file"
+                                                %(mapname))
 
                             map_result.set_temporal_extent(map_i.get_temporal_extent())
                             map_result.set_spatial_extent(map_i.get_spatial_extent())
@@ -459,10 +461,10 @@
 
                 if len(register_list) > 0:
                     # Create result space time dataset.
-                    resultstds = open_new_stds(t[1], self.stdstype, \
-                                                                'absolute', t[1], t[1], \
-                                                                "temporal vector algebra", self.dbif,
-                                                                overwrite = self.overwrite)
+                    resultstds = open_new_stds(t[1], self.stdstype,
+                                               'absolute', t[1], t[1],
+                                               "temporal vector algebra", self.dbif,
+                                               overwrite=self.overwrite)
                     for map_i in register_list:
                         # Check if modules should be executed from command list.
                         if hasattr(map_i, "cmd_list") or hasattr(map_i, "is_new"):

Modified: grass/branches/releasebranch_7_2/lib/python/temporal/testsuite/unittests_temporal_algebra_grs.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/testsuite/unittests_temporal_algebra_grs.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/testsuite/unittests_temporal_algebra_grs.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -109,7 +109,7 @@
        
     def test_common_granularity_2(self):
         """Testing the common granularity function year to month samping. """
-        ta = tgis.TemporalAlgebraParser(run = True, debug = True)
+        ta = tgis.TemporalAlgebraParser(run=True, debug=True)
         expr = 'R = A : C'
         ret = ta.setup_common_granularity(expression=expr)
         
@@ -129,7 +129,7 @@
 
     def test_common_granularity_3(self):
         """Testing the common granularity function with gaps. """
-        ta = tgis.TemporalAlgebraParser(run = True, debug = True)
+        ta = tgis.TemporalAlgebraParser(run=True, debug=True)
         expr = 'R = A : D'
         ret = ta.setup_common_granularity(expression=expr)
         
@@ -149,7 +149,7 @@
 
     def test_common_granularity_4(self):
         """Testing the common granularity function year to month with gaps. """
-        ta = tgis.TemporalAlgebraParser(run = True, debug = True)
+        ta = tgis.TemporalAlgebraParser(run=True, debug=True)
         expr = 'R = C : D'
         ret = ta.setup_common_granularity(expression=expr)
         
@@ -168,7 +168,7 @@
        
     def test_common_granularity_4(self):
         """Testing the common granularity function year to month with gaps. """
-        ta = tgis.TemporalAlgebraParser(run = True, debug = True)
+        ta = tgis.TemporalAlgebraParser(run=True, debug=True)
         expr = 'R = C : D'
         ret = ta.setup_common_granularity(expression=expr)
         
@@ -187,7 +187,7 @@
        
     def test_common_granularity_5(self):
         """Testing the common granularity function year to month with gaps. """
-        ta = tgis.TemporalAlgebraParser(run = True, debug = True)
+        ta = tgis.TemporalAlgebraParser(run=True, debug=True)
         expr = 'R = A : C : D'
         ret = ta.setup_common_granularity(expression=expr)
         
@@ -206,7 +206,7 @@
          
     def test_common_granularity_6(self):
         """Testing the common granularity function year to month with gaps. """
-        ta = tgis.TemporalAlgebraParser(run = True, debug = True)
+        ta = tgis.TemporalAlgebraParser(run=True, debug=True)
         expr = 'R = if(start_month(A) > 2, A : C : D)'
         ret = ta.setup_common_granularity(expression=expr)
         

Modified: grass/branches/releasebranch_7_2/lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -77,14 +77,14 @@
         D.select()
         maplist = D.get_registered_maps_as_objects()
         self.assertEqual(D.metadata.get_number_of_maps(), 2)
-        self.assertEqual(D.metadata.get_min_min(), 2) 
-        self.assertEqual(D.metadata.get_max_max(), 3) 
+        self.assertEqual(D.metadata.get_min_min(), 2)
+        self.assertEqual(D.metadata.get_max_max(), 3)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
         self.assertEqual( D.check_temporal_topology(),  False)
         self.assertEqual(D.get_granularity(),  u'2 days')
-        
+
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True, dry_run=True)
         pc = ta.parse(expression="R = A {:,during,r} C", basename="r", overwrite=True)
 
@@ -717,6 +717,30 @@
         self.assertEqual( D.check_temporal_topology(),  True)
         self.assertEqual(D.get_granularity(),  u'1 day')
 
+    def test_capacity_1(self):
+        """Arithmetic test with temporal intersection"""
+        tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
+        expr = "R = (((((((A + A) - A) * A) / A) % A) - td(A)) - (A # A))"
+        tra.parse(expression=expr, basename="r", overwrite=True)
 
+        D = tgis.open_old_stds("R", type="strds")
+        D.select()
+        self.assertEqual(D.metadata.get_number_of_maps(), 4)
+        self.assertEqual(D.metadata.get_min_min(), -2)
+        self.assertEqual(D.metadata.get_max_max(), -2)
+        start, end = D.get_absolute_time()
+        self.assertEqual(start, datetime.datetime(2001, 1, 1))
+        self.assertEqual(end, datetime.datetime(2001, 1, 5))
+        self.assertEqual( D.check_temporal_topology(),  True)
+        self.assertEqual(D.get_granularity(),  u'1 day')
+
+        tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True, dry_run=True)
+        pc = tra.parse(expression=expr, basename="r", overwrite=True)
+
+        self.assertEqual(len(pc["register"]), 4)
+        self.assertEqual(len(pc["processes"]), 4)
+        self.assertEqual(pc["STDS"]["name"], "R")
+        self.assertEqual(pc["STDS"]["stdstype"], "strds")
+
 if __name__ == '__main__':
     test()

Modified: grass/branches/releasebranch_7_2/temporal/t.rast.algebra/t.rast.algebra.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.rast.algebra/t.rast.algebra.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/temporal/t.rast.algebra/t.rast.algebra.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -63,6 +63,10 @@
 #% description: Use granularity sampling instead of the temporal topology approach
 #%end
 
+#%flag
+#% key: d
+#% description: Perform a dry run, compute all depenencies and module calls but don't run them
+#%end
 
 import grass.script
 import grass.temporal as tgis
@@ -75,6 +79,7 @@
     spatial = flags["s"]
     register_null = flags["n"]
     granularity = flags["g"]
+    dry_run = flags["d"]
 
     # Check for PLY istallation
     try:
@@ -86,14 +91,23 @@
                              "t.rast.algebra without PLY requirement."))
 
     tgis.init(True)
-    p = tgis.TemporalRasterAlgebraParser(run = True, debug=False, spatial = spatial, nprocs = nprocs, register_null = register_null)
+    p = tgis.TemporalRasterAlgebraParser(run = True,
+                                         debug=False,
+                                         spatial=spatial,
+                                         nprocs=nprocs,
+                                         register_null=register_null,
+                                         dry_run=dry_run)
     
     if granularity:
         if not p.setup_common_granularity(expression=expression,  lexer = tgis.TemporalRasterAlgebraLexer()):
             grass.script.fatal(_("Unable to process the expression in granularity algebra mode"))
     
-    p.parse(expression, basename, grass.script.overwrite())
+    pc = p.parse(expression, basename, grass.script.overwrite())
 
+    if dry_run is True:
+        import pprint
+        pprint.pprint(pc)
+
 if __name__ == "__main__":
     options, flags = grass.script.parser()
     sys.exit(main())

Modified: grass/branches/releasebranch_7_2/temporal/t.rast.algebra/testsuite/test_raster_algebra.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.rast.algebra/testsuite/test_raster_algebra.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/temporal/t.rast.algebra/testsuite/test_raster_algebra.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -74,8 +74,10 @@
         """Testing the conditional time dimension bug, that uses the time 
             dimension of the conditional statement instead the time dimension 
             of the then/else statement."""
-        self.assertModule("t.rast.algebra",  expression="R = if({contains}, B == 5,  A - 1,  A + 1)", 
-                                                                 basename="r")
+        self.assertModule("t.rast.algebra", expression="R = if({contains}, B == 5, "
+                                                       "A - 1,  A + 1)", basename="r", flags="d")
+        self.assertModule("t.rast.algebra", expression="R = if({contains}, B == 5, "
+                                                       "A - 1,  A + 1)", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -90,9 +92,10 @@
 
     def test_simple_arith_hash_1(self):
         """Simple arithmetic test including the hash operator"""
-       
-        self.assertModule("t.rast.algebra",  expression='R = A + (A {#, equal,l} A)', basename="r")
 
+        self.assertModule("t.rast.algebra", expression='R = A + (A {#, equal,l} A)', basename="r", flags="d")
+        self.assertModule("t.rast.algebra", expression='R = A + (A {#, equal,l} A)', basename="r")
+
         D = tgis.open_old_stds("R", type="strds")
         
         self.assertEqual(D.metadata.get_number_of_maps(), 4)
@@ -106,7 +109,8 @@
     def test_simple_arith_td_1(self):
         """Simple arithmetic test"""
        
-        self.assertModule("t.rast.algebra",  expression='R = A + td(A)', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = A + td(A)', basename="r", flags="d")
+        self.assertModule("t.rast.algebra", expression='R = A + td(A)', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -120,7 +124,8 @@
     def test_simple_arith_td_2(self):
         """Simple arithmetic test"""
        
-        self.assertModule("t.rast.algebra",  expression='R = A / td(A)', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = A / td(A)', basename="r", flags="d")
+        self.assertModule("t.rast.algebra", expression='R = A / td(A)', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -134,7 +139,8 @@
     def test_simple_arith_td_3(self):
         """Simple arithmetic test"""
        
-        self.assertModule("t.rast.algebra",  expression='R = A {+,equal} td(A)', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = A {+,equal} td(A)', basename="r", flags="d")
+        self.assertModule("t.rast.algebra", expression='R = A {+,equal} td(A)', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -148,7 +154,8 @@
     def test_simple_arith_td_4(self):
         """Simple arithmetic test"""
        
-        self.assertModule("t.rast.algebra",  expression='R = A {/, equal} td(A)', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = A {/, equal} td(A)', basename="r", flags="d")
+        self.assertModule("t.rast.algebra", expression='R = A {/, equal} td(A)', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -163,7 +170,8 @@
     def test_simple_arith_if_1(self):
         """Simple arithmetic test with if condition"""
        
-        self.assertModule("t.rast.algebra",  expression='R = if({equal}, start_date(A) >= "2001-01-02", A + A)', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = if({equal}, start_date(A)'
+                                                       ' >= "2001-01-02", A + A)', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -177,7 +185,7 @@
     def test_simple_arith_if_2(self):
         """Simple arithmetic test with if condition"""
        
-        self.assertModule("t.rast.algebra",  expression='R = if({equal}, A#A == 1, A - A)', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = if({equal}, A#A == 1, A - A)', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -191,8 +199,9 @@
     def test_complex_arith_if_1(self):
         """Complex arithmetic test with if condition"""
        
-        self.assertModule("t.rast.algebra",  expression='R = if(start_date(A) < "2001-01-03" && A#A == 1, A{+, starts,l}C, A{+, finishes,l}C)', \
-                  basename="r")
+        self.assertModule("t.rast.algebra", expression='R = if(start_date(A) < "2001-01-03" && A#A == 1,'
+                                                        ' A{+, starts,l}C, A{+, finishes,l}C)',
+                          basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -206,7 +215,7 @@
     def test_simple_arith_1(self):
         """Simple arithmetic test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {*, equal} A {+, equal} A", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {*, equal} A {+, equal} A", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -220,7 +229,7 @@
     def test_simple_arith_2(self):
         """Simple arithmetic test that creates an empty strds"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {*, during} A {+, during} A", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {*, during} A {+, during} A", basename="r")
         D = tgis.open_old_stds("R", type="strds")
         
         self.assertEqual(D.metadata.get_number_of_maps(), 0)
@@ -228,7 +237,7 @@
     def test_simple_arith_3(self):
         """Simple arithmetic test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A / A + A*A/A", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A / A + A*A/A", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -242,7 +251,7 @@
     def test_temporal_intersection_1(self):
         """Simple temporal intersection test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {+,equal,i} B", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {+,equal,i} B", basename="r")
         D = tgis.open_old_stds("R", type="strds")
         
         self.assertEqual(D.metadata.get_number_of_maps(), 0)
@@ -250,7 +259,7 @@
     def test_temporal_intersection_2(self):
         """Simple temporal intersection test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {+,during,i} B", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {+,during,i} B", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -264,7 +273,7 @@
     def test_temporal_intersection_3(self):
         """Simple temporal intersection test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {+,starts,i} B", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {+,starts,i} B", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -278,7 +287,7 @@
     def test_temporal_intersection_4(self):
         """Simple temporal intersection test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {+,finishes,intersect} B", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {+,finishes,intersect} B", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -292,7 +301,7 @@
     def test_temporal_intersection_5(self):
         """Simple temporal intersection test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {+,starts|finishes,i} B", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {+,starts|finishes,i} B", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -306,7 +315,7 @@
     def test_temporal_intersection_6(self):
         """Simple temporal intersection test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = B {+,overlaps,u} C", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = B {+,overlaps,u} C", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -320,7 +329,7 @@
     def test_temporal_intersection_7(self):
         """Simple temporal intersection test"""
        
-        self.assertModule("t.rast.algebra",  expression="R = B {+,overlapped,u} C", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = B {+,overlapped,u} C", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -334,7 +343,7 @@
     def test_temporal_intersection_8(self):
         """Simple temporal intersection test"""
        
-        self.assertModule("t.rast.algebra",  expression='R = A {+,during,l} buff_t(C, "1 day") ',
+        self.assertModule("t.rast.algebra", expression='R = A {+,during,l} buff_t(C, "1 day") ',
                   basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -349,7 +358,7 @@
     def test_temporal_neighbors_1(self):
         """Simple temporal neighborhood computation test"""
        
-        self.assertModule("t.rast.algebra",  expression='R = A[-1] + A[1]',
+        self.assertModule("t.rast.algebra", expression='R = A[-1] + A[1]',
                   basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -364,7 +373,7 @@
     def test_temporal_neighbors_2(self):
         """Simple temporal neighborhood computation test"""
        
-        self.assertModule("t.rast.algebra",  expression='R = A[0,0,-1] + A[0,0,1]',
+        self.assertModule("t.rast.algebra", expression='R = A[0,0,-1] + A[0,0,1]',
                   basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -379,7 +388,7 @@
     def test_tmap_function1(self):
         """Testing the tmap function. """
        
-        self.assertModule("t.rast.algebra",  expression='R = tmap(singletmap)', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = tmap(singletmap)', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -396,7 +405,7 @@
     def test_tmap_function2(self):
         """Testing the tmap function. """
        
-        self.assertModule("t.rast.algebra",  expression='R = tmap(singletmap) + 1', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = tmap(singletmap) + 1', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -413,7 +422,7 @@
     def test_map_function1(self):
         """Testing the map function. """
        
-        self.assertModule("t.rast.algebra",  expression='R = map(singlemap) + A', basename="r")
+        self.assertModule("t.rast.algebra", expression='R = map(singlemap) + A', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -430,7 +439,7 @@
     def test_map_function2(self):
         """Testing the map function. """
        
-        self.assertModule("t.rast.algebra",  expression='R =  A * map(singlemap)', basename="r")
+        self.assertModule("t.rast.algebra", expression='R =  A * map(singlemap)', basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -447,7 +456,7 @@
     def test_temporal_select(self):
         """Testing the temporal select operator. """
        
-        self.assertModule("t.rast.algebra",  expression="R = A : A", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A : A", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -463,7 +472,7 @@
     def test_temporal_select(self):
         """Testing the temporal select operator. """
        
-        self.assertModule("t.rast.algebra",  expression="R = A : D", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A : D", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -479,7 +488,7 @@
     def test_temporal_select_operators1(self):
         """Testing the temporal select operator. Including temporal relations. """
        
-        self.assertModule("t.rast.algebra",  expression="R = A : D", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A : D", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -495,7 +504,7 @@
     def test_temporal_select_operators2(self):
         """Testing the temporal select operator. Including temporal relations. """
        
-        self.assertModule("t.rast.algebra",  expression="R = A {!:,during} C", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {!:,during} C", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -512,7 +521,7 @@
         """Testing the temporal select operator. Including temporal relations and 
             different temporal operators (lr|+&)"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {:,during,d} B", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {:,during,d} B", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -529,7 +538,7 @@
         """Testing the temporal select operator. Including temporal relations and 
             different temporal operators (lr|+&)"""
        
-        self.assertModule("t.rast.algebra",  expression="R = A {:,equal|during,r} C", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A {:,equal|during,r} C", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -550,7 +559,7 @@
     def test_temporal_hash_operator1(self):
         """Testing the temporal hash operator in the raster algebra. """
        
-        self.assertModule("t.rast.algebra",  expression="R = if(A # D == 1, A)", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = if(A # D == 1, A)", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -566,7 +575,7 @@
     def test_temporal_hash_operator2(self):
         """Testing the temporal hash operator in the raster algebra. """
        
-        self.assertModule("t.rast.algebra",  expression="R = A # D", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = A # D", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -582,7 +591,7 @@
     def test_temporal_hash_operator3(self):
         """Testing the temporal hash operator in the raster algebra. """
        
-        self.assertModule("t.rast.algebra",  expression="R = C {#,contains} A", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = C {#,contains} A", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -598,7 +607,7 @@
     def test_temporal_hash_operator4(self):
         """Testing the temporal hash operator in the raster algebra. """
        
-        self.assertModule("t.rast.algebra",  expression="R = if({contains},A # D == 1, C {#,contains} A)", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = if({contains},A # D == 1, C {#,contains} A)", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -614,7 +623,7 @@
     def test_raster_arithmetic_relation_1(self):
         """Arithmetic test with temporal intersection"""
        
-        self.assertModule("t.rast.algebra",  expression="R = B {+,contains,l} A ", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = B {+,contains,l} A ", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -630,7 +639,7 @@
     def test_raster_arithmetic_relation_2(self):
         """Arithmetic test with temporal intersection"""
        
-        self.assertModule("t.rast.algebra",  expression="R = B {*,contains,l} A ", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = B {*,contains,l} A ", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -646,7 +655,7 @@
     def test_raster_arithmetic_relation_3(self):
         """Arithmetic test with temporal intersection"""
        
-        self.assertModule("t.rast.algebra",  expression="R = B {+,contains,l} A ", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = B {+,contains,l} A ", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         
@@ -661,9 +670,9 @@
     
     def test_raster_arithmetic_relation_4(self):
         """Arithmetic test with temporal intersection"""
-       
-        self.assertModule("t.rast.algebra",  expression="R = B {+,contains,r} A ", basename="r")
 
+        self.assertModule("t.rast.algebra", expression="R = B {+,contains,r} A ", basename="r")
+
         D = tgis.open_old_stds("R", type="strds")
         
         self.assertEqual(D.metadata.get_number_of_maps(),4)
@@ -678,7 +687,9 @@
     def test_raster_arithmetic_relation_5(self):
         """Complex arithmetic test with temporal intersection"""
        
-        self.assertModule("t.rast.algebra",  expression="R = tmap(singletmap) {+,equal| precedes| follows,l} A + map(singlemap)", basename="r")
+        self.assertModule("t.rast.algebra", expression="R = tmap(singletmap) "
+                                                        "{+,equal| precedes| follows,l} "
+                                                        "A + map(singlemap)", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
         

Modified: grass/branches/releasebranch_7_2/temporal/t.rast.algebra/testsuite/test_raster_algebra_granularity.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.rast.algebra/testsuite/test_raster_algebra_granularity.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/temporal/t.rast.algebra/testsuite/test_raster_algebra_granularity.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -78,6 +78,7 @@
     def test_1(self):
         """Simple arithmetik test"""
         expr = "R = if(C == 9,  A - 1)"
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -94,6 +95,7 @@
     def test_2(self):
         """Simple arithmetik test"""
         expr = "R = if(D == 11,  A - 1, A + 1)"
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -110,6 +112,7 @@
     def test_simple_arith_hash_1(self):
         """Simple arithmetic test including the hash operator"""
         expr ='R = A + (A # A)'
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
         
         D = tgis.open_old_stds("R", type="strds")
@@ -125,6 +128,7 @@
     def test_simple_arith_td_1(self):
         """Simple arithmetic test"""
         expr = 'R = A + td(A:D)'
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
         
         D = tgis.open_old_stds("R", type="strds")
@@ -141,6 +145,7 @@
     def test_simple_arith_if_1(self):
         """Simple arithmetic test with if condition"""
         expr = 'R = if(start_date(A) >= "2001-02-01", A + A)'
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -155,6 +160,7 @@
     def test_simple_arith_if_2(self):
         """Simple arithmetic test with if condition"""
         expr = 'R = if(A#A == 1, A - A)'
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -169,6 +175,7 @@
     def test_complex_arith_if_1(self):
         """Complex arithmetic test with if condition"""
         expr = 'R = if(start_date(A) < "2001-03-01" && A#A == 1, A+C, A-C)'
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -183,6 +190,7 @@
     def test_temporal_neighbors(self):
         """Simple temporal neighborhood computation test"""
         expr ='R = (A[0,0,-1] : D) + (A[0,0,1] : D)'
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -197,6 +205,7 @@
     def test_map(self):
         """Test STDS + single map without timestamp"""
         expr = "R = A + map(singletmap)"
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")
@@ -211,6 +220,7 @@
     def test_tmap_map(self):
         """Test STDS + single map with and without timestamp"""
         expr = "R = tmap(singletmap) + A + map(singletmap)"
+        self.assertModule("t.rast.algebra",  expression=expr, flags="gd", basename="r")
         self.assertModule("t.rast.algebra",  expression=expr, flags="g", basename="r")
 
         D = tgis.open_old_stds("R", type="strds")

Modified: grass/branches/releasebranch_7_2/temporal/t.select/t.select.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.select/t.select.py	2016-07-22 19:09:47 UTC (rev 69026)
+++ grass/branches/releasebranch_7_2/temporal/t.select/t.select.py	2016-07-22 19:13:51 UTC (rev 69027)
@@ -71,9 +71,8 @@
     pc = p.parse(expression, stdstype,  overwrite=grass.overwrite)
 
     if dry_run is True:
-        import simplejson
-        s = simplejson.dumps(pc)
-        print(s)
+        import pprint
+        pprint.pprint(pc)
 
 
 if __name__ == "__main__":



More information about the grass-commit mailing list