1t.rast.what(1) Grass User's Manual t.rast.what(1)
2
3
4
6 t.rast.what - Sample a space time raster dataset at specific vector
7 point coordinates and write the output to stdout using different lay‐
8 outs
9
11 temporal, sampling, raster, time
12
14 t.rast.what
15 t.rast.what --help
16 t.rast.what [-niv] [points=name] [coordinates=east,north]
17 strds=name [output=name] [where=sql_query] [null_value=string]
18 [separator=character] [order=string[,string,...]] [layout=string]
19 [nprocs=integer] [--overwrite] [--help] [--verbose] [--quiet]
20 [--ui]
21
22 Flags:
23 -n
24 Output header row
25
26 -i
27 Use stdin as input and ignore coordinates and point option
28
29 -v
30 Show the category for vector points map
31
32 --overwrite
33 Allow output files to overwrite existing files
34
35 --help
36 Print usage summary
37
38 --verbose
39 Verbose module output
40
41 --quiet
42 Quiet module output
43
44 --ui
45 Force launching GUI dialog
46
47 Parameters:
48 points=name
49 Name of input vector map
50 Or data source for direct OGR access
51
52 coordinates=east,north
53 Comma separated list of coordinates
54
55 strds=name [required]
56 Name of the input space time raster dataset
57
58 output=name
59 Name for the output file or "-" in case stdout should be used
60 Default: -
61
62 where=sql_query
63 WHERE conditions of SQL statement without ’where’ keyword used in
64 the temporal GIS framework
65 Example: start_time > ’2001-01-01 12:30:00’
66
67 null_value=string
68 String representing NULL value
69
70 separator=character
71 Field separator
72 Special characters: pipe, comma, space, tab, newline
73 Default: pipe
74
75 order=string[,string,...]
76 Sort the maps by category
77 Options: id, name, creator, mapset, creation_time, modifica‐
78 tion_time, start_time, end_time, north, south, west, east,
79 min, max
80 Default: start_time
81
82 layout=string
83 The layout of the output. One point per row (row), one point per
84 column (col), all timsteps in one row (timerow)
85 Options: row, col, timerow
86 Default: row
87
88 nprocs=integer
89 Number of r.what processes to run in parallel
90 Default: 1
91
93 t.rast.what is designed to sample space time raster datasets at spe‐
94 cific point coordinates using r.what internally. The output of r.what
95 is transformed to different output layouts. The output layouts can be
96 specified using the layout option.
97
98 Three layouts can be specified:
99
100 · row - Row order, one vector sample point value per row
101
102 · col - Column order, create a column for each vector sample
103 point of a single time step/raster layer
104
105 · timerow - Time order, create a column for each time step, this
106 order is the original r.what output, except that the column
107 names are the timestamps
108 Please have a look at the example to see the supported layouts.
109
110 This module is designed to run several instances of r.what to sample
111 subsets of a space time raster dataset in parallel. Several intermedi‐
112 ate text files will be created that are merged into a single file at
113 the end of the processing.
114
115 Coordinates can be provided as vector map using the points option or as
116 comma separated coordinate list with the coordinates option.
117
118 An output file can be specified using the output option. Stdout will
119 be used if no output is specified or if the output option is set to
120 "-".
121
123 Data preparation
124 In the following examples we sample a space time raster dataset that
125 contains 4 raster map layers. First we create the STRDS that will be
126 sampled with t.rast.what.
127 g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10
128 # Generate data
129 r.mapcalc expression="a_1 = 1" -s
130 r.mapcalc expression="a_2 = 2" -s
131 r.mapcalc expression="a_3 = 3" -s
132 r.mapcalc expression="a_4 = 4" -s
133 t.create type=strds output=A title="A test" descr="A test"
134 t.register -i type=raster input=A maps=a_1,a_2,a_3,a_4 \
135 start=’1990-01-01’ increment="1 month"
136
137 Example 1
138 The first approach uses text coordinates as input and stdout as output,
139 the layout is one coordinate(point per column:
140 t.rast.what strds=A coordinates="115,36,79,45" layout=col -n
141 start|end|115.0000000000;36.0000000000|79.0000000000;45.0000000000
142 1990-01-01 00:00:00|1990-02-01 00:00:00|1|1
143 1990-02-01 00:00:00|1990-03-01 00:00:00|2|2
144 1990-03-01 00:00:00|1990-04-01 00:00:00|3|3
145 1990-04-01 00:00:00|1990-05-01 00:00:00|4|4
146
147 Example 2
148 A vector map layer can be used as input to sample the STRDS. All three
149 available layouts are demonstrated using the vector map for sampling.
150 # First create the vector map layer based on random points
151 v.random output=points n=3 seed=1
152 # Row layout using a text file as output
153 t.rast.what strds=A points=points output=result.txt layout=row -n
154 cat result.txt
155 115.0043586274|36.3593955783|1990-01-01 00:00:00|1990-02-01 00:00:00|1
156 115.0043586274|36.3593955783|1990-02-01 00:00:00|1990-03-01 00:00:00|2
157 115.0043586274|36.3593955783|1990-03-01 00:00:00|1990-04-01 00:00:00|3
158 115.0043586274|36.3593955783|1990-04-01 00:00:00|1990-05-01 00:00:00|4
159 79.6816763826|45.2391522853|1990-01-01 00:00:00|1990-02-01 00:00:00|1
160 79.6816763826|45.2391522853|1990-02-01 00:00:00|1990-03-01 00:00:00|2
161 79.6816763826|45.2391522853|1990-03-01 00:00:00|1990-04-01 00:00:00|3
162 79.6816763826|45.2391522853|1990-04-01 00:00:00|1990-05-01 00:00:00|4
163 97.4892579600|79.2347263950|1990-01-01 00:00:00|1990-02-01 00:00:00|1
164 97.4892579600|79.2347263950|1990-02-01 00:00:00|1990-03-01 00:00:00|2
165 97.4892579600|79.2347263950|1990-03-01 00:00:00|1990-04-01 00:00:00|3
166 97.4892579600|79.2347263950|1990-04-01 00:00:00|1990-05-01 00:00:00|4
167 # Column layout order using stdout as output
168 t.rast.what strds=A points=points layout=col -n
169 start|end|115.0043586274;36.3593955783|79.6816763826;45.2391522853|97.4892579600;79.2347263950
170 1990-01-01 00:00:00|1990-02-01 00:00:00|1|1|1
171 1990-02-01 00:00:00|1990-03-01 00:00:00|2|2|2
172 1990-03-01 00:00:00|1990-04-01 00:00:00|3|3|3
173 1990-04-01 00:00:00|1990-05-01 00:00:00|4|4|4
174 # Timerow layout, one time series per row
175 # using the where statement to select a subset of the STRDS
176 # and stdout as output
177 t.rast.what strds=A points=points \
178 where="start_time >= ’1990-03-01’" layout=timerow -n
179 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
180 115.004358627375|36.3593955782903|3|4
181 79.681676382576|45.2391522852909|3|4
182 97.4892579600048|79.2347263950131|3|4
183
185 g.region, r.mask r.neighbors, r.what, t.info, t.rast.aggregate.ds,
186 t.rast.extract, v.what.strds
187
189 Sören Gebbert, Thünen Institute of Climate-Smart Agriculture
190
191 Last changed: $Date: 2015-09-25 13:07:25 +0200 (Fri, 25 Sep 2015) $
192
194 Available at: t.rast.what source code (history)
195
196 Main index | Temporal index | Topics index | Keywords index | Graphical
197 index | Full index
198
199 © 2003-2019 GRASS Development Team, GRASS GIS 7.6.0 Reference Manual
200
201
202
203GRASS 7.6.0 t.rast.what(1)