[GRASS-SVN] r62595 - in grass/trunk/temporal: t.rast.mapcalc2 t.select t.vect.mapcalc

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 4 07:47:38 PST 2014


Author: huhabla
Date: 2014-11-04 07:47:38 -0800 (Tue, 04 Nov 2014)
New Revision: 62595

Modified:
   grass/trunk/temporal/t.rast.mapcalc2/t.rast.mapcalc2.html
   grass/trunk/temporal/t.select/t.select.html
   grass/trunk/temporal/t.vect.mapcalc/t.vect.mapcalc.html
Log:
temporal modules: New temporal algebra approach implemented by Thomas Leppelt.

Modified: grass/trunk/temporal/t.rast.mapcalc2/t.rast.mapcalc2.html
===================================================================
--- grass/trunk/temporal/t.rast.mapcalc2/t.rast.mapcalc2.html	2014-11-04 15:45:52 UTC (rev 62594)
+++ grass/trunk/temporal/t.rast.mapcalc2/t.rast.mapcalc2.html	2014-11-04 15:47:38 UTC (rev 62595)
@@ -44,15 +44,16 @@
 <br>
 The map basename for the result STRDS must always be specified.
 
-<h2>Temporal raster algebra</h2>
+<h2>TEMPORAL RASTER ALGEBRA</h2>
 
-The temporal raster algebra provides a wide range of temporal and spatial operators and
+
+The temporal algebra provides a wide range of temporal operators and
 functions that will be presented in the following section. <br>
 <br>
 
-<h3>Temporal relations</h3>
+<h3>TEMPORAL RELATIONS</h3>
 
-Several temporal topology relations between space
+Several temporal topology relations between registered maps of space
 time datasets are supported: <br>
 <div class="code"><pre>
 equals            A ------
@@ -96,8 +97,23 @@
 <br>
 Topological relations must be specified in {} parentheses. <br>
 
-<h3>Temporal Selection</h3>
+<h3>TEMPORAL OPERATORS</h3>
 
+The temporal algebra defines temporal operators that can be combined with other 
+operators to perform spatio-temporal operations. 
+The temporal operators process the time instances and intervals of two temporal 
+related maps and calculate the result temporal extent by five differnt possibilities.
+<div class="code"><pre>
+LEFT REFERENCE     l       Use the time stamp of the left space time dataset
+INTERSECTION       i       Intersection
+DISJOINT UNION     d       Disjoint union
+UNION              u       Union
+RIGHT REFERENCE    r       Use the time stamp of the right space time dataset
+</pre></div>
+
+
+<h3>TEMPORAL SELECTION</h3>
+
 The temporal selection simply selects parts of a space time dataset without
 processing raster or vector data.
 
@@ -120,44 +136,59 @@
 <br>
 To select parts of a STDS by different topological relations to other STDS,
 the temporal topology selection operator can be used. The operator consists of
-topological relations, that must be separated by the logical OR operator
-<b>|</b> and the temporal selection operator. Both parts are separated by
-comma and surrounded by curly braces:
-{"topological relations", "temporal selection operator"}  <br>
+the temporal selection operator, the topological relations, that must be separated 
+by the logical OR operator <b>|</b> and the temporal extent operator. 
+All three parts are separated by comma and surrounded by curly braces:
+{"temporal selection operator", "topological relations", "temporal operator"}  <br>
 <br>
+
 Examples:
 <div class="code"><pre>
-C = A {equals,:} B
-C = A {equals,!:} B
+C = A {:, equals} B
+C = A {!:, equals} B
 </pre></div>
-We can now define arbitrary topological relations using logical OR operator
+We can now define arbitrary topological relations using the OR operator "|"
 to connect them:
 <div class="code"><pre>
-C = A {equals|during|overlaps,:} B
+C = A {:,equals|during|overlaps} B
 </pre></div>
 Select all parts of A that are equal to B, during B or overlaps B. <br>
+
+In addition we can define the temporal extent of the result STDS by adding the
+temporal operator.
+<div class="code"><pre>
+C = A {:, during,r} B
+</pre></div>
+Select all parts of A that are during B and use the temporal extents from B for 
+C. <br>
+
 <br>
 The selection operator is implicitly contained in the temporal topology
 selection operator, so that the following statements are exactly the same:
 <div class="code"><pre>
 C = A : B
 C = A {:} B
-C = A {equal,:} B
+C = A {:,equal} B
+C = A {:,equal,l} B
 </pre></div>
 
 Same for the complementary selection:
 <div class="code"><pre>
 C = A !: B
 C = A {!:} B
-C = A {equal,!:} B
+C = A {!:,equal} B
+C = A {!:,equal,l} B
 </pre></div>
 
-<h3>Conditional statements</h3>
+<h3>CONDITIONAL STATEMENTS</h3>
 
 Selection operations can be evaluated within conditional statements.
 <br>
 <div class="code"><pre>
-Note A and B can either be space time datasets or expressions.
+Note A and B can either be space time datasets or expressions. The temporal 
+relationship between the conditions and the conclusions can be defined at the 
+beginning of the if statement. The relationship between then and else conclusion 
+must be always equal.
 
 if statement                         decision option                        temporal relations
   if(if, then, else)
@@ -168,10 +199,10 @@
 </pre></div>
 The conditions are comparison expressions that are used to evaluate
 space time datasets. Specific values of temporal variables are
-compared by logical operators and evaluated for each map of the STDS.
-<br>
-<br>
-The supported logical operators:
+compared by logical operators and evaluated for each map of the STDS.<br>
+<b>Important:</b> The conditions are evaluated from left to right. 
+
+<h4>Logical operators</h4>
 <div class="code"><pre>
 Symbol  description
 
@@ -185,52 +216,90 @@
   ||    or
 </pre></div>
 
-Temporal functions: <br>
+<h4>Temporal functions</h4>
+The following temporal function are evaluated only for the STDS that must be given in parenthesis.
 <div class="code"><pre>
 
-td(A)                   Returns a list of time intervals of STDS A
+td(A)                    Returns a list of time intervals of STDS A
 
-start_time()            Start time as HH::MM:SS
-start_date()            Start date as yyyy-mm-DD
-start_datetime()        Start datetime as yyyy-mm-DD HH:MM:SS
-end_time()              End time as HH:MM:SS
-end_date()              End date as yyyy-mm-DD
-end_datetime()          End datetime as  yyyy-mm-DD HH:MM
+start_time(A)            Start time as HH::MM:SS
+start_date(A)            Start date as yyyy-mm-DD
+start_datetime(A)        Start datetime as yyyy-mm-DD HH:MM:SS
+end_time(A)              End time as HH:MM:SS
+end_date(A)              End date as yyyy-mm-DD
+end_datetime(A)          End datetime as  yyyy-mm-DD HH:MM
 
