t.rast.what(1grass)
π t.rast.what β the manual page π
okay bestie, pull up a chair because this one is a banger. this is t.rast.what from the GRASS User's Manual, and it is genuinely one of the most underrated little tools in the temporal toolbox. like, it samples a space time raster dataset at specific vector point coordinates and writes the output to stdout using different layouts. that's the whole vibe. π¦
KEYWORDS: temporal, sampling, raster, time β iykyk β¨
β¨ 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. yes queen, give us the column names π-iβ Use stdin as input and ignorecoordinatesandpointoption. feeding it from a pipe is so main character of you.-vβ Show the category for vector points map. categories are the moment fr fr.--overwriteβ Allow output files to overwrite existing files. (this one does what it says, so likeβ¦ be careful π)--helpβ Print usage summary--verboseβ Verbose module output. it will tell you everything.--quietβ Quiet module output. it will tell you nothing.--uiβ Force launching GUI dialog. for when you want a window, no judgement π
π«Ά Parameters π«Ά
points=nameβ Name of input vector map. Or data source for direct OGR access.coordinates=east,northβ Comma separated list of coordinates. literally just the numbers, comma, the other number.strds=name[required] β Name of the input space time raster dataset. this one is required, non-negotiable, the assignment is due bestie. πoutput=nameβ Name for the output file or"-"in case stdout should be used. Default:-where=sql_queryβ WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework. Example:start_time > '2001-01-01 12:30:00'null_value=stringβ String representing NULL valueseparator=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_timelayout=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 ofr.whatprocesses to run in parallel. Default:1
πΈ DESCRIPTION πΈ
so t.rast.what is designed to sample space time raster datasets at specific point coordinates using r.what internally. that's the engine under the hood, and the output of that r.what gets transformed into different output layouts. you pick which one with the layout option. the way that this module handles layouts? obsessed.
Three layouts can be specified:
rowβ Row order, one vector sample point value per rowcolβ Column order, create a column for each vector sample point of a single time step/raster layertimerowβ Time order, create a column for each time step, this order is the originalr.whatoutput, except that the column names are the timestamps
Please have a look at the example to see the supported layouts. (scroll down, the examples EAT π )
This module is designed to run several instances of r.what to sample subsets of a space time raster dataset in parallel. Several intermediate text files will be created that are merged into a single file at the end of the processing. (yes, it's stacking. it's giving organized. it's giving efficient. π₯)
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
r.mapcalc expression="a_2 = 2" -s
r.mapcalc expression="a_3 = 3" -s
r.mapcalc expression="a_4 = 4" -s
t.create type=strds output=A title="A test" descr="A test"
t.register -i type=raster input=A maps=a_1,a_2,a_3,a_4 \
start='1990-01-01' increment="1 month"
β 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
# Row layout using a text file as output
t.rast.what strds=A points=points output=result.txt layout=row -n
cat result.txt
115.0043586274|36.3593955783|1990-01-01 00:00:00|1990-02-01 00:00:00|1
115.0043586274|36.3593955783|1990-02-01 00:00:00|1990-03-01 00:00:00|2
115.0043586274|36.3593955783|1990-03-01 00:00:00|1990-04-01 00:00:00|3
115.0043586274|36.3593955783|1990-04-01 00:00:00|1990-05-01 00:00:00|4
79.6816763826|45.2391522853|1990-01-01 00:00:00|1990-02-01 00:00:00|1
79.6816763826|45.2391522853|1990-02-01 00:00:00|1990-03-01 00:00:00|2
79.6816763826|45.2391522853|1990-03-01 00:00:00|1990-04-01 00:00:00|3
79.6816763826|45.2391522853|1990-04-01 00:00:00|1990-05-01 00:00:00|4
97.4892579600|79.2347263950|1990-01-01 00:00:00|1990-02-01 00:00:00|1
97.4892579600|79.2347263950|1990-02-01 00:00:00|1990-03-01 00:00:00|2
97.4892579600|79.2347263950|1990-03-01 00:00:00|1990-04-01 00:00:00|3
97.4892579600|79.2347263950|1990-04-01 00:00:00|1990-05-01 00:00:00|4
# Column layout order using stdout as output
t.rast.what strds=A points=points layout=col -n
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
# Timerow layout, one time series per row
# using the where statement to select a subset of the STRDS
# and stdout as output
t.rast.what strds=A points=points \
where="start_time >= '1990-03-01'" layout=timerow -n
x|y|1990-03-01 00:00:00;1990-04-01 00:00:00|1990-04-01 00:00:00;1990-05-01 00:00:00
115.004358627375|36.3593955782903|3|4
79.681676382576|45.2391522852909|3|4
97.4892579600048|79.2347263950131|3|4
π SEE ALSO π
g.regionr.maskr.neighborsr.whatt.infot.rast.aggregate.dst.rast.extractv.what.strds
π AUTHOR π
SΓΆren Gebbert, ThΓΌnen Institute of Climate-Smart Agriculture. absolute icon, we stan. π
π SOURCE CODE π
Available at: t.rast.what source code (history)
Latest change: Thursday Jun 26 10:38:43 2025 in commit: a7bb103537dc5179757a05844431d87018688326
Main index | Temporal index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page bestie β you're officially a t.rast.what girly now π this was GRASS 8.5.0, straight out of the GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team. slay, go sample something. πβ¨π¦
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms