T.rast - What - GRASS GIS Manual
T.rast - What - GRASS GIS Manual
T.rast - What - GRASS GIS Manual
Table of contents
NAME
t.rast.what - Sample a space time raster dataset at specific vector point coordinates
and write the output to stdout using different layouts
KEYWORDS
temporal, sampling, raster, time
SYNOPSIS
t.rast.what
t.rast.what --help
t.rast.what [-niv] [points=name] [coordinates=east,north] strds=name
[output=name] [where=sql_query] [null_value=string] [separator=character]
[order=string[,string,...]] [layout=string] [nprocs=integer] [--overwrite] [--help] [--
verbose] [--quiet] [--ui]
Flags:
-n
Output header row
-i
Use stdin as input and ignore coordinates and point option
-v
Show the category for vector points map
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog
Parameters:
points=name
Name of input vector map
Or data source for direct OGR access
coordinates=east,north
Comma separated list of coordinates
strds=name [required]
Name of the input space time raster dataset
output=name
Name for the output file or "-" in case stdout should be used
Default: -
where=sql_query
https://grass.osgeo.org/grass82/manuals/t.rast.what.html 1/4
6/9/23, 09:17 t.rast.what - GRASS GIS manual
WHERE conditions of SQL statement without 'where' keyword used in the
temporal GIS framework Table of contents
Example: start_time > '2001-01-01 12:30:00'
null_value=string
String representing NULL value
separator=character
Field separator
Special characters: pipe, comma, space, tab, newline
Default: pipe
order=string[,string,...]
Sort the maps by category
Options: id, name, creator, mapset, creation_time, modification_time, start_time,
end_time, north, south, west, east, min, max
Default: start_time
layout=string
The layout of the output. One point per row (row), one point per column (col), all
timsteps in one row (timerow)
Options: row, col, timerow
Default: row
nprocs=integer
Number of r.what processes to run in parallel
Default: 1
DESCRIPTION
t.rast.what is designed to sample space time raster datasets at specific point
coordinates using r.what internally. The output of r.what is transformed to different
output layouts. The output layouts can be specified using the layout option.
row - Row order, one vector sample point value per row
col - Column order, create a column for each vector sample point of a single
time step/raster layer
timerow - Time order, create a column for each time step, this order is the
original r.what output, except that the column names are the timestamps
Coordinates can be provided as vector map using the points option or as comma
separated coordinate list with the coordinates option.
An output file can be specified using the output option. Stdout will be used if no output
is specified or if the output option is set to "-".
EXAMPLES
Data preparation
In the following examples we sample a space time raster dataset that contains 4
raster map layers. First we create the STRDS that will be sampled with t.rast.what.
g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10
# Generate data
r.mapcalc expression="a_1 = 1" -s
https://grass.osgeo.org/grass82/manuals/t.rast.what.html 2/4
6/9/23, 09:17 t.rast.what - GRASS GIS manual
r.mapcalc expression="a_2 = 2" -s
r.mapcalc expression="a_3 = 3" -s
Table of contents
r.mapcalc expression="a_4 = 4" -s
Example 1
The first approach uses text coordinates as input and stdout as output, the layout is
one coordinate(point per column:
t.rast.what strds=A coordinates="115,36,79,45" layout=col -n
start|end|115.0000000000;36.0000000000|79.0000000000;45.0000000000
1990-01-01 00:00:00|1990-02-01 00:00:00|1|1
1990-02-01 00:00:00|1990-03-01 00:00:00|2|2
1990-03-01 00:00:00|1990-04-01 00:00:00|3|3
1990-04-01 00:00:00|1990-05-01 00:00:00|4|4
Example 2
A vector map layer can be used as input to sample the STRDS. All three available
layouts are demonstrated using the vector map for sampling.
# First create the vector map layer based on random points
v.random output=points n=3 seed=1
cat result.txt
start|end|115.0043586274;36.3593955783|79.6816763826;45.2391522853|97.4892579600;79.2347263950
1990-01-01 00:00:00|1990-02-01 00:00:00|1|1|1
1990-02-01 00:00:00|1990-03-01 00:00:00|2|2|2
1990-03-01 00:00:00|1990-04-01 00:00:00|3|3|3
1990-04-01 00:00:00|1990-05-01 00:00:00|4|4|4
SEE ALSO
g.region, r.mask r.neighbors, r.what, t.info, t.rast.aggregate.ds, t.rast.extract,
v.what.strds
AUTHOR
Sören Gebbert, Thünen Institute of Climate-Smart Agriculture
SOURCE CODE
Available at: t.rast.what source code (history)
Main index | Temporal index | Topics index | Keywords index | Graphical index | Full
index
https://grass.osgeo.org/grass82/manuals/t.rast.what.html 4/4