Changes between Version 1 and Version 2 of Grass7/TemporalGISAlgebra


Ignore:
Timestamp:
Jun 13, 2013, 1:35:02 AM (11 years ago)
Author:
mastho
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Grass7/TemporalGISAlgebra

    v1 v2  
    11= Temporal GIS Algebra for Raster and Vector Data =
     2
     3Overview of the temporal algebra elements and concepts.
     4
     5== Temporal topology relations ==
     6
     7
     8{{{
     9equals            A ------
     10                  B ------
     11
     12during            A  ----
     13                  B ------
     14
     15contains          A ------
     16                  B  ----
     17
     18starts            A ----
     19                  B ------
     20
     21started           A ------
     22                  B ----
     23
     24finishs           A   ----
     25                  B ------
     26
     27finished          A ------
     28                  B   ----
     29
     30precedes          A ----
     31                  B     ----
     32
     33follows           A     ----
     34                  B ----
     35
     36overlapped        A   ------
     37                  B ------
     38
     39overlaps          A ------
     40                  B   ------
     41
     42over              booth overlaps and overlapped
     43}}}
     44The relations must be read A is related to B, like
     45- A equals B
     46- A is during B
     47- A contains B
     48
     49Topological relations must be specified in {} parentheses
     50
     51{{{
     52A {equals} B
     53}}}
     54
     55Topological relations are always combined with other
     56temporal operators in the {} parentheses
     57
     58== Temporal operators ==
     59
     60Temporal operators that work on time intervals
     61and instances of maps in space time datasets:
     62
     63'''Intersection &  '''       
     64
     65 Examples with time intervals a and b:
     66{{{
     67 c <- a & b
     68  a ------                             
     69  b  ----                               
     70  c  ----
     71
     72  a ----
     73  b   ----
     74  c   --
     75
     76  a ---
     77  b    ---
     78  c
     79}}}
     80'''Union |'''
     81
     82 Examples with time intervals a and b:
     83{{{
     84c <- a | b
     85  a ------                             
     86  b  ----                               
     87  c ------
     88
     89  a ----
     90  b   ----
     91  c ------
     92
     93  a ---
     94  b    ---
     95  c ------
     96
     97  a ---
     98  b     ---
     99  c
     100}}}
     101'''Disjoint Union +'''
     102
     103 Examples with time intervals a and b:
     104{{{
     105 c <- a + b
     106  a ------                             
     107  b  ----                               
     108  c ------
     109
     110  a ----
     111  b   ----
     112  c ------
     113
     114  a ---
     115  b    ---
     116  c ------
     117
     118  a ---
     119  b     ---
     120  c -------
     121
     122}}}
     123'''Left Reference ='''
     124
     125 Examples with time intervals a and b:
     126{{{
     127 c <- a = b
     128  a ------                             
     129  b  ----                               
     130  c ------
     131
     132  a ----
     133  b   ----
     134  c ---- 
     135
     136  a ---
     137  b    ---
     138  c ---   
     139
     140  a ---
     141  b     ---
     142  c ---
     143}}}
     144
     145 The = operator ignores indexing operators for space
     146 time datasets: A[i]
     147
     148
     149Temporal selection operators to select parts of
     150space time datasets:
     151
     152'''  Selection           :'''[[BR]]
     153'''  Inverse selection  !:'''
     154
     155Temporal operators have no precedence.
     156
     157 Examples:
     158
     159 * Select all maps from space time dataset A that
     160   have equal time intervals with space time dataset B
     161   and store them in space time datasets C.
     162 
     163{{{
     164   C = A : B
     165   C = A {:} B
     166   C = A {=:} B
     167   C = A {equals,:} B
     168   C = A {equals,=:} B
     169}}}
     170
     171 * Select all maps from space time dataset A that
     172   have unequal time intervals with space time dataset B
     173   and store them in space time datasets C.
     174 
     175{{{
     176   C = A !: B
     177   C = A {!:} B
     178   C = A {=!:} B
     179   C = A {equals,!:} B
     180   C = A {equals,=!:} B
     181}}}
     182
     183 * Select all maps from space time dataset A that
     184   are during time intervals of space time dataset B
     185   and store them in space time datasets C. Use
     186   the time interval/instances of A in C.
     187 
     188{{{
     189   C = A {during,:} B
     190   C = A {during,=:} B
     191}}}
     192
     193 * Select all maps from space time dataset A that
     194   are during time intervals of space time dataset B
     195   and store them in space time datasets C. The maps
     196   in C will have different time intervals as A or B using the union operator.
     197   Hence they are unions between time intervals of A and B.
     198 
     199{{{
     200   C = A {during,|:} B
     201}}}
     202
     203 * Select all maps from space time dataset A
     204   that are during B and during C and during D.
     205   Store the resulting list of maps using the timer intervals/instances
     206   of A in E.
     207
     208{{{
     209   E = A {during,=:} B {during,=:} C {during,=:} D
     210}}}
     211
     212Operator number of maps in interval  [[BR]]
     213'''Number of maps #'''
     214
     215Compute the number of maps from space time dataset B that are
     216during the time intervals of maps from space time dataset A.
     217{{{
     218A{contains,#}B
     219}}}
     220This will return a list of integers (scalars) corresponding to the maps of
     221A that contain maps from B.
     222
     223
     224== Combination of temporal operators ==
     225
     226{{{
     227 --------------
     228|   |  : |  !: |
     229|---|- --|-----|
     230| & | &: | &!: |
     231| | | |: | |!: |
     232| + | +: | +!: |
     233| = | =: | =!: |
     234 --------------
     235}}}
     236
     237
     238== Logical operators ==
     239
     240{{{
     241==    equal 
     242!=    not equal 
     243>     greater than
     244>=    greater than or equal
     245<     less than
     246<=    less than or equal
     247&&    and
     248||    or
     249
     250}}}
     251
     252== Temporal functions ==
     253
     254Note a and b can either be space time datasets or expressions.
     255
     256{{{
     257if                      decision option
     258  if(x, a)              a if x not 0
     259  if(x, a, b)           a if x not 0, b otherwise
     260
     261buff_t(a, size)         Buffer stds a with granule ("1 month" or 5)
     262tshift(a, size)         Shift stds a with granule ("1 month" or 5)
     263tsnap(a)                Snap time instances and intervals of stds a
     264
     265start_time()            Start time as HH::MM:SS
     266start_date()            Start date as yyyy-mm-DD
     267start_datetime()        Start datetime as yyyy-mm-DD HH:MM:SS
     268end_time()              End time as HH:MM:SS
     269end_date()              End date as yyyy-mm-DD
     270end_datetime()          End datetime as  yyyy-mm-DD HH:MM
     271
     272start_doy()             Day of year (doy) from the start time [1 - 366]
     273start_dow()             Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
     274start_year()            The year of the start time [0 - 9999]
     275start_month()           The month of the start time [1 - 12]
     276start_week()            Week of year of the start time [1 - 54]
     277start_day()             Day of month from the start time [1 - 31]
     278start_hour()            The hour of the start time [0 - 23]
     279start_minute()          The minute of the start time [0 - 59]
     280start_second()          The second of the start time [0 - 59]
     281end_doy()               Day of year (doy) from the end time [1 - 366]
     282end_dow()               Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
     283end_year()              The year of the end time [0 - 9999]
     284end_month()             The month of the end time [1 - 12]
     285end_week()              Week of year of the end time [1 - 54]
     286end_day()               Day of month from the start time [1 - 31]
     287end_hour()              The hour of the end time [0 - 23]
     288end_minute()            The minute of the end time [0 - 59]
     289end_second()            The second of the end time [0 - 59]           
     290}}}
     291
     292Examples:
     293  Select all maps from space time dataset A that have equal time stamps
     294  with space time dataset B and C and are ealier that Jan. 1. 2005 and
     295  store them in space time dataset D.
     296
     297{{{
     298  D = if(start_date() < "2005-01-01"), A{equals,=:}B{equals,=:}C)
     299}}}
     300
     301= Temporal Vector Algebra =
     302
     303Boolean vector operations:
     304
     305{{{
     306AND             &       Intersection            (v.overlay operator=and)
     307OR              |       Union                   (v.overlay operator=or)
     308DISJOINT OR     +       Disjoint union          (v.patch)
     309XOR             ^       Symmetric difference    (v.overlay operator=xor)
     310NOT             ~       Complement              (v.overlay operator=not)
     311}}}
     312
     313Vector functions:
     314
     315{{{
     316buff_p(a, size)         Buffer the points of all maps from space time vector dataset a with size
     317buff_l(a, size)         Buffer the lines of all maps from space time vector dataset a with size
     318buff_a(a, size)         Buffer the areas of all maps from space time vector dataset a with size
     319}}}
     320
     321Examples:
     322
     323 * Create an intersection between all maps of space time dataset
     324   A and B that have equal time stamps.
     325
     326{{{
     327   C = A & B
     328   C = A {&} B
     329   C = A {=&} B
     330   C = A {equals,=&} B
     331}}}
     332
     333 
     334 * Question: Meeting of two animals that occur when the distance between two sea elephants is less than 10 meters?
     335   Space time vector dataset A and B contains the measured positions and time instances/intervals of two sea elephants.
     336   The granularity of the space time vector datasets is 1h. We create a new space time vector dataset C that contains the
     337   spatio-temporal intersections of the positions of the sea elephants.
     338
     339
     340{{{
     341   C = buff_p(buff_t(A, "2 hours"), 5) {over||equals,&&} buff_p(buff_t(B, "2 hours"), 5)
     342}}}
     343
     344== Combinations of temporal and vector operators ==
     345
     346{{{
     347 ---------------------------------------
     348|   |  : |  !: |  & |  | |  ^ |  ~ |  + |
     349|---|----|-----|----|----|----|----|----|
     350| & | &: | &!: | && | &| | &^ | &~ | &+ |
     351| | | |: | |!: | |& | || | |^ | |~ | |+ |
     352| + | +: | +!: | +& | +| | +^ | +~ | ++ |
     353| = | =: | =!: | =& | =| | =^ | =~ | =+ |
     354 ---------------------------------------
     355}}}
     356
     357= Temporal Raster Algebra =
     358
     359Arithmetic Operators:
     360
     361{{{
     362Symbol  description     precedence
     363
     364  %     modulus         1
     365  /     division        1
     366  *     multiplication  1
     367  +     addition        2
     368  -     subtraction     2
     369}}}
     370
     371Logical operators:
     372
     373{{{
     374Symbol  description             precedence
     375
     376  ==    equal                   3
     377  !=    not equal               3
     378  >     greater than            3
     379  >=    greater than or equal   3
     380  <     less than               3
     381  <=    less than or equal      3
     382  &&    and                     4
     383  ||    or                      4
     384}}}
     385
     386Raster functions:
     387
     388{{{
     389abs(x)                  return absolute value of x
     390foat(x)                 convert x to foating point
     391if decision options:
     392  if(x)                 1 if x not zero, 0 otherwise
     393  if(x,a)               a if x not zero, 0 otherwise
     394  if(x,a,b)             a if x not zero, b otherwise
     395int(x)                  convert x to integer [ truncates ]
     396log(x)                  natural log of x
     397log(x,b)                log of x base b
     398max(x,y[,z...])         largest value of those listed
     399median(x,y[,z...])      median value of those listed
     400min(x,y[,z...])         smallest value of those listed
     401round(x)                round x to nearest integer
     402sqrt(x)                 square root of x
     403tan(x)                  tangent of x (x is in degrees)
     404not(x)                  1 if x is zero, 0 otherwise
     405pow(x,y)                x to the power y
     406rand(a,b)               random value x : a <= x < b
     407round(x)                round x to nearest integer
     408sin(x)                  sine of x (x is in degrees)
     409sqrt(x)                 square root of x
     410tan(x)                  tangent of x (x is in degrees)
     411xor(x,y)                exclusive-or (XOR) of x and y
     412isnull(x)              check if x = NULL
     413}}}
     414
     415Internal variables:
     416
     417{{{
     418row()                   current row of moving window
     419col()                   current col of moving window
     420x()                     current x-coordinate of moving window
     421y()                     current y-coordinate of moving window
     422ewres()                 current east-west resolution
     423nsres()                 current north-south resolution
     424null()                  NULL value
     425}}}
     426
     427Combination of temporal and arithmetical raster operators:
     428
     429{{{
     430 ---------------------------------------
     431|   |  : |  !: |  % |  / |  * |  - |  + |
     432|---|----|-----|----|----|----|----|----|
     433| & | &: | &!: | &% | &/ | &* | &- | &+ |
     434| | | |: | |!: | |% | |/ | |* | |- | |+ |
     435| + | +: | +!: | +% | +/ | +* | +- | ++ |
     436| = | =: | =!: | =% | =/ | =* | =- | =+ |
     437 ---------------------------------------
     438}}}
     439
     440Combination of temporal and logical raster operators:
     441
     442{{{
     443 ------------------------------------------------
     444|   |  : |  !: |  == |  != |  <= |  >= |  < |  > |
     445|---|----|-----|-----|-----|-----|-----|----|----|
     446| & | &: | &!: | &== | &!= | &<= | &>= | &< | &> |
     447| | | |: | |!: | |== | |!= | |<= | |>= | |< | |> |
     448| + | +: | +!: | +== | +!= | +<= | +>= | +< | +> |
     449| = | =: | =!: | === | =!= | =<= | =>= | =< | => |
     450 ------------------------------------------- ----
     451}}}
     452
     453Note the combination of temporal and logical operators is only
     454possible in reference time mode.
     455
     456
     457