Changes between Version 24 and Version 25 of Grass7/TemporalGISAlgebra


Ignore:
Timestamp:
Oct 20, 2014, 12:22:50 PM (10 years ago)
Author:
mastho
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Grass7/TemporalGISAlgebra

    v24 v25  
    4242means: select all parts of space time time dataset A that are not equal to B and store it in space time dataset (STDS) C.
    4343
    44 We have defined the operator {"topological relations", "temporal selection operator"} to perform selection with
     44We have defined the operator {"selection operator", "topological relations", "temporal operator"} to perform selection with
    4545different temporal topology relations. Examples:
    4646{{{
    47 C = A {equals,:} B is exactly the same as C = A : B
    48 C = A {equals,!:} B is exactly the same as C = A !: B
     47C = A {:,equals} B is exactly the same as C = A : B
     48C = A {!:,equals} B is exactly the same as C = A !: B
    4949}}}
    5050We can now define arbitrary topological relations using logical OR operator to connect them:
    5151{{{
    52 C = A {equals||during||overlaps,:} B
     52C = A {:,equals|during|overlaps} B
    5353}}}
    5454Select all parts of A that are equal B, during B or overlaps B.
     
    8686}}}
    8787
    88 ==== The hash operator ====
    89 
    90 It is of important interest how many maps are located in the time interval of a single map when processing two space time datasets.
    91 For this reason the hash operator '''#''' was introduced. In addition to the hash operator the temporal relation can be specified
    92 that should be analysed.
    93 
    94 Example:
    95 {{{
    96 C = if(equal, A{contains,#}B > 2, A{contains,:}B)
    97 }}}
    98 This expression selects all maps from A that temporally contains at least 2 maps from B and stores them in space time dataset C.
    99 The leading '''equal''' statement in the '''if''' condition specifies the temporal relation between the if and then part of the if expression.
    100 This is very important, so we do not need to specify a global time reference (a space time dataset) for temporal processing.
    101 
    102 ==== Temporal Operators ====
    103 
    104 The temporal algebra defines temporal operators that can be combined later with spatial operators to perform spatio-temporal operations.
    105 The temporal operators process the time instances and intervals of temporal related maps.
    106 {{{
    107 AND             &       Intersection
    108 OR              |       Union
    109 DISJOINT OR     +       Disjoint union
    110 LEFT REFERENCE  =       Use the time stamp of the left space time dataset
    111 }}}
    112 For example we can compute the intersection, union or disjoint union from time stamps of maps
    113 that temporally overlap, or we can just keep the time stamp of the left STDS.
    114 
    115 All supported operators and functions are documented below.
    116 
    117 == Temporal Vector Algebra ==
    118 
    119 The temporal vector algebra includes all functions from the temporal algebra
    120 and adds spatial Boolean and buffer operations that can be performed on temporal related vector maps that are registered in
    121 space time vector datasets.
    122 
    123 === Spatio-Temporal Operators ===
    124 
    125 These are the spatial operators that are supported:
    126 {{{
    127 AND             &       Intersection            (v.overlay operator=and)
    128 OR              |       Union                   (v.overlay operator=or)
    129 DISJOINT OR     +       Disjoint union          (v.patch)
    130 XOR             ^       Symmetric difference    (v.overlay operator=xor)
    131 NOT             ~       Complement              (v.overlay operator=not)
    132 }}}
    133 We combine the temporal topology relations, the temporal operators and the spatial operators to create spatio-temporal operators:
    134 {{{
    135 {"list of temporal relations", "temporal operator" "spatial operator"}
    136 }}}
    137 The spatial operator 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 operators in case of space time vector datasets with equal time stamps.
    138 
    139 Example:
    140 Compute the spatial intersection between maps of STVDS A and B that are temporally equal,
    141 resulting spatial intersection maps are stored in C with time stamps from A:
    142 {{{
    143 C = A & B
    144 }}}
    145 Compute the spatio-temporal intersection between maps of STVDS A and B that temporally overlap,
    146 resulting spatial intersection maps are stored in C with new time stamps resulting from temporal intersection:
    147 {{{
    148 C = A {overlap,&&} B
    149 }}}
    150 Perform a spatial union and a temporal disjoint union between all maps of STVDS A
    151 and B that are temporally equal or overlap and are later than 1990,
    152 resulting spatial union maps are stored in C with new time stamps resulting from temporal disjoint union:
    153 {{{
    154 C = if(start_year() > 1990, A {equal,overlap,+|} B)
    155 }}}
    156 
    157 The temporal vector algebra provides point, line and area buffer functions in addition to the operators.
    158 
    159 All supported operators and functions are documented below.
    160 
    161 == Temporal Raster Algebra ==
    162 
    163 The temporal raster algebra uses all operators and functions of the temporal
    164 algebra and adds a subset of the arithmetic operators and functions from r.mapcalc.
    165 New spatio-temporal operators are defined that include temporal topology relations,
    166 temporal operators and arithmetic operators.
    167 
    168 Examples:
    169 Create the sum of all maps from STRDS A and B that have equal time stamps and store the new maps in STRDS C:
    170 {{{
    171 C = A + B
    172 }}}
    173 Same expression with explicit definition of the temporal topology relation and temporal operators:
    174 {{{
    175 C = A {equal,=+} B
    176 }}}
    177 Select all cells from STRDS B with equal temporal relations to STRDS A, if the cells
    178 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):
    179 {{{
    180 C = if(A > 100 && A < 1600 && td(A) > 30, B)
    181 }}}
    182 Same expression with explicit definition of the temporal topology relation and temporal operators:
    183 {{{
    184 C = if(equal, A > 100 && A < 1600 {equal,&&} td(A) > 30, B)
    185 }}}
    186 Compute the recharge in meter per second for all cells of precipitation STRDS "Prec"
    187 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":
    188 {{{
    189 C = if(Temp > 10.0, Prec / 3600.0 /24.0 / td(Prec))
    190 }}}
    191 Same expression with explicit definition of the temporal topology relation and temporal operators:
    192 {{{
    193 C = if(equal, Temp > 10.0, Prec / 3600.0 / 24.0 {equal,=/} td(Prec))
    194 }}} 
    195 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:
    196 {{{
    197 C = if(B {contain,#} A > 1, (B {contain, =+} A - B) / (B {contain,#} A), A)
    198 }}}
    199 Same expression with explicit definition of the temporal topology relation and temporal operators:
    200 {{{
    201 C = if(equal, B {contain,#} A > 1, (B {contain, =+} A {equal, =-} B) {equal,=/} (B {contain,#} A), A)
    202 }}}
    203 
    204 All supported operators and functions are documented below.
    205 
    206 
    207 = Overview of all supported spatio-temporal operators and functions =
    208 
    209 == Temporal topology relations ==
    210 
    211 
    212 {{{
    213 equals            A ------
    214                   B ------
    215 
    216 during            A  ----
    217                   B ------
    218 
    219 contains          A ------
    220                   B  ----
    221 
    222 starts            A ----
    223                   B ------
    224 
    225 started           A ------
    226                   B ----
    227 
    228 finishs           A   ----
    229                   B ------
    230 
    231 finished          A ------
    232                   B   ----
    233 
    234 precedes          A ----
    235                   B     ----
    236 
    237 follows           A     ----
    238                   B ----
    239 
    240 overlapped        A   ------
    241                   B ------
    242 
    243 overlaps          A ------
    244                   B   ------
    245 
    246 over              booth overlaps and overlapped
    247 }}}
    248 The relations must be read A is related to B, like
    249 - A equals B
    250 - A is during B
    251 - A contains B
    252 
    253 Topological relations must be specified in {} parentheses
    254 
    255 {{{
    256 A {equals} B
    257 }}}
    258 
    259 Topological relations are always combined with other
    260 temporal operators in the {} parentheses
    261 
    262 == Temporal operators ==
    263 
    264 Temporal operators that work on time intervals
    265 and instances of maps in space time datasets:
    266 
    267 '''Intersection &  '''       
    268 
    269  Examples with time intervals a and b:
    270 {{{
    271  c <- a & b
    272   a ------                             
    273   b  ----                               
    274   c  ----
    275 
    276   a ----
    277   b   ----
    278   c   --
    279 
    280   a ---
    281   b    ---
    282   c
    283 }}}
    284 '''Union |'''
    285 
    286  Examples with time intervals a and b:
    287 {{{
    288 c <- a | b
    289   a ------                             
    290   b  ----                               
    291   c ------
    292 
    293   a ----
    294   b   ----
    295   c ------
    296 
    297   a ---
    298   b    ---
    299   c ------
    300 
    301   a ---
    302   b     ---
    303   c
    304 }}}
    305 '''Disjoint Union +'''
    306 
    307  Examples with time intervals a and b:
    308 {{{
    309  c <- a + b
    310   a ------                             
    311   b  ----                               
    312   c ------
    313 
    314   a ----
    315   b   ----
    316   c ------
    317 
    318   a ---
    319   b    ---
    320   c ------
    321 
    322   a ---
    323   b     ---
    324   c -------
    325 
    326 }}}
    327 '''Left Reference ='''
    328 
    329  Examples with time intervals a and b:
    330 {{{
    331  c <- a = b
    332   a ------                             
    333   b  ----                               
    334   c ------
    335 
    336   a ----
    337   b   ----
    338   c ---- 
    339 
    340   a ---
    341   b    ---
    342   c ---   
    343 
    344   a ---
    345   b     ---
    346   c ---
    347 }}}
    348 
    349  The = operator ignores indexing operators for space
    350  time datasets: A[i]
    351 
    352 
    353 Temporal selection operators to select parts of
    354 space time datasets:
    355 
    356 '''  Selection           :'''[[BR]]
    357 '''  Inverse selection  !:'''
    358 
    359 Temporal operators have no precedence.
    360 
    361  Examples:
    362 
    363  * Select all maps from space time dataset A that
    364    have equal time intervals with space time dataset B
    365    and store them in space time datasets C.
    366  
    367 {{{
    368    C = A : B
    369    C = A {:} B
    370    C = A {equals,:} B
    371 }}}
    372 
    373  * Select all maps from space time dataset A that
    374    have unequal time intervals with space time dataset B
    375    and store them in space time datasets C.
    376  
    377 {{{
    378    C = A !: B
    379    C = A {!:} B
    380    C = A {equals,!:} B
    381 }}}
    382 
    383  * Select all maps from space time dataset A that
    384    are during time intervals of space time dataset B
    385    and store them in space time datasets C.
    386  
    387 {{{
    388    C = A {during,:} B
    389 }}}
    390 
    391  * Select all maps from space time dataset A
    392    that are during B and during C and during D.
    393 
    394 {{{
    395    E = A {during,:} B {during,:} C {during,:} D
    396 }}}
    397 
    398 Operator number of maps in interval  [[BR]]
    399 '''Number of maps #'''
    400 
    401 Compute the number of maps from space time dataset B that are
    402 during the time intervals of maps from space time dataset A.
    403 {{{
    404 A{contains,#}B
    405 }}}
    406 This will return a list of integers (scalars) corresponding to the maps of
    407 A that contain maps from B.
    408 
    409 
    410 == Logical operators ==
    411 
    412 
    413 Logical operators:
    414 
    415 {{{
    416 Symbol  description             precedence
    417 
    418   ==    equal                   3
    419   !=    not equal               3
    420   >     greater than            3
    421   >=    greater than or equal   3
    422   <     less than               3
    423   <=    less than or equal      3
    424   &&    and                     4
    425   ||    or                      4
    426 }}}
    427 
    428 Combination of temporal and logical operators:
    429 
    430 {{{
    431  -------------------------------------------------
    432 |   |  && |  || |  == |  != |  <= |  >= |  < |  > |
    433 |---|-----|-----|-----|-----|-----|-----|----|----|
    434 | & | &&& | &|| | &== | &!= | &<= | &>= | &< | &> |
    435 | | | |&& | ||| | |== | |!= | |<= | |>= | |< | |> |
    436 | + | +&& | +|| | +== | +!= | +<= | +>= | +< | +> |
    437 | = | =&& | =|| | === | =!= | =<= | =>= | =< | => |
    438  -------------------------------------------- ----
    439 }}}
    440 
    441 == Temporal functions ==
    442 
    443 Note a and b can either be space time datasets or expressions.
    444 
    445 {{{
    446 if                      decision option
     88==== Conditional statements ====
     89
     90Spatiotemporal operations can be evaluated within conditional statements.
     91
     92Note A and B can either be space time datasets or expressions.
     93The temporal relationship between the conditions and the conclusions can be defined at the beginning of the if statement.
     94The relationship between then and else conclusion must be always equal.
     95{{{
     96if conditions                         conclusion option                        temporal relations
    44797  if(if, then, else)
    448   if(x, a)              a if x not 0; temporal topological relation between if and then is equal
    449   if(x, a, b)           a if x not 0, b otherwise; temporal topological relation between if, then and else is equal
    450   if(topo, x, a)        a if x not 0; temporal topological relation between if and then is explicit specified by topo
    451   if(topo, x, a, b)     a if x not 0, b otherwise; temporal topological relation between if, then and else is explicit specified by topo
    452 
    453 buff_t(a, size)         Buffer stds a with granule ("1 month" or 5)
    454 tshift(a, size)         Shift stds a with granule ("1 month" or 5)
    455 tsnap(a)                Snap time instances and intervals of stds a
    456 
    457 td(a)                   Returns a list of time intervals of stds a
     98  if(conditions, A)                    A if conditions are True;              Topological relation between conditions(if) and conclusion(then) is equal.
     99  if(conditions, A, B)                 A if conditions are True, B otherwise; Topological relation between conditions(if) and conclusions(then + else) is equal.
     100  if(topologies, conditions, A)        A if conditions are True;              Topological relation between conditions(if) and conclusions(then) is explicit specified by topologies.
     101  if(topologies, conditions, A, B)     A if conditions are True, B otherwise; Topological relation between conditions(if) and conclusions(then + else) is explicit specified by topologies.
     102}}}
     103The conditions are comparison expressions that are used to evaluate
     104space time datasets. Specific values of temporal variables are
     105compared by logical operators and evaluated for each map of the STDS.
     106
     107The supported logical operators:
     108{{{
     109Symbol  description
     110
     111  ==    equal
     112  !=    not equal
     113  >     greater than
     114  >=    greater than or equal
     115  <     less than
     116  <=    less than or equal
     117  &&    and
     118  ||    or
     119}}}
     120
     121Temporal functions:
     122{{{
     123td(A)                   Returns a list of time intervals of STDS A
    458124
    459125start_time()            Start time as HH::MM:SS
     
    484150}}}
    485151
    486 Examples:
    487   Select all maps from space time dataset A that have equal time stamps
    488   with space time dataset B and C and are ealier that Jan. 1. 2005 and
    489   store them in space time dataset D.
    490 
    491 {{{
    492 D = if(start_date() < "2005-01-01", A : B : C)
    493 }}}
    494 
    495 = Temporal Vector Algebra =
    496 
    497 Boolean vector operations:
    498 
     152Additionally the number of maps in intervals can be computed and
     153used in conditional statements with the hash (#) operator.
     154
     155==== The hash operator ====
     156
     157It is of important interest how many maps are located in the time interval of a single map when processing two space time datasets.
     158For this reason the hash operator '''#''' was introduced. In addition to the hash operator the temporal relation can be specified
     159that should be analysed.
     160
     161Example:
     162{{{
     163C = if({equal}, A{#,contains}B > 2, A{:,contains}B)
     164}}}
     165This expression selects all maps from A that temporally contains at least 2 maps from B and stores them in space time dataset C.
     166The leading '''equal''' statement in the '''if''' condition specifies the temporal relation between the if and then part of the if expression.
     167This is very important, so we do not need to specify a global time reference (a space time dataset) for temporal processing.
     168
     169== Temporal Vector Algebra ==
     170
     171The temporal vector algebra includes all functions from the temporal algebra
     172and adds spatial Boolean and buffer operations that can be performed on temporal related vector maps that are registered in
     173space time vector datasets.
     174
     175=== Spatio-Temporal Operators ===
     176
     177These are the spatial operators that are supported:
    499178{{{
    500179AND             &       Intersection            (v.overlay operator=and)
     
    504183NOT             ~       Complement              (v.overlay operator=not)
    505184}}}
    506 
    507 Vector functions:
    508 
    509 {{{
    510 buff_p(a, size)         Buffer the points of all maps from space time vector dataset a with size
    511 buff_l(a, size)         Buffer the lines of all maps from space time vector dataset a with size
    512 buff_a(a, size)         Buffer the areas of all maps from space time vector dataset a with size
    513 }}}
     185We combine the spatial operators, the temporal topology relations and the temporal operators to create spatio-temporal operators:
     186{{{
     187{"list of temporal relations", "temporal operator" "spatial operator"}
     188}}}
     189The spatial operator 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 operators in case of space time vector datasets with equal time stamps.
     190
     191Example:
     192Compute the spatial intersection between maps of STVDS A and B that are temporally equal,
     193resulting spatial intersection maps are stored in C with time stamps from A:
     194{{{
     195C = A & B
     196}}}
     197Compute the spatio-temporal intersection between maps of STVDS A and B that temporally overlap,
     198resulting spatial intersection maps are stored in C with new time stamps resulting from temporal intersection:
     199{{{
     200C = A {&,overlap,&} B
     201}}}
     202Perform a spatial union and a temporal disjoint union between all maps of STVDS A
     203and B that are temporally equal or overlap and are later than 1990,
     204resulting spatial union maps are stored in C with new time stamps resulting from temporal disjoint union:
     205{{{
     206C = if(start_year(A) > 1990, A {|,equal|overlap,+} B)
     207}}}
     208
     209The temporal vector algebra provides point, line and area buffer functions in addition to the operators.
     210
     211All supported operators and functions are documented below.
     212
     213== Temporal Raster Algebra ==
     214
     215The temporal raster algebra uses all operators and functions of the temporal
     216algebra and adds a subset of the arithmetic operators and functions from r.mapcalc.
     217New spatio-temporal operators are defined that include temporal topology relations,
     218temporal operators and arithmetic operators.
    514219
    515220Examples:
    516 
    517  * Create an intersection between all maps of space time dataset
    518    A and B that have equal time stamps.
    519 
    520 {{{
    521    C = A & B
    522    C = A {&} B
    523    C = A {=&} B
    524    C = A {equals,=&} B
    525 }}}
    526 
    527  
    528  * Question: Meeting of two animals that occur when the distance between two sea elephants is less than 10 meters?
    529    Space time vector dataset A and B contains the measured positions and time instances/intervals of two sea elephants.
    530    The granularity of the space time vector datasets is 1h. We create a new space time vector dataset C that contains the
    531    spatio-temporal intersections of the positions of the sea elephants.
    532 
    533 
    534 {{{
    535    C = buff_p(buff_t(A, "2 hours"), 5) {over||equals,&&} buff_p(buff_t(B, "2 hours"), 5)
    536 }}}
    537 
    538 == Combinations of temporal and vector operators ==
    539 
    540 {{{
    541  ----------------------------
    542 |   |  & |  | |  ^ |  ~ |  + |
    543 |---|----|----|----|----|----|
    544 | & | && | &| | &^ | &~ | &+ |
    545 | | | |& | || | |^ | |~ | |+ |
    546 | + | +& | +| | +^ | +~ | ++ |
    547 | = | =& | =| | =^ | =~ | =+ |
    548  ----------------------------
    549 }}}
    550 
    551 = Temporal Raster Algebra =
    552 
    553 Arithmetic Operators:
    554 
    555 {{{
    556 Symbol  description     precedence
    557 
    558   %     modulus         1
    559   /     division        1
    560   *     multiplication  1
    561   +     addition        2
    562   -     subtraction     2
    563 }}}
    564 
    565 Raster functions:
    566 
    567 {{{
    568 abs(x)                  return absolute value of x
    569 foat(x)                 convert x to foating point
    570 if decision options:
    571   if(x)                 1 if x not zero, 0 otherwise
    572   if(x,a)               a if x not zero, 0 otherwise
    573   if(x,a,b)             a if x not zero, b otherwise
    574 int(x)                  convert x to integer [ truncates ]
    575 log(x)                  natural log of x
    576 log(x,b)                log of x base b
    577 max(x,y[,z...])         largest value of those listed
    578 median(x,y[,z...])      median value of those listed
    579 min(x,y[,z...])         smallest value of those listed
    580 round(x)                round x to nearest integer
    581 sqrt(x)                 square root of x
    582 tan(x)                  tangent of x (x is in degrees)
    583 not(x)                  1 if x is zero, 0 otherwise
    584 pow(x,y)                x to the power y
    585 rand(a,b)               random value x : a <= x < b
    586 round(x)                round x to nearest integer
    587 sin(x)                  sine of x (x is in degrees)
    588 sqrt(x)                 square root of x
    589 tan(x)                  tangent of x (x is in degrees)
    590 xor(x,y)                exclusive-or (XOR) of x and y
    591 isnull(x)              check if x = NULL
    592 }}}
    593 
    594 Internal variables:
    595 
    596 {{{
    597 row()                   current row of moving window
    598 col()                   current col of moving window
    599 x()                     current x-coordinate of moving window
    600 y()                     current y-coordinate of moving window
    601 ewres()                 current east-west resolution
    602 nsres()                 current north-south resolution
    603 null()                  NULL value
    604 }}}
    605 
    606 Combination of temporal and arithmetical raster operators:
    607 
    608 {{{
    609  ----------------------------
    610 |   |  % |  / |  * |  - |  + |
    611 |---|----|----|----|----|----|
    612 | & | &% | &/ | &* | &- | &+ |
    613 | | | |% | |/ | |* | |- | |+ |
    614 | + | +% | +/ | +* | +- | ++ |
    615 | = | =% | =/ | =* | =- | =+ |
    616  ----------------------------
    617 }}}
     221Create the sum of all maps from STRDS A and B that have equal time stamps and store the new maps in STRDS C:
     222{{{
     223C = A + B
     224}}}
     225Same expression with explicit definition of the temporal topology relation and temporal operators:
     226{{{
     227C = A {+,equal,l} B
     228}}}
     229Select all cells from STRDS B with equal temporal relations to STRDS A, if the cells
     230of 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):
     231{{{
     232C = if(A > 100 && A < 1600 && td(A) > 30, B)
     233}}}
     234Same expression with explicit definition of the temporal topology relation and temporal operators:
     235{{{
     236C = if({equal}, A > 100 && A < 1600 {&&,equal} td(A) > 30, B)
     237}}}
     238Compute the recharge in meter per second for all cells of precipitation STRDS "Prec"
     239if 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":
     240{{{
     241C = if(Temp > 10.0, Prec / 3600.0 /24.0 / td(Prec))
     242}}}
     243Same expression with explicit definition of the temporal topology relation and temporal operators:
     244{{{
     245C = if({equal}, Temp > 10.0, Prec / 3600.0 / 24.0 {/,equal,l} td(Prec))
     246}}} 
     247Compute 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:
     248{{{
     249C = if(B {#,contain} A > 1, (B {+,contain,l} A - B) / (B {#,contain} A), A)
     250}}}
     251Same expression with explicit definition of the temporal topology relation and temporal operators:
     252{{{
     253C = if({equal}, B {#,contain} A > 1, (B {+,contain,l} A {-,equal,l} B) {equal,=/} (B {#,contain} A), A)
     254}}}
     255
     256All supported operators and functions are documented below.
     257
     258
     259= Overview of all supported spatio-temporal operators and functions =
     260
     261== Temporal topology relations ==
     262
     263
     264{{{
     265equal             A ------
     266                  B ------
     267
     268during            A  ----
     269                  B ------
     270
     271contains          A ------
     272                  B  ----
     273
     274starts            A ----
     275                  B ------
     276
     277started           A ------
     278                  B ----
     279
     280finishs           A   ----
     281                  B ------
     282
     283finished          A ------
     284                  B   ----
     285
     286precedes          A ----
     287                  B     ----
     288
     289follows           A     ----
     290                  B ----
     291
     292overlapped        A   ------
     293                  B ------
     294
     295overlaps          A ------
     296                  B   ------
     297
     298over              booth overlaps and overlapped
     299}}}
     300The relations must be read A is related to B, like
     301- A equals B
     302- A is during B
     303- A contains B
     304
     305Topological relations must be specified in {} parentheses
     306
     307{{{
     308A {equal} B
     309}}}
     310
     311Topological relations are always combined with other
     312temporal operators in the {} parentheses
     313
     314== Temporal operators ==
     315
     316The temporal algebra defines temporal operators that can be combined later with spatial operators to perform spatio-temporal operations.
     317The temporal operators process the time instances and intervals of temporal related maps.
     318{{{
     319LEFT REFERENCE     l       Use the time stamp of the left space time dataset
     320INTERSECTION       i       Intersection
     321DISJOINT UNION     d       Disjoint union
     322UNION              u       Union
     323RIGHT REFERENCE    r       Use the time stamp of the right space time dataset
     324}}}
     325For example we can compute the intersection, union or disjoint union from time stamps of maps
     326that temporally overlap, or we can just keep the time stamp of the left STDS.
     327Temporal operators that work on time intervals
     328and instances of maps in space time datasets:
     329
     330'''Left Reference l'''
     331
     332 Examples with time intervals a, b and left referenced c:
     333{{{
     334  a ------                             
     335  b  ----                               
     336  c ------
     337
     338  a ----
     339  b   ----
     340  c ---- 
     341
     342  a ---
     343  b    ---
     344  c ---   
     345
     346  a ---
     347  b     ---
     348  c ---
     349}}}
     350
     351'''Intersection i  '''       
     352
     353 Examples with time intervals a, b and intersection c:
     354{{{
     355  a ------                             
     356  b  ----                               
     357  c  ----
     358
     359  a ----
     360  b   ----
     361  c   --
     362
     363  a ---
     364  b    ---
     365  c
     366}}}
     367
     368'''Disjoint Union d'''
     369
     370 Examples with time intervals a, b and disjoint union c:
     371{{{
     372  a ------                             
     373  b  ----                               
     374  c ------
     375
     376  a ----
     377  b   ----
     378  c ------
     379
     380  a ---
     381  b    ---
     382  c ------
     383
     384  a ---
     385  b     ---
     386  c -------
     387
     388}}}
     389
     390'''Union u'''
     391
     392 Examples with time intervals a, b and union c:
     393{{{
     394  a ------                             
     395  b  ----                               
     396  c ------
     397
     398  a ----
     399  b   ----
     400  c ------
     401
     402  a ---
     403  b    ---
     404  c ------
     405
     406  a ---
     407  b     ---
     408  c
     409}}}
     410
     411'''Right Reference r'''
     412
     413 Examples with time intervals a, b and right referenced c:
     414{{{
     415  a ------                             
     416  b  ----                               
     417  c ------
     418
     419  a ----
     420  b   ----
     421  c ---- 
     422
     423  a ---
     424  b    ---
     425  c ---   
     426
     427  a ---
     428  b     ---
     429  c ---
     430}}}
     431
     432 The l operator ignores indexing operators for space
     433 time datasets: A[i]
     434
     435
     436Temporal selection operators to select parts of
     437space time datasets:
     438
     439'''  Selection           :'''[[BR]]
     440'''  Inverse selection  !:'''
     441
     442Temporal operators have no precedence.
     443
     444 Examples:
     445
     446 * Select all maps from space time dataset A that
     447   have equal time intervals with space time dataset B
     448   and store them in space time datasets C.
     449 
     450{{{
     451   C = A : B
     452   C = A {:} B
     453   C = A {:,equal} B
     454}}}
     455
     456 * Select all maps from space time dataset A that
     457   have unequal time intervals with space time dataset B
     458   and store them in space time datasets C.
     459 
     460{{{
     461   C = A !: B
     462   C = A {!:} B
     463   C = A {!:,equal} B
     464}}}
     465
     466 * Select all maps from space time dataset A that
     467   are during time intervals of space time dataset B
     468   and store them in space time datasets C.
     469 
     470{{{
     471   C = A {:,during} B
     472}}}
     473
     474 * Select all maps from space time dataset A
     475   that are during B and during C and during D.
     476
     477{{{
     478   E = A {:,during} B {:,during} C {:,during} D
     479}}}
     480
     481Operator number of maps in interval  [[BR]]
     482'''Number of maps #'''
     483
     484Compute the number of maps from space time dataset B that are
     485during the time intervals