-start_doy()             Day of year (doy) from the start time [1 - 366]
-start_dow()             Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
-start_year()            The year of the start time [0 - 9999]
-start_month()           The month of the start time [1 - 12]
-start_week()            Week of year of the start time [1 - 54]
-start_day()             Day of month from the start time [1 - 31]
-start_hour()            The hour of the start time [0 - 23]
-start_minute()          The minute of the start time [0 - 59]
-start_second()          The second of the start time [0 - 59]
-end_doy()               Day of year (doy) from the end time [1 - 366]
-end_dow()               Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
-end_year()              The year of the end time [0 - 9999]
-end_month()             The month of the end time [1 - 12]
-end_week()              Week of year of the end time [1 - 54]
-end_day()               Day of month from the start time [1 - 31]
-end_hour()              The hour of the end time [0 - 23]
-end_minute()            The minute of the end time [0 - 59]
-end_second()            The second of the end time [0 - 59]
+start_doy(A)             Day of year (doy) from the start time [1 - 366]
+start_dow(A)             Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
+start_year(A)            The year of the start time [0 - 9999]
+start_month(A)           The month of the start time [1 - 12]
+start_week(A)            Week of year of the start time [1 - 54]
+start_day(A)             Day of month from the start time [1 - 31]
+start_hour(A)            The hour of the start time [0 - 23]
+start_minute(A)          The minute of the start time [0 - 59]
+start_second(A)          The second of the start time [0 - 59]
+end_doy(A)               Day of year (doy) from the end time [1 - 366]
+end_dow(A)               Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
+end_year(A)              The year of the end time [0 - 9999]
+end_month(A)             The month of the end time [1 - 12]
+end_week(A)              Week of year of the end time [1 - 54]
+end_day(A)               Day of month from the start time [1 - 31]
+end_hour(A)              The hour of the end time [0 - 23]
+end_minute(A)            The minute of the end time [0 - 59]
+end_second(A)            The second of the end time [0 - 59]
 </pre></div>
 
-Additionally the number of maps in intervals can be computed and
-used in conditional statements. <br>
-The operator to count the number of maps
-is the hash <b>#</b>.
+<h4>Comparison operator</h4>
+The conditions are comparison expressions that are used to evaluate
+space time datasets. Specific values of temporal variables are
+compared by logical operators and evaluated for each map of the STDS and 
+the related maps.
+For complex relations the comparison operator can be used to combine conditions: 
+<br>
+The structure is similar to the select operator with the extention of an aggregation operator: 
+{"comparison operator", "topological relations", aggregation operator, "temporal operator"}
+<br>
+This aggregation operator (| or &) define the behaviour if a map is related the more 
+than one map, e.g for the topological relations 'contains'.
+Should all (&) conditions for the related maps be true or is it sufficient to 
+have any (|) condition that is true. The resulting boolean value is then compared 
+to the first condition by the comparison operator (|| or &&). 
+As default the aggregation operator is related to the comparison operator: <br>
+Comparison operator -> aggregation operator:
 <div class="code"><pre>
-A{contains,#}B
+|| -> | and && -> & 
 </pre></div>
+Examples:
+<div class="code"><pre>
+Condition 1 {||, equal, r} Condition 2
+Condition 1 {&&, equal|during, l} Condition 2
+Condition 1 {&&, equal|contains, |, l} Condition 2
+Condition 1 {&&, equal|during, l} Condition 2 && Condition 3
+Condition 1 {&&, equal|during, l} Condition 2 {&&,contains, |, r} Condition 3
+</pre></div>
+
+<h4>Hash operator</h4>
+Additionally the number of maps in intervals can be computed and used in 
+conditional statements with the hash (#) operator. <br>
+<div class="code"><pre>
+A{#, contains}B
+</pre></div>
 This expression computes the number of maps from space
 time dataset B which are during the time intervals of maps from
 space time dataset A.<br>
 A list of integers (scalars) corresponding to the maps of A
 that contain maps from B will be returned. <br>
 <br>
-
+<div class="code"><pre>
+C = if({equal}, A {#, contains} B > 2, A {:, contains} B)
+</pre></div>
+This expression selects all maps from A that temporally contains at least 2 
+maps from B and stores them in space time dataset C. The leading equal statement 
+in the if condition specifies the temporal relation between the if and then part 
+of the if expression. This is very important, so we do not need to specify a 
+global time reference (a space time dataset) for temporal processing.
+<br>
+<br>
 Furthermore the temporal algebra allows temporal buffering, shifting
 and snapping with the functions buff_t(), tshift() and tsnap()
 respectively.
@@ -239,22 +308,17 @@
 tshift(A, size)         Shift STDS A with granule ("1 month" or 5)
 tsnap(A)                Snap time instances and intervals of STDS A
 </pre></div>
-
-<h3>Temporal Operators</h3>
-<p>
-The temporal algebra defines temporal operators that can be combined
-later with spatial operators to perform spatio-temporal operations.
-The temporal operators process the time instances and intervals of temporal related maps.
-</p>
+<br>
+<h4>Single map with temporal extent</h4>
+The temporal algebra can also handle single maps with time stamps in the tmap function.
 <div class="code"><pre>
-AND             &       Intersection
-OR              |       Union
-DISJOINT OR     +       Disjoint union
-LEFT REFERENCE  =       Use the time stamp of the left space time dataset
-</pre></div><p>
-For example we can compute the intersection, union or disjoint union from time stamps of maps
-that temporally overlap, or we can just keep the time stamp of the left STDS.
-</p>
+tmap()
+</pre></div>
+For example:
+<div class="code"><pre>
+ C = A {:,during} tmap(event)
+</pre></div>
+This statement select all maps from space time data set A that are during the temporal extent of single map 'event'
 
 <h3>Spatial raster operators</h3>
 
@@ -272,56 +336,124 @@
 And raster functions:
 <div class="code"><pre>
 abs(x)                  return absolute value of x
-foat(x)                 convert x to foating point
-if decision options:
-  if(x)                 1 if x not zero, 0 otherwise
-  if(x,a)               a if x not zero, 0 otherwise
-  if(x,a,b)             a if x not zero, b otherwise
+float(x)                convert x to foating point
 int(x)                  convert x to integer [ truncates ]
 log(x)                  natural log of x
 sqrt(x)                 square root of x
 tan(x)                  tangent of x (x is in degrees)
-round(x)		round x to nearest integer
-sin(x)			sine of x (x is in degrees)
-sqrt(x)			square root of x
-tan(x)			tangent of x (x is in degrees)
-isnull(x)              check if x = NULL
+round(x)		            round x to nearest integer
+sin(x)			            sine of x (x is in degrees)
+sqrt(x)			            square root of x
+tan(x)			            tangent of x (x is in degrees)
+isnull(x)               check if x = NULL
+isntnull(x)             check if x is not NULL
+null                    set null value
+exist(x)                Check if x is in the current mapset                 
 </pre></div>
-<br>
 
-<p>
+<h4>Single raster map </h4>
+
+The temporal raster algebra feature also a function to integrate single raster 
+maps without time stamps into the expressions.
+<div class="code"><pre>
+ map()
+</pre></div>
+For example:
+<div class="code"><pre>
+ C = A * map(constant_value)
+</pre></div>
+This statement multiply all raster maps from space time raster data set A with the raster map 'constant_value'
 <h3>Combinations of temporal, raster and select operators</h3>
 
 We combine the temporal topology relations, the temporal operators and the spatial/select operators to create spatio-temporal operators:
 
 <div class="code"><pre>
-{"list of temporal relations", "temporal operator" "spatial or select operator"}
+{"spatial or select operator", "list of temporal relations", "temporal operator"}
 </pre></div>
-<p>
-The spatial and the select operators can be used stand-alone.
-In this case the temporal topology relation "equal" and the temporal operator
-"left reference =" is assumed and used as default. This allows the convenient use of the spatial and select
-operators in case of space time raster datasets with equal time stamps.
-</p>
-<div class="code"> <pre>
- ----------------------------
-|   |  % |  / |  * |  - |  + |
-|---|----|----|----|----|----|
-| & | &% | &/ | &* | &- | &+ |
-| | | |% | |/ | |* | |- | |+ |
-| + | +% | +/ | +* | +- | ++ |
-| = | =% | =/ | =* | =- | =+ |
- ----------------------------
-</pre></div>
 
+For multiple topological relations or several related maps the spatio-temporal 
+operators feature implicit aggregation.
+
+The algebra evaluates the stated STDS by their temporal topologies and apply 
+the given spatio temporal operators in a aggregated form.
+
+If we have two STDS A and B, B has three maps: b1, b2, b3 that are all during 
+the temporal extent of the single map a1 of A, then the following arithmetic 
+calculations would implicitly aggregate all maps of B into one result map for 
+a1 of A:
+<pre class="code">
+ C = A {+, contains} B --> c1 = a1 + b1 + b2 + b3
+</pre><p>
+Keep attention that the aggregation behaviour is not symmetric:
+<pre class="code">
+ C = B {+, during} A --> c1 = b1 + a1
+                         c2 = b2 + a1
+                         c3 = b3 + a1
+</pre>
+<h3>Temporal neighbourhood modifier</h3>
+
+The neighbourhood modifier of r.mapcalc is extended for the temporal raster algebra by the temporal dimension.
+The format is strds[t,r,c], where t is the temporal offset, r is the row offset and c is the column offset. <br>
+<pre class="code">
+strds[2] 
+</pre>
+Refers to the second successor of the current map
+<pre class="code">
+strds[1,2]
+</pre>
+Refers to the cell one row below and two columns to the right of the current cell in the current map
+<pre class="code">
+strds[1,-2,-1] 
+</pre>
+Refers to the cell two rows above and one column to the left of the current cell of the first successor map
+<pre class="code">
+strds[-2,0,1]
+</pre>
+Refers to the cell one column to the right of the current cell in the second predecessor map.
+
 <h3>Examples: </h3>
 Sum maps from space time dataset A with maps from space time dataset
 B which have equal time stamps and are temporary before Jan. 1. 2005 and
 store them in space time dataset D.
 <div class="code"><pre>
-D = if(start_date() < "2005-01-01", A + B)
+D = if(start_date(A) < "2005-01-01", A + B)
 </pre></div>
 
+Create the sum of all maps from STRDS A and B that have equal time stamps and store the new maps in STRDS C:
+<div class="code"><pre>
+C = A + B
+</pre></div>
+Same expression with explicit definition of the temporal topology relation and temporal operators:
+<div class="code"><pre>
+C = A {+,equal,l} B
+</pre></div>
+Select all cells from STRDS B with equal temporal relations to STRDS A, if the 
+cells of A are in the range of [100.0, 1600] of time intervals that have more 
+then 30 days (Jan, Mar, Mai, Jul, Aug, Oct, Dec):
+<div class="code"><pre>
+C = if(A > 100 && A < 1600 && td(A) > 30, B)
+</pre></div>
+Same expression with explicit definition of the temporal topology relation and temporal operators:
+<div class="code"><pre>
+C = if({equal}, A > 100 && A < 1600 {&&,equal} td(A) > 30, B)
+</pre></div>
+Compute the recharge in meter per second for all cells of precipitation STRDS "Prec" if the mean temperature specified in STRDS "Temp" is higher than 10 degrees. Computation is performed if STRDS "Prec" and "Temp" have equal time stamps. The number of days or fraction of days per interval is computed using the td() function that has as argument the STRDS "Prec":
+<div class="code"><pre>
+C = if(Temp > 10.0, Prec / 3600.0 /24.0 / td(Prec))
+</pre></div>
+Same expression with explicit definition of the temporal topology relation and temporal operators:
+<div class="code"><pre>
+C = if({equal}, Temp > 10.0, Prec / 3600.0 / 24.0 {/,equal,l} td(Prec))
+</pre></div>
+Compute the mean value of all maps from STRDS A that are located during time intervals of STRDS B if more than one map of A is contained in an interval of B, use A otherwise, the resulting time intervals are either from B or A:
+<div class="code"><pre>
+C = if(B {#,contain} A > 1, (B {+,contain,l} A - B) / (B {#,contain} A), A)
+</pre></div>
+Same expression with explicit definition of the temporal topology relation and temporal operators:
+<div class="code"><pre>
+C = if({equal}, B {#,contain} A > 1, (B {+,contain,l} A {-,equal,l} B) {equal,=/} (B {#,contain} A), A)
+</pre></div>
+
 <h2>REFERENCES</h2>
 
 <tt><a href="http://www.dabeaz.com/ply/">PLY(Python-Lex-Yacc)</a></tt>

Modified: grass/trunk/temporal/t.select/t.select.html
===================================================================
--- grass/trunk/temporal/t.select/t.select.html	2014-11-04 15:45:52 UTC (rev 62594)
+++ grass/trunk/temporal/t.select/t.select.html	2014-11-04 15:47:38 UTC (rev 62595)
@@ -1,63 +1,57 @@
 <h2>DESCRIPTION</h2>
 
-<em>t.select</em> performs selection of maps that are registered in 
-space time datasets using temporal algebra.
+t.select performs selection of maps that are registered in space time datasets using temporal algebra.
 
 <h3>PROGRAM USE</h3>
-The module expects an <b>expression</b> as input parameter in the
-following form:<br>
+The module expects an <b>expression</b> as input parameter in the following form: <br>
 <br>
 <b> "result = expression" </b>
 <br>
+<br>
 
 The statement structure is similar to r.mapcalc, see <a href="r.mapcalc.html">r.mapcalc</a>.
 Where <b>result</b> represents the name of a space time dataset (STDS)that will
 contain the result of the calculation that is given as <b>expression</b>
 on the right side of the equality sign.
 These expression can be any valid or nested combination of temporal
-operations and functions that are provided by the temporal algebra.
-<p>
-The temporal algebra works with space time datasets of any type (STRDS, 
-STR3DS and STVDS). The algebra provides methods for map selection from 
-STDS based on their temporal relations. It is also possible to 
-temporally shift maps, to create temporal buffer and to snap time 
-instances to create a valid temporal topology. Furthermore expressions 
-can be nested and evaluated in conditional statements (if, else 
-statements). Within if-statements the algebra provides temporal 
-variables like start time, end time, day of year, time differences or 
-number of maps per time interval to build up conditions. These 
-operations can be assigned to space time datasets or to the results of 
-operations between space time datasets.
-<p>
+operations and functions that are provided by the temporal algebra.  <br>
+The temporal algebra works with space time datasets of any type (STRDS, STR3DS and STVDS).
+The algebra provides methods for map selection from STDS based on their temporal relations.
+It is also possible to temporally shift maps, to create temporal buffer and to snap time
+instances to create a valid temporal topology. Furthermore expressions can be nested and
+evaluated in conditional statements (if, else statements). Within if-statements the algebra
+provides temporal variables like start time, end time, day of year, time differences or
+number of maps per time interval to build up conditions. These operations can be assigned
+to space time datasets or to the results of operations between space time datasets.
+<br>
+<br>
 The type of the input space time datasets must be defined with the input
 parameter <b>type</b>. Possible options are STRDS, STVDS or STR3DS.
 The default is set to space time raster datasets (STRDS).
-<p>
+<br>
+<br>
 As default, topological relationships between space time datasets will be
 evaluated only temporal. Use the <b>s</b> flag to activate the
 additionally spatial topology evaluation.
-<p>
+<br>
+<br>
 The expression option must be passed as <b>quoted</b>
-expression, for example:
-<br>
-<div class="code"><pre>
-t.select expression="C = A : B"
-</pre></div>
-
+expression, for example: <br>
+<div class="code"><pre>t.select expression="C = A : B"</pre></div>
 Where <b>C</b> is the new space time raster dataset that will contain maps
 from <b>A</b> that are selected by equal temporal relationships
-to the existing dataset <b>B</b> in this case.
-
+to the existing dataset <b>B</b> in this case. <br>
+<br>
 <h2>TEMPORAL ALGEBRA</h2>
 
 The temporal algebra provides a wide range of temporal operators and
-functions that will be presented in the following section.
+functions that will be presented in the following section. <br>
+<br>
 
 <h3>TEMPORAL RELATIONS</h3>
 
 Several temporal topology relations between registered maps of space
-time datasets are supported:
-<br>
+time datasets are supported: <br>
 <div class="code"><pre>
 equals            A ------
                   B ------
@@ -96,15 +90,30 @@
 
 </pre></div>
 The relations must be read as: A is related to B, like - A equals B - A is
-during B - A contains B
-<p>
-Topological relations must be specified in {} parentheses.
+during B - A contains B <br>
+<br>
+Topological relations must be specified in {} parentheses. <br>
 
+<h3>TEMPORAL OPERATORS</h3>
+
+The temporal algebra defines temporal operators that can be combined with other 
+operators to perform spatio-temporal operations. 
+The temporal operators process the time instances and intervals of two temporal 
+related maps and calculate the result temporal extent by five differnt possibilities.
+<div class="code"><pre>
+LEFT REFERENCE     l       Use the time stamp of the left space time dataset
+INTERSECTION       i       Intersection
+DISJOINT UNION     d       Disjoint union
+UNION              u       Union
+RIGHT REFERENCE    r       Use the time stamp of the right space time dataset
+</pre></div>
+
+
 <h3>TEMPORAL SELECTION</h3>
 
 The temporal selection simply selects parts of a space time dataset without
 processing raster or vector data.
-<p>
+
 The algebra provides a selection operator <b>:</b> that selects parts
 of a space time dataset that are temporally equal to parts of a second one
 by default. The following expression
@@ -112,48 +121,60 @@
 C = A : B
 </pre></div>
 means: Select all parts of space time dataset A that are equal to B and store
-it in space time dataset C. The parts are time stamped maps.
-<p>
-In addition the inverse selection operator <b>!:</b> is defined as the
-complement of the selection operator, hence the following expression
+it in space time dataset C. The parts are time stamped maps. <br>
+<br>
+In addition the inverse selection operator <b>!:</b> is defined as the complement of
+the selection operator, hence the following expression
 <div class="code"><pre>
 C = A !: B
 </pre></div>
 means: select all parts of space time time dataset A that are not equal to B
-and store it in space time dataset (STDS) C.
-<p>
+and store it in space time dataset (STDS) C. <br>
+<br>
 To select parts of a STDS by different topological relations to other STDS,
 the temporal topology selection operator can be used. The operator consists of
-topological relations, that must be separated by the logical OR operator
-<b>||</b> and the temporal selection operator. Both parts are separated by
-comma and surrounded by curly braces:
-{"topological relations", "temporal selection operator"}
-<p>
+the temporal selection operator, the topological relations, that must be separated 
+by the logical OR operator <b>|</b> and the temporal extent operator. 
+All three parts are separated by comma and surrounded by curly braces:
+{"temporal selection operator", "topological relations", "temporal operator"}  <br>
+<br>
+
 Examples:
 <div class="code"><pre>
-C = A {equals,:} B
-C = A {equals,!:} B
+C = A {:, equals} B
+C = A {!:, equals} B
 </pre></div>
 We can now define arbitrary topological relations using the OR operator "|"
 to connect them:
 <div class="code"><pre>
-C = A {equals|during|overlaps,:} B
+C = A {:,equals|during|overlaps} B
 </pre></div>
-Select all parts of A that are equal to B, during B or overlaps B.
-<p>
+Select all parts of A that are equal to B, during B or overlaps B. <br>
+
+In addition we can define the temporal extent of the result STDS by adding the
+temporal operator.
+<div class="code"><pre>
+C = A {:, during,r} B
+</pre></div>
+Select all parts of A that are during B and use the temporal extents from B for 
+C. <br>
+
+<br>
 The selection operator is implicitly contained in the temporal topology
 selection operator, so that the following statements are exactly the same:
 <div class="code"><pre>
 C = A : B
 C = A {:} B
-C = A {equal,:} B
+C = A {:,equal} B
+C = A {:,equal,l} B
 </pre></div>
 
 Same for the complementary selection:
 <div class="code"><pre>
 C = A !: B
 C = A {!:} B
-C = A {equal,!:} B
+C = A {!:,equal} B
+C = A {!:,equal,l} B
 </pre></div>
 
 <h3>CONDITIONAL STATEMENTS</h3>
@@ -161,7 +182,10 @@
 Selection operations can be evaluated within conditional statements.
 <br>
 <div class="code"><pre>
-Note A and B can either be space time datasets or expressions.
+Note A and B can either be space time datasets or expressions. The temporal 
+relationship between the conditions and the conclusions can be defined at the 
+beginning of the if statement. The relationship between then and else conclusion 
+must be always equal.
 
 if statement                         decision option                        temporal relations
   if(if, then, else)
@@ -172,9 +196,10 @@
 </pre></div>
 The conditions are comparison expressions that are used to evaluate
 space time datasets. Specific values of temporal variables are
-compared by logical operators and evaluated for each map of the STDS.
-<p>
-The supported logical operators:
+compared by logical operators and evaluated for each map of the STDS.<br>
+<b>Important:</b> The conditions are evaluated from left to right. 
+
+<h4>Logical operators</h4>
 <div class="code"><pre>
 Symbol  description
 
@@ -188,85 +213,132 @@
   ||    or
 </pre></div>
 
-Temporal functions:
-<br>
+<h4>Temporal functions</h4>
+The following temporal function are evaluated only for the STDS that must be given in parenthesis.
 <div class="code"><pre>
 
-td(A)                   Returns a list of time intervals of STDS A
+td(A)                    Returns a list of time intervals of STDS A
 
-start_time()            Start time as HH::MM:SS
-start_date()            Start date as yyyy-mm-DD
-start_datetime()        Start datetime as yyyy-mm-DD HH:MM:SS
-end_time()              End time as HH:MM:SS
-end_date()              End date as yyyy-mm-DD
-end_datetime()          End datetime as  yyyy-mm-DD HH:MM
+start_time(A)            Start time as HH::MM:SS
+start_date(A)            Start date as yyyy-mm-DD
+start_datetime(A)        Start datetime as yyyy-mm-DD HH:MM:SS
+end_time(A)              End time as HH:MM:SS
+end_date(A)              End date as yyyy-mm-DD
+end_datetime(A)          End datetime as  yyyy-mm-DD HH:MM
 
-start_doy()             Day of year (doy) from the start time [1 - 366]
-start_dow()             Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
-start_year()            The year of the start time [0 - 9999]
-start_month()           The month of the start time [1 - 12]
-start_week()            Week of year of the start time [1 - 54]
-start_day()             Day of month from the start time [1 - 31]
-start_hour()            The hour of the start time [0 - 23]
-start_minute()          The minute of the start time [0 - 59]
-start_second()          The second of the start time [0 - 59]
-end_doy()               Day of year (doy) from the end time [1 - 366]
-end_dow()               Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
-end_year()              The year of the end time [0 - 9999]
-end_month()             The month of the end time [1 - 12]
-end_week()              Week of year of the end time [1 - 54]
-end_day()               Day of month from the start time [1 - 31]
-end_hour()              The hour of the end time [0 - 23]
-end_minute()            The minute of the end time [0 - 59]
-end_second()            The second of the end time [0 - 59]
+start_doy(A)             Day of year (doy) from the start time [1 - 366]
+start_dow(A)             Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
+start_year(A)            The year of the start time [0 - 9999]
+start_month(A)           The month of the start time [1 - 12]
+start_week(A)            Week of year of the start time [1 - 54]
+start_day(A)             Day of month from the start time [1 - 31]
+start_hour(A)            The hour of the start time [0 - 23]
+start_minute(A)          The minute of the start time [0 - 59]
+start_second(A)          The second of the start time [0 - 59]
+end_doy(A)               Day of year (doy) from the end time [1 - 366]
+end_dow(A)               Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
+end_year(A)              The year of the end time [0 - 9999]
+end_month(A)             The month of the end time [1 - 12]
+end_week(A)              Week of year of the end time [1 - 54]
+end_day(A)               Day of month from the start time [1 - 31]
+end_hour(A)              The hour of the end time [0 - 23]
+end_minute(A)            The minute of the end time [0 - 59]
+end_second(A)            The second of the end time [0 - 59]
 </pre></div>
 
-Additionally the number of maps in intervals can be computed and
-used in conditional statements. <br>
-The operator to count the number of maps
-is the hash <b>#</b>.
+<h4>Comparison operator</h4>
+The conditions are comparison expressions that are used to evaluate
+space time datasets. Specific values of temporal variables are
+compared by logical operators and evaluated for each map of the STDS and 
+the related maps.
+For complex relations the comparison operator can be used to combine conditions: 
+<br>
+The structure is similar to the select operator with the extention of an aggregation operator: 
+{"comparison operator", "topological relations", aggregation operator, "temporal operator"}
+<br>
+This aggregation operator (| or &) define the behaviour if a map is related the more 
+than one map, e.g for the topological relations 'contains'.
+Should all (&) conditions for the related maps be true or is it sufficient to 
+have any (|) condition that is true. The resulting boolean value is then compared 
+to the first condition by the comparison operator (|| or &&). 
+As default the aggregation operator is related to the comparison operator: <br>
+Comparison operator -> aggregation operator:
 <div class="code"><pre>
-A{contains,#}B
+|| -> | and && -> & 
 </pre></div>
+Examples:
+<div class="code"><pre>
+Condition 1 {||, equal, r} Condition 2
+Condition 1 {&&, equal|during, l} Condition 2
+Condition 1 {&&, equal|contains, |, l} Condition 2
+Condition 1 {&&, equal|during, l} Condition 2 && Condition 3
+Condition 1 {&&, equal|during, l} Condition 2 {&&,contains, |, r} Condition 3
+</pre></div>
+
+<h4>Hash operator</h4>
+Additionally the number of maps in intervals can be computed and used in 
+conditional statements with the hash (#) operator. <br>
+<div class="code"><pre>
+A{#, contains}B
+</pre></div>
 This expression computes the number of maps from space
 time dataset B which are during the time intervals of maps from
 space time dataset A.<br>
 A list of integers (scalars) corresponding to the maps of A
-that contain maps from B will be returned.
-<p>
-
+that contain maps from B will be returned. <br>
+<br>
+<div class="code"><pre>
+C = if({equal}, A {#, contains} B > 2, A {:, contains} B)
+</pre></div>
+This expression selects all maps from A that temporally contains at least 2 
+maps from B and stores them in space time dataset C. The leading equal statement 
+in the if condition specifies the temporal relation between the if and then part 
+of the if expression. This is very important, so we do not need to specify a 
+global time reference (a space time dataset) for temporal processing.
+<br>
+<br>
 Furthermore the temporal algebra allows temporal buffering, shifting
 and snapping with the functions buff_t(), tshift() and tsnap()
 respectively.
-
 <div class="code"><pre>
 buff_t(A, size)         Buffer STDS A with granule ("1 month" or 5)
 tshift(A, size)         Shift STDS A with granule ("1 month" or 5)
 tsnap(A)                Snap time instances and intervals of STDS A
 </pre></div>
+<br>
+<h4>Single map with temporal extent</h4>
+The temporal algebra can also handle single maps with time stamps in the tmap function.
+<div class="code"><pre>
+tmap()
+</pre></div>
+For example:
+<div class="code"><pre>
+ C = A {:,during} tmap(event)
+</pre></div>
+This statement select all maps from space time data set A that are during the temporal extent of single map 'event'
 
+<br>
 <h3>Examples: </h3>
 
 Select all maps from space time dataset A which have equal time stamps
 with space time dataset B and C and are ealier that Jan. 1. 2005 and
 store them in space time dataset D.
-
 <div class="code"><pre>
-D = if(start_date() < "2005-01-01", A : B : C)
+D = if(start_date(A) < "2005-01-01", A : B : C)
 </pre></div>
 
 Select all maps from space time dataset A which contains more than three
 maps of space time dataset B, else select maps from C with time
 stamps that are not equal to A and store them in space time dataset D.
 <div class="code"><pre>
-D = if(A {contain, #} B > 3, A {contain, :} B, C)
+D = if(A {#, contains} B > 3, A {:, contains} B, C)
 </pre></div>
 
 Select all maps from space time dataset B which are during the temporal
 buffered space time dataset A with a map interval of three days, else
 select maps from C and store them in space time dataset D.
 <div class="code"><pre>
-D = if(contain, td(buff_t(A, "1 days")) == 3, B, C)
+D = if(contains, td(buff_t(A, "1 days")) == 3, B, C)
 </pre></div>
 
 <h2>REFERENCES</h2>

Modified: grass/trunk/temporal/t.vect.mapcalc/t.vect.mapcalc.html
===================================================================
--- grass/trunk/temporal/t.vect.mapcalc/t.vect.mapcalc.html	2014-11-04 15:45:52 UTC (rev 62594)
+++ grass/trunk/temporal/t.vect.mapcalc/t.vect.mapcalc.html	2014-11-04 15:47:38 UTC (rev 62595)
@@ -1,73 +1,66 @@
 <h2>DESCRIPTION</h2> 
 
-<em>t.vect.mapcalc</em> performs temporal and spatial overlays and buffer 
-functions on space time vector datasets (STVDS) by using the temporal 
-vector algebra. New STVDS can be created, which are expressions of 
-existing STVDS.
+t.vect.mapcalc performs temporal and spatial overlay and buffer functions on space time vector datasets (STVDS)
+by using the temporal vector algebra. New STVDS can be created, which are expressions of existing STVDS.
 
-<h3>NOTES</h3> 
+<h3>PROGRAM USE</h3>
 The module expects an <b>expression</b> as input parameter in the following form: <br>
 <br>
 <b> "result = expression" </b>
 <br>
 <br>
 
-The statement structure is similar to r.mapcalc, see <a 
-href="r.mapcalc.html">r.mapcalc</a>. Where <b>result</b> represents the 
-name of a space time vector dataset (STVDS)that will contain the result 
-of the calculation that is given as <b>expression</b> on the right side 
-of the equality sign. These expression can be any valid or nested 
-combination of temporal operations and spatial overlay or buffer 
-functions that are provided by the temporal algebra.
+The statement structure is similar to r.mapcalc, see <a href="r.mapcalc.html">r.mapcalc</a>.
+Where <b>result</b> represents the name of a space time dataset (STVDS) that will
+contain the result of the calculation that is given as <b>expression</b>
+on the right side of the equality sign.
+These expression can be any valid or nested combination of temporal
+operations and functions that are provided by the temporal vector algebra.  <br>
+The algebra provides methods for map selection from STDS based on their temporal relations.
+It is also possible to temporally shift maps, to create temporal buffer and to snap time
+instances to create a valid temporal topology. Furthermore expressions can be nested and
+evaluated in conditional statements (if, else statements). Within if-statements the algebra
+provides temporal variables like start time, end time, day of year, time differences or
+number of maps per time interval to build up conditions. These operations can be assigned
+to space time datasets or to the results of operations between space time datasets.
 <br>
-The temporal vector algebra works with space time vector datasets only 
-(STVDS). The algebra provides methods for map selection from STVDS 
-based on their temporal relations. It is also possible to temporally 
-shift maps, to create temporal buffer and to snap time instances to 
-create a valid temporal topology. Furthermore expressions can be nested 
-and evaluated in conditional statements (if, else statements). Within 
-if-statements the algebra provides temporal variables like start time, 
-end time, day of year, time differences or number of maps per time 
-interval to build up conditions. In addition the algebra provides the 
-spatial operations for vector overlay and buffering. All these 
-operations can be assigned to STVDS or to the resulting map lists of 
-operations between STVDS. 
 <br>
+The type of the input space time datasets must be defined with the input
+parameter <b>type</b>. Possible options are STRDS, STVDS or STR3DS.
+The default is set to space time raster datasets (STRDS).
 <br>
-As default, topological relationships between space time datasets will be 
-evaluated only temporal. Use the <b>s</b> flag to activate the 
-additionally evaluate the spatial topology based on the spatial extents of maps.
 <br>
+As default, topological relationships between space time datasets will be
+evaluated only temporal. Use the <b>s</b> flag to activate the
+additionally spatial topology evaluation.
 <br>
-The expression option must be passed as <b>quoted</b> 
+<br>
+The expression option must be passed as <b>quoted</b>
 expression, for example: <br>
-<div class="code"><pre>t.vect.mapcalc expression="C = A & B" basename=result</pre></div> 
-Where <b>C</b> is the new space time vector dataset that will contain maps
-with the basename "result" that represent the intersection of maps from STVDS <b>A</b> and 
-equally temporal related maps from STVDS <b>B</b>.
+<div class="code"><pre>t.select expression="C = A : B"</pre></div>
+Where <b>C</b> is the new space time raster dataset that will contain maps
+from <b>A</b> that are selected by equal temporal relationships
+to the existing dataset <b>B</b> in this case. <br>
 <br>
-<br>
-The map basename for the result STVDS must always be specified.
+<h2>TEMPORAL VECTOR ALGEBRA</h2>
 
-<h2>Temporal vector algebra</h2>
-
-The temporal vector algebra provides a wide range of temporal and spatial operators and 
+The temporal algebra provides a wide range of temporal operators and
 functions that will be presented in the following section. <br>
 <br>
 
-<h3>Temporal relations</h3>
+<h3>TEMPORAL RELATIONS</h3>
 
-Several temporal topology relations between space 
+Several temporal topology relations between registered maps of space
 time datasets are supported: <br>
 <div class="code"><pre>
 equals            A ------
                   B ------
 
-during            A  ---- 
+during            A  ----
                   B ------
 
 contains          A ------
-                  B  ---- 
+                  B  ----
 
 starts            A ----
                   B ------
@@ -75,7 +68,7 @@
 started           A ------
                   B ----
 
-finishs           A   ---- 
+finishs           A   ----
                   B ------
 
 finished          A ------
@@ -96,73 +89,103 @@
 over              booth overlaps and overlapped
 
 </pre></div>
-The relations must be read as: A is related to B, like - A equals B - A is 
+The relations must be read as: A is related to B, like - A equals B - A is
 during B - A contains B <br>
 <br>
 Topological relations must be specified in {} parentheses. <br>
 
-<h3>Temporal Selection</h3>
+<h3>TEMPORAL OPERATORS</h3>
 
-The temporal selection simply selects parts of a space time dataset without 
+The temporal algebra defines temporal operators that can be combined with other 
+operators to perform spatio-temporal operations. 
+The temporal operators process the time instances and intervals of two temporal 
+related maps and calculate the result temporal extent by five differnt possibilities.
+<div class="code"><pre>
+LEFT REFERENCE     l       Use the time stamp of the left space time dataset
+INTERSECTION       i       Intersection
+DISJOINT UNION     d       Disjoint union
+UNION              u       Union
+RIGHT REFERENCE    r       Use the time stamp of the right space time dataset
+</pre></div>
+
+
+<h3>TEMPORAL SELECTION</h3>
+
+The temporal selection simply selects parts of a space time dataset without
 processing raster or vector data.
 
-The algebra provides a selection operator <b>:</b> that selects parts 
-of a space time dataset that are temporally equal to parts of a second one 
+The algebra provides a selection operator <b>:</b> that selects parts
+of a space time dataset that are temporally equal to parts of a second one
 by default. The following expression
 <div class="code"><pre>
 C = A : B
 </pre></div>
-means: Select all parts of space time dataset A that are equal to B and store 
+means: Select all parts of space time dataset A that are equal to B and store
 it in space time dataset C. The parts are time stamped maps. <br>
 <br>
-In addition the inverse selection operator <b>!:</b> is defined as the complement of 
+In addition the inverse selection operator <b>!:</b> is defined as the complement of
 the selection operator, hence the following expression
 <div class="code"><pre>
 C = A !: B
 </pre></div>
-means: select all parts of space time time dataset A that are not equal to B 
+means: select all parts of space time time dataset A that are not equal to B
 and store it in space time dataset (STDS) C. <br>
 <br>
-To select parts of a STDS by different topological relations to other STDS, 
-the temporal topology selection operator can be used. The operator consists of 
-topological relations, that must be separated by the logical OR operator 
-<b>|</b> and the temporal selection operator. Both parts are separated by 
-comma and surrounded by curly braces: 
-{"topological relations", "temporal selection operator"}  <br>
+To select parts of a STDS by different topological relations to other STDS,
+the temporal topology selection operator can be used. The operator consists of
+the temporal selection operator, the topological relations, that must be separated 
+by the logical OR operator <b>|</b> and the temporal extent operator. 
+All three parts are separated by comma and surrounded by curly braces:
+{"temporal selection operator", "topological relations", "temporal operator"}  <br>
 <br>
+
 Examples:
 <div class="code"><pre>
-C = A {equals,:} B
-C = A {equals,!:} B
+C = A {:, equals} B
+C = A {!:, equals} B
 </pre></div>
-We can now define arbitrary topological relations using logical OR operator 
+We can now define arbitrary topological relations using the OR operator "|"
 to connect them:
 <div class="code"><pre>
-C = A {equals|during|overlaps,:} B
+C = A {:,equals|during|overlaps} B
 </pre></div>
 Select all parts of A that are equal to B, during B or overlaps B. <br>
+
+In addition we can define the temporal extent of the result STDS by adding the
+temporal operator.
+<div class="code"><pre>
+C = A {:, during,r} B
+</pre></div>
+Select all parts of A that are during B and use the temporal extents from B for 
+C. <br>
+
 <br>
-The selection operator is implicitly contained in the temporal topology 
+The selection operator is implicitly contained in the temporal topology
 selection operator, so that the following statements are exactly the same:
 <div class="code"><pre>
 C = A : B
 C = A {:} B
-C = A {equal,:} B
+C = A {:,equal} B
+C = A {:,equal,l} B
 </pre></div>
 
 Same for the complementary selection:
 <div class="code"><pre>
 C = A !: B
 C = A {!:} B
-C = A {equal,!:} B
+C = A {!:,equal} B
+C = A {!:,equal,l} B
 </pre></div>
 
-<h3>Conditional statements</h3>
+<h3>CONDITIONAL STATEMENTS</h3>
 
 Selection operations can be evaluated within conditional statements.
 <br>
 <div class="code"><pre>
-Note A and B can either be space time datasets or expressions.
+Note A and B can either be space time datasets or expressions. The temporal 
+relationship between the conditions and the conclusions can be defined at the 
+beginning of the if statement. The relationship between then and else conclusion 
+must be always equal.
 
 if statement                         decision option                        temporal relations
   if(if, then, else)
@@ -171,12 +194,8 @@
   if(topologies, conditions, A)        A if conditions are True;              temporal topological relation between if and then is explicit specified by topologies.
   if(topologies, conditions, A, B)     A if conditions are True, B otherwise; temporal topological relation between if, then and else is explicit specified by topologies.
 </pre></div>
-The conditions are comparison expressions that are used to evaluate 
-space time datasets. Specific values of temporal variables are 
-compared by logical operators and evaluated for each map of the STDS.
-<br>
-<br>
-The supported logical operators:
+
+<h4>Logical operators</h4>
 <div class="code"><pre>
 Symbol  description
 
@@ -190,53 +209,91 @@
   ||    or
 </pre></div>
 
-Temporal functions: <br>
+<h4>Temporal functions</h4>
+The following temporal function are evaluated only for the STDS that must be given in parenthesis.
 <div class="code"><pre>
 
-td(A)                   Returns a list of time intervals of STDS A
+td(A)                    Returns a list of time intervals of STDS A
 
-start_time()            Start time as HH::MM:SS
-start_date()            Start date as yyyy-mm-DD
-start_datetime()        Start datetime as yyyy-mm-DD HH:MM:SS
-end_time()              End time as HH:MM:SS
-end_date()              End date as yyyy-mm-DD
-end_datetime()          End datetime as  yyyy-mm-DD HH:MM
+start_time(A)            Start time as HH::MM:SS
+start_date(A)            Start date as yyyy-mm-DD
+start_datetime(A)        Start datetime as yyyy-mm-DD HH:MM:SS
+end_time(A)              End time as HH:MM:SS
+end_date(A)              End date as yyyy-mm-DD
+end_datetime(A)          End datetime as  yyyy-mm-DD HH:MM
 
-start_doy()             Day of year (doy) from the start time [1 - 366]
-start_dow()             Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
-start_year()            The year of the start time [0 - 9999]
-start_month()           The month of the start time [1 - 12]
-start_week()            Week of year of the start time [1 - 54]
-start_day()             Day of month from the start time [1 - 31]
-start_hour()            The hour of the start time [0 - 23]
-start_minute()          The minute of the start time [0 - 59]
-start_second()          The second of the start time [0 - 59]
-end_doy()               Day of year (doy) from the end time [1 - 366]
-end_dow()               Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
-end_year()              The year of the end time [0 - 9999]
-end_month()             The month of the end time [1 - 12]
-end_week()              Week of year of the end time [1 - 54]
-end_day()               Day of month from the start time [1 - 31]
-end_hour()              The hour of the end time [0 - 23]
-end_minute()            The minute of the end time [0 - 59]
-end_second()            The second of the end time [0 - 59]            
+start_doy(A)             Day of year (doy) from the start time [1 - 366]
+start_dow(A)             Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
+start_year(A)            The year of the start time [0 - 9999]
+start_month(A)           The month of the start time [1 - 12]
+start_week(A)            Week of year of the start time [1 - 54]
+start_day(A)             Day of month from the start time [1 - 31]
+start_hour(A)            The hour of the start time [0 - 23]
+start_minute(A)          The minute of the start time [0 - 59]
+start_second(A)          The second of the start time [0 - 59]
+end_doy(A)               Day of year (doy) from the end time [1 - 366]
+end_dow(A)               Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
+end_year(A)              The year of the end time [0 - 9999]
+end_month(A)             The month of the end time [1 - 12]
+end_week(A)              Week of year of the end time [1 - 54]
+end_day(A)               Day of month from the start time [1 - 31]
+end_hour(A)              The hour of the end time [0 - 23]
+end_minute(A)            The minute of the end time [0 - 59]
+end_second(A)            The second of the end time [0 - 59]
 </pre></div>
 
-Additionally the number of maps in intervals can be computed and 
-used in conditional statements. <br>
-The operator to count the number of maps 
-is the hash <b>#</b>. 
+<h4>Comparison operator</h4>
+The conditions are comparison expressions that are used to evaluate
+space time datasets. Specific values of temporal variables are
+compared by logical operators and evaluated for each map of the STDS and 
+the related maps.
+For complex relations the comparison operator can be used to combine conditions: 
+<br>
+The structure is similar to the select operator with the extention of an aggregation operator: 
+{"comparison operator", "topological relations", aggregation operator, "temporal operator"}
+<br>
+This aggregation operator (| or &) define the behaviour if a map is related the more 
+than one map, e.g for the topological relations 'contains'.
+Should all (&) conditions for the related maps be true or is it sufficient to 
+have any (|) condition that is true. The resulting boolean value is then compared 
+to the first condition by the comparison operator (|| or &&). 
+As default the aggregation operator is related to the comparison operator: <br>
+Comparison operator -> aggregation operator:
 <div class="code"><pre>
-A{contains,#}B
+|| -> | and && -> & 
 </pre></div>
-This expression computes the number of maps from space 
-time dataset B which are during the time intervals of maps from 
+Examples:
+<div class="code"><pre>
+Condition 1 {||, equal, r} Condition 2
+Condition 1 {&&, equal|during, l} Condition 2
+Condition 1 {&&, equal|contains, |, l} Condition 2
+Condition 1 {&&, equal|during, l} Condition 2 && Condition 3
+Condition 1 {&&, equal|during, l} Condition 2 {&&,contains, |, r} Condition 3
+</pre></div>
+
+<h4>Hash operator</h4>
+Additionally the number of maps in intervals can be computed and used in 
+conditional statements with the hash (#) operator. <br>
+<div class="code"><pre>
+A{#, contains}B
+</pre></div>
+This expression computes the number of maps from space
+time dataset B which are during the time intervals of maps from
 space time dataset A.<br>
-A list of integers (scalars) corresponding to the maps of A 
+A list of integers (scalars) corresponding to the maps of A
 that contain maps from B will be returned. <br>
 <br>
-
-Furthermore the temporal algebra allows temporal buffering, shifting 
+<div class="code"><pre>
+C = if({equal}, A {#, contains} B > 2, A {:, contains} B)
+</pre></div>
+This expression selects all maps from A that temporally contains at least 2 
+maps from B and stores them in space time dataset C. The leading equal statement 
+in the if condition specifies the temporal relation between the if and then part 
+of the if expression. This is very important, so we do not need to specify a 
+global time reference (a space time dataset) for temporal processing.
+<br>
+<br>
+Furthermore the temporal algebra allows temporal buffering, shifting
 and snapping with the functions buff_t(), tshift() and tsnap()
 respectively.
 <div class="code"><pre>
@@ -244,23 +301,20 @@
 tshift(A, size)         Shift STDS A with granule ("1 month" or 5)
 tsnap(A)                Snap time instances and intervals of STDS A
 </pre></div>
-
-<h3>Temporal Operators</h3>
-<p>
-The temporal algebra defines temporal operators that can be combined 
-later with spatial operators to perform spatio-temporal operations. 
-The temporal operators process the time instances and intervals of temporal related maps. 
-</p>
+<br>
+<h4>Single map with temporal extent</h4>
+The temporal algebra can also handle single maps with time stamps in the tmap function.
 <div class="code"><pre>
-AND             &       Intersection 
-OR              |       Union
-DISJOINT OR     +       Disjoint union
-LEFT REFERENCE  =       Use the time stamp of the left space time dataset
-</pre></div><p>
-For example we can compute the intersection, union or disjoint union from time stamps of maps 
-that temporally overlap, or we can just keep the time stamp of the left STDS.
-</p>
+tmap()
+</pre></div>
+For example:
+<div class="code"><pre>
+ C = A {:,during} tmap(event)
+</pre></div>
+This statement select all maps from space time data set A that are during the temporal extent of single map 'event'
 
+<br>
+
 <h3>Spatial vector operators</h3>
 
 The module supports the following boolean vector operations: <br>
@@ -286,57 +340,57 @@
 <p>
 <h3>Combinations of temporal, vector and select operators</h3>
 
-We combine the temporal topology relations, the temporal operators and 
-the spatial/select operators to create spatio-temporal operators:
+We combine the temporal topology relations, the temporal operators and the spatial/select operators to create spatio-temporal vector operators:
 
-<div class="code"> <pre>
-{"list of temporal relations", "temporal operator" "spatial or select operator"} 
-</pre></div>
+<pre class="code">
+{"spatial or select operator" , "list of temporal relations", "temporal operator" } 
+</pre><p>
 
-The spatial and the select operators can be used stand-alone. In this 
-case the temporal topology relation "equal" and the temporal operator 
-"left reference =" is assumed and used as default. This allows the 
-convenient use of the spatial and select operators in case of space 
-time vector datasets with equal time stamps.
+For multiple topological relations or several related maps the spatio-temporal 
+operators feature implicit aggregation.
 
-<div class="code"> <pre>
- ---------------------------------------
-|   |  & |  | |  ^ |  ~ |  + |  : |  !: |
-|---|----|----|----|----|----|----|-----|
-| & | && | &| | &^ | &~ | &+ | &: | &!: |
-| | | |& | || | |^ | |~ | |+ | |: | |!: |
-| + | +& | +| | +^ | +~ | ++ | +: | +!: |
-| = | =& | =| | =^ | =~ | =+ | =: | =!: |
- ---------------------------------------
-</pre></div>
+The algebra evaluates the stated STDS by their temporal topologies and apply 
+the given spatio temporal operators in a aggregated form.
 
+If we have two STDS A and B, B has three maps: b1, b2, b3 that are all during 
+the temporal extent of the single map a1 of A, then the following overlay 
+calculations would implicitly aggregate all maps of B into one result map for 
+a1 of A:
+<pre class="code">
+C = A {&, contains} B --> c1 = a1 & b1 & b2 & b3
+</pre><p>
+Keep attention that the aggregation behaviour is not symmetric:
+<pre class="code">
+C = B {&, during} A --> c1 = b1 & a1
+                        c2 = b2 & a1
+                        c3 = b3 & a1
+</pre><p>
 <h3>Examples: </h3>
 
-Spatio-temporal intersect all maps from space time dataset A with all 
-maps from space time dataset B which have equal time stamps and are 
-temporary before Jan. 1. 2005 and store them in space time dataset D.
-
+Spatio-temporal intersect all maps from space time dataset A with all maps from space time dataset 
+B which have equal time stamps and are temporary before Jan. 1. 2005 and 
+store them in space time dataset D.
 <div class="code"><pre>
-D = if(start_date() < "2005-01-01", A & B)
+D = if(start_date(A) < "2005-01-01", A & B)
 </pre></div>
 
 Buffer all vector points from space time vector dataset A and B with a distance of one and
 intersect the results with overlapping, containing, during and equal temporal relations
 to store the result in space time vector dataset D with intersected time stamps.
 <div class="code"><pre>
-D = buff_p(A, 1) {overlaps|overlapped|equal|during|contains,&&} buff_p(B, 1)
+D = buff_p(A, 1) {&,overlaps|overlapped|equal|during|contains,i} buff_p(B, 1)
 </pre></div>
 
 Select all maps from space time dataset B which are during the temporal 
 buffered space time dataset A with a map interval of three days, else
 select maps from C and store them in space time dataset D.
 <div class="code"><pre>
-D = if(contain, td(buff_t(A, "1 days")) == 3, B, C)
+D = if(contains, td(buff_t(A, "1 days")) == 3, B, C)
 </pre></div>
 
 <h2>REFERENCES</h2>
 
-<a href="http://www.dabeaz.com/ply/">PLY(Python-Lex-Yacc)</a>
+<tt><a href="http://www.dabeaz.com/ply/">PLY(Python-Lex-Yacc)</a></tt>
 
 <h2>SEE ALSO</h2>
 



More information about the grass-commit mailing list