t.select(1grass)

โœจ t.select โœจ

okay bestie, so this is t.select from the GRASS User's Manual โ€” it's the little icon that picks maps out of space time datasets based on how they're related to other space time datasets, using temporal algebra. iykyk ๐Ÿ’…

๐ŸŒธ NAME ๐ŸŒธ

t.select โ€” Select maps from space time datasets by topological relationships to other space time datasets using temporal algebra.

๐ŸŽ€ KEYWORDS ๐ŸŽ€

temporal, metadata, time


๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

t.select
t.select --help
t.select [-sd]  [type=name]  expression=expression  [--help]
[--verbose]  [--quiet]  [--ui]

๐Ÿ‘‘ Flags:

  • -s โ€” Check the spatial topology of temporally related maps and select only spatially related maps. like, she's not just checking when, she's checking where too ๐Ÿ”ฅ
  • -d โ€” Perform a dry run, compute all dependencies and module calls but don't run them. all the planning, none of the commitment โœจ
  • --help โ€” Print usage summary. she'll tell you what's up ๐Ÿซถ
  • --verbose โ€” Verbose module output. she gets chatty ๐Ÿ’ฌ
  • --quiet โ€” Quiet module output. she gets mysterious ๐Ÿคซ
  • --ui โ€” Force launching GUI dialog. for the girlies who like a lil window ๐ŸชŸ

๐ŸŒŸ Parameters:

  • type=name โ€” Type of the input space time dataset
    • Options: strds, stvds, str3ds
    • Default: strds
  • expression=expression [required] โ€” The temporal mapcalc expression. you literally cannot skip this one bestie, it's required โญ

๐Ÿ’– DESCRIPTION ๐Ÿ’–

t.select performs selection of maps that are registered in space time datasets using temporal algebra. periodt.

๐Ÿฆ‹ PROGRAM USE ๐Ÿฆ‹

The module expects an expression as input parameter in the following form:

"result = expression"

The statement structure is similar to r.mapcalc, see r.mapcalc. Where result represents the name of a space time dataset (STDS) that will contain the result of the calculation that is given as expression 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. ๐Ÿงš

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. no cap, the algebra really does all that ๐Ÿ’…

The type of the input space time datasets must be defined with the input parameter type. Possible options are STRDS, STVDS or STR3DS. The default is set to space time raster datasets (STRDS).

As default, topological relationships between space time datasets will be evaluated only temporal. Use the s flag to activate the additionally spatial topology evaluation.

The expression option must be passed as quoted expression, for example:

t.select expression="C = A : B"

Where C is the new space time raster dataset that will contain maps from A that are selected by equal temporal relationships to the existing dataset B in this case. slay ๐Ÿ’–


๐Ÿงฎ TEMPORAL ALGEBRA ๐Ÿงฎ

ok so the temporal algebra is where it gets spicy ๐Ÿ”ฅ โ€” it's a whole buffet of temporal operators and functions, and we're abt to go through every single one of them, no skipping, bestie. buckle up ๐ŸŽ€

๐Ÿ”— TEMPORAL RELATIONS ๐Ÿ”—

there's a whole lil family of temporal topology relations you can use between registered maps of space time datasets. here they all are, diagrams and everything, verbatim:

equals            A ------
                  B ------
during            A  ----
                  B ------
contains          A ------
                  B  ----
starts            A ----
                  B ------
started           A ------
                  B ----
finishes          A   ----
                  B ------
finished          A ------
                  B ----
precedes          A ----
                  B     ----
follows           A     ----
                  B ----
overlapped        A   ------
                  B ------
overlaps          A ------
                  B   ------
over              booth overlaps and overlapped

(and yes, over literally says "booth" overlaps and overlapped in the source, we do not touch the source, we only stan it ๐Ÿ’…)

ok so how do you read these?? The relations must be read as: A is related to B, like

  • A equals B
  • A is during B
  • A contains B
๐Ÿซถ heads up: Topological relations must be specified in {} parentheses. don't forget the curly braces or it's giving syntax error energy ๐Ÿ˜ญ

โณ TEMPORAL OPERATORS โณ

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 different possibilities. and here's all five, periodt:

  • l โ€” LEFT REFERENCE. Use the time stamp of the left space time dataset
  • i โ€” INTERSECTION. Intersection
  • d โ€” DISJOINT UNION. Disjoint union
  • u โ€” UNION. Union
  • r โ€” RIGHT REFERENCE. Use the time stamp of the right space time dataset

๐ŸŽฏ TEMPORAL SELECTION ๐ŸŽฏ

The temporal selection simply selects parts of a space time dataset without processing raster or vector data. so it's lowkey the chill one โ€” no raster or vector data gets processed at all, we're just picking and choosing โœจ

The algebra provides a selection operator : that selects parts of a space time dataset that are temporally equal to parts of a second one by default. The following expression

C = A : B

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. (so default vibe = "equal", noted ๐Ÿ“)

In addition the inverse selection operator !: is defined as the complement of the selection operator, hence the following expression

C = A !: 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.

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 | and the temporal extent operator. All three parts are separated by comma and surrounded by curly braces:

{"temporal selection operator", "topological relations", "temporal operator"}

Examples:

C = A {:, equals} B
C = A {!:, equals} B

We can now define arbitrary topological relations using the OR operator "|" to connect them:

C = A {:,equals|during|overlaps} B

Select all parts of A that are equal to B, during B or overlaps B.

In addition we can define the temporal extent of the result STDS by adding the temporal operator.

C = A {:, during,r} B

Select all parts of A that are during B and use the temporal extents from B for C.

The selection operator is implicitly contained in the temporal topology selection operator, so that the following statements are exactly the same:

C = A : B
C = A {:} B
C = A {:,equal} B
C = A {:,equal,l} B

Same for the complementary selection:

C = A !: B
C = A {!:} B
C = A {!:,equal} B
C = A {!:,equal,l} B

slay, right? all four ways, same result. ๐Ÿ’œ

๐Ÿค” CONDITIONAL STATEMENTS ๐Ÿค”

Selection operations can be evaluated within conditional statements.

๐Ÿ’– 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. like, always, no negotiations ๐Ÿซถ

so here's the menu of if forms, with what each one decides and which temporal relations apply:

  • if(if, then, else)
  • if(conditions, A) โ€” A if conditions are True; temporal topological relation between if and then is equal.
  • if(conditions, A, B) โ€” A if conditions are True, B otherwise; temporal topological relation between if, then and else is equal.
  • 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.

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.

โš ๏ธ Important: The conditions are evaluated from left to right. no cap.

๐Ÿ”ฃ Logical operators ๐Ÿ”ฃ

the lineup, icon by icon:

  • == โ€” equal
  • != โ€” not equal
  • > โ€” greater than
  • >= โ€” greater than or equal
  • < โ€” less than
  • <= โ€” less than or equal
  • && โ€” and
  • || โ€” or

๐Ÿ•ฐ๏ธ Temporal functions ๐Ÿ•ฐ๏ธ

The following temporal function are evaluated only for the STDS that must be given in parenthesis. (so like, always hand them the (A) bestie, they don't work without it ๐Ÿ’…)

  • td(A) โ€” Returns a list of time intervals of STDS A
  • 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(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]

โš–๏ธ Comparison operator โš–๏ธ

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:

The structure is similar to the select operator with the extension of an aggregation operator:

{"comparison operator", "topological relations", aggregation operator, "temporal operator"}

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:

Comparison operator -> aggregation operator:

|| -> | and && -> &

Examples:

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

#๏ธโƒฃ Hash operator #๏ธโƒฃ

Additionally the number of maps in intervals can be computed and used in conditional statements with the hash (#) operator.

A{#, contains}B

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. A list of integers (scalars) corresponding to the maps of A that contain maps from B will be returned.

C = if({equal}, A {#, contains} B > 2, A {:, contains} B)

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.

Furthermore the temporal algebra allows temporal buffering, shifting and snapping with the functions buff_t(), tshift() and tsnap() respectively.

  • 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

๐Ÿ—บ๏ธ Single map with temporal extent ๐Ÿ—บ๏ธ

The temporal algebra can also handle single maps with time stamps in the map function.

tmap()

For example:

 C = A {:,during} tmap(event)

This statement select all maps from space time data set A that are during the temporal extent of single map โ€™eventโ€™


โœจ EXAMPLES โœจ

ok now the fun part, actual examples you can copy-paste and feel like a genius ๐ŸŒˆ

1. Select all maps from space time dataset A which have equal time stamps with space time dataset B and C and are earlier that Jan. 1. 2005 and store them in space time dataset D.

D = if(start_date(A) < "2005-01-01", A : B : C)

2. 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.

D = if(A {#, contains} B > 3, A {:, contains} B, C)

3. 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.

D = if(contains, td(buff_t(A, "1 days")) == 3, B, C)

๐Ÿ‘‘ ate, truly. if you can read those three you can read anything.


๐Ÿ“š REFERENCES ๐Ÿ“š

the citation, for when you gotta cite your sources (academic bestie behavior fr fr ๐ŸŽ“):

Gebbert, S., Leppelt, T., Pebesma, E., 2019. A topology based spatio-temporal map algebra for big data analysis. Data 4, 86. https://doi.org/10.3390/data4020086

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

  • r.mapcalc โ€” bestie's other fave for math-ing on rasters ๐Ÿ’–

๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

The absolute legends who made this happen:

  • Thomas Leppelt
  • Sรถren Gebbert
  • Thรผnen Institute of Climate-Smart Agriculture ๐ŸŒพโœจ

๐Ÿฆ‹ SOURCE CODE ๐Ÿฆ‹

Available at: t.select source code (history) ๐Ÿ”

Latest change: Sunday Jul 20 18:06:47 2025 in commit: ad7f155d7ad744c74bde965cc51b9575862e08f4 ๐Ÿ’พ

Main index | Temporal index | Topics index | Keywords index | Graphical index | Full index


okay bestie that's the whole page, we ate and left NO crumbs ๐Ÿ’…

ยฉ 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual ๐ŸŽ€

this was t.select(1grass), GRASS version 8.5.0, and it's giving timeless icon energy fr fr ๐ŸŒธ๐Ÿซถ

๐Ÿ“ฆ where this page comes from