1t.rast.aggregate.ds(1)      GRASS GIS User's Manual     t.rast.aggregate.ds(1)
2
3
4

NAME

6       t.rast.aggregate.ds  - Aggregates data of an existing space time raster
7       dataset using the time intervals of a second space time dataset.
8

KEYWORDS

10       temporal, aggregation, raster, time
11

SYNOPSIS

13       t.rast.aggregate.ds
14       t.rast.aggregate.ds --help
15       t.rast.aggregate.ds  [-n]  input=name  sample=name   [type=name]   out‐
16       put=name basename=string  [suffix=string]  method=string  [offset=inte‐
17       ger]            [nprocs=integer]             [sampling=name[,name,...]]
18       [where=sql_query]    [--overwrite]   [--help]   [--verbose]   [--quiet]
19       [--ui]
20
21   Flags:
22       -n
23           Register Null maps
24
25       --overwrite
26           Allow output files to overwrite existing files
27
28       --help
29           Print usage summary
30
31       --verbose
32           Verbose module output
33
34       --quiet
35           Quiet module output
36
37       --ui
38           Force launching GUI dialog
39
40   Parameters:
41       input=name [required]
42           Name of the input space time raster dataset
43
44       sample=name [required]
45           Time intervals from this space  time  dataset  (raster,  vector  or
46           raster3d) are used for aggregation computation
47
48       type=name
49           Type  of  the  space  time  dataset  from which aggregation will be
50           copied
51           Options: strds, stvds, str3ds
52           Default: strds
53
54       output=name [required]
55           Name of the output space time raster dataset
56
57       basename=string [required]
58           Basename of the new generated output maps
59           A numerical suffix separated by an underscore will be  attached  to
60           create a unique identifier
61
62       suffix=string
63           Suffix  to  add at basename: set ’gran’ for granularity, ’time’ for
64           the full time format, ’num’ for numerical suffix  with  a  specific
65           number of digits (default %05)
66           Default: gran
67
68       method=string [required]
69           Aggregate operation to be performed on the raster maps
70           Options:  average,  count, median, mode, minimum, min_raster, maxi‐
71           mum, max_raster, stddev, range, sum,  variance,  diversity,  slope,
72           offset,  detcoeff, quart1, quart3, perc90, quantile, skewness, kur‐
73           tosis
74           Default: average
75
76       offset=integer
77           Offset that is used to create the output map ids, output map id  is
78           generated as: basename_ (count + offset)
79           Default: 0
80
81       nprocs=integer
82           Number of r.mapcalc processes to run in parallel
83           Default: 1
84
85       sampling=name[,name,...]
86           The method to be used for sampling the input dataset
87           Options:  equal,  overlaps,  overlapped, starts, started, finishes,
88           finished, during, contains
89           Default: contains
90
91       where=sql_query
92           WHERE conditions of SQL statement without ’where’ keyword  used  in
93           the temporal GIS framework
94           Example: start_time > ’2001-01-01 12:30:00’
95

DESCRIPTION

97       t.rast.aggregate.ds works like t.rast.aggregate but instead of defining
98       a fixed granularity for temporal aggregation the time intervals of  all
99       maps registered in a second space time dataset (can be STRDS, STR3DS or
100       STVDS) are used to aggregate the maps of the input  space  time  raster
101       dataset.
102

NOTES

104       The sampling method must be specified from the sampler dataset point of
105       view.  It defines the temporal relationships between intervals  of  the
106       sampling dataset and the input space time raster dataset.
107

EXAMPLES

109   Precipitation aggregation
110       In  this  example  we create 7 raster maps that will be registered in a
111       single space time raster  dataset  named  precipitation_daily  using  a
112       daily  temporal granularity. The names of the raster maps are stored in
113       a text file that is used for raster map registration.
114
115       A space time vector dataset is created out of two vector maps with dif‐
116       ferent  temporal  resolution.  The maps are created using v.random. The
117       first map has a granule of 3 days the second a granule of 4 days.
118
119       The space time raster dataset precipitation_daily with  daily  temporal
120       granularity  will  be  aggregated  using  the space time vector dataset
121       resulting in the output space time  raster  dataset  precipitation_agg.
122       The  aggregation  method  is set to sum to accumulate the precipitation
123       values of all intervals in the space time vector dataset. The  sampling
124       option  assures  that  only  raster maps that are temporally during the
125       time intervals of the space time vector dataset are considered for com‐
126       putation.  Hence the option is set to contains (time stamped vector map
127       layers temporally contain the raster map layers):
128       MAPS="map_1 map_2 map_3 map_4 map_5 map_6 map_7"
129       for map in ${MAPS} ; do
130           r.mapcalc expression="${map} = 1"
131           echo ${map} >> map_list.txt
132       done
133       t.create type=strds temporaltype=absolute \
134                output=precipitation_daily \
135                title="Daily precipitation" \
136                description="Test dataset with daily precipitation"
137       t.register -i type=raster input=precipitation_daily \
138                  file=map_list.txt start="2012-08-20" increment="1 days"
139       t.info type=strds input=precipitation_daily
140        +-------------------- Space Time Raster Dataset -----------------------------+
141        |                                                                            |
142        +-------------------- Basic information -------------------------------------+
143        | Id: ........................ precipitation_daily@PERMANENT
144        | Name: ...................... precipitation_daily
145        | Mapset: .................... PERMANENT
146        | Creator: ................... soeren
147        | Temporal type: ............. absolute
148        | Creation time: ............. 2014-11-23 16:48:17.686979
149        | Modification time:.......... 2014-11-23 16:48:18.302978
150        | Semantic type:.............. mean
151        +-------------------- Absolute time -----------------------------------------+
152        | Start time:................. 2012-09-10 00:00:00
153        | End time:................... 2012-09-17 00:00:00
154        | Granularity:................ 1 day
155        | Temporal type of maps:...... interval
156        +-------------------- Spatial extent ----------------------------------------+
157        | North:...................... 80.0
158        | South:...................... 0.0
159        | East:.. .................... 120.0
160        | West:....................... 0.0
161        | Top:........................ 0.0
162        | Bottom:..................... 0.0
163        +-------------------- Metadata information ----------------------------------+
164        | Raster register table:...... raster_map_register_3225725979b14b5db343a00835b882c7
165        | North-South resolution min:. 10.0
166        | North-South resolution max:. 10.0
167        | East-west resolution min:... 10.0
168        | East-west resolution max:... 10.0
169        | Minimum value min:.......... 1.0
170        | Minimum value max:.......... 1.0
171        | Maximum value min:.......... 1.0
172        | Maximum value max:.......... 1.0
173        | Aggregation type:........... None
174        | Number of registered maps:.. 7
175        |
176        | Title:
177        | Daily precipitation
178        | Description:
179        | Test dataset with daily precipitation
180        | Command history:
181        | # 2014-11-23 16:48:17
182        | t.create type="strds" temporaltype="absolute"
183        |     output="precipitation_daily" title="Daily precipitation"
184        |     description="Test dataset with daily precipitation"
185        | # 2014-11-23 16:48:18
186        | t.register -i type="rast" input="precipitation_daily"
187        |     file="map_list.txt" start="2012-08-20" increment="1 days"
188        |
189        +----------------------------------------------------------------------------+
190       v.random output=points_1 n=20
191       v.random output=points_2 n=20
192       t.create type=stvds temporaltype=absolute \
193                output=points \
194                title="Points" \
195                description="Points for aggregation"
196       t.register -i type=vector input=points \
197                  map=points_1 start="2012-08-20" increment="3 days"
198       t.register -i type=vector input=points \
199                  map=points_2 start="2012-08-23" increment="4 days"
200       t.info type=stvds input=points
201        +-------------------- Space Time Vector Dataset -----------------------------+
202        |                                                                            |
203        +-------------------- Basic information -------------------------------------+
204        | Id: ........................ points@PERMANENT
205        | Name: ...................... points
206        | Mapset: .................... PERMANENT
207        | Creator: ................... soeren
208        | Temporal type: ............. absolute
209        | Creation time: ............. 2014-11-23 16:48:49.193903
210        | Modification time:.......... 2014-11-23 16:48:50.185671
211        | Semantic type:.............. mean
212        +-------------------- Absolute time -----------------------------------------+
213        | Start time:................. 2012-08-20 00:00:00
214        | End time:................... 2012-08-27 00:00:00
215        | Granularity:................ 1 day
216        | Temporal type of maps:...... interval
217        +-------------------- Spatial extent ----------------------------------------+
218        | North:...................... 79.283411
219        | South:...................... 5.724954
220        | East:.. .................... 118.881168
221        | West:....................... 0.016755
222        | Top:........................ 0.0
223        | Bottom:..................... 0.0
224        +-------------------- Metadata information ----------------------------------+
225        | Vector register table:...... vector_map_register_6f02d33e0ee243d1a521aaaca39ecb31
226        | Number of points ........... 40
227        | Number of lines ............ 0
228        | Number of boundaries ....... 0
229        | Number of centroids ........ 0
230        | Number of faces ............ 0
231        | Number of kernels .......... 0
232        | Number of primitives ....... 40
233        | Number of nodes ............ 0
234        | Number of areas ............ 0
235        | Number of islands .......... 0
236        | Number of holes ............ 0
237        | Number of volumes .......... 0
238        | Number of registered maps:.. 2
239        |
240        | Title:
241        | Points
242        | Description:
243        | Points for aggregation
244        | Command history:
245        | # 2014-11-23 16:48:49
246        | t.create type="stvds" temporaltype="absolute"
247        |     output="points" title="Points" description="Points for aggregation"
248        | # 2014-11-23 16:48:49
249        | t.register -i type="vect" input="points"
250        |     map="points_1" start="2012-08-20" increment="3 days"
251        | # 2014-11-23 16:48:50
252        | t.register -i type="vect" input="points"
253        |     map="points_2" start="2012-08-23" increment="4 days"
254        |
255        +----------------------------------------------------------------------------+
256       t.rast.aggregate.ds input=precipitation_daily \
257                           output=precipitation_agg \
258                           sample=points type=stvds \
259                           basename=prec_agg \
260                           method=sum sampling=contains
261       t.support input=precipitation_agg \
262                 title="Aggregated precipitation" \
263                 description="Aggregated precipitation dataset"
264       t.info type=strds input=precipitation_agg
265        +-------------------- Space Time Raster Dataset -----------------------------+
266        |                                                                            |
267        +-------------------- Basic information -------------------------------------+
268        | Id: ........................ precipitation_agg@PERMANENT
269        | Name: ...................... precipitation_agg
270        | Mapset: .................... PERMANENT
271        | Creator: ................... soeren
272        | Temporal type: ............. absolute
273        | Creation time: ............. 2014-11-23 16:53:23.488799
274        | Modification time:.......... 2014-11-23 16:53:28.714886
275        | Semantic type:.............. mean
276        +-------------------- Absolute time -----------------------------------------+
277        | Start time:................. 2012-08-20 00:00:00
278        | End time:................... 2012-08-27 00:00:00
279        | Granularity:................ 1 day
280        | Temporal type of maps:...... interval
281        +-------------------- Spatial extent ----------------------------------------+
282        | North:...................... 80.0
283        | South:...................... 0.0
284        | East:.. .................... 120.0
285        | West:....................... 0.0
286        | Top:........................ 0.0
287        | Bottom:..................... 0.0
288        +-------------------- Metadata information ----------------------------------+
289        | Raster register table:...... raster_map_register_7b025eb7431747c98c5c1ad971e8c282
290        | North-South resolution min:. 10.0
291        | North-South resolution max:. 10.0
292        | East-west resolution min:... 10.0
293        | East-west resolution max:... 10.0
294        | Minimum value min:.......... 3.0
295        | Minimum value max:.......... 4.0
296        | Maximum value min:.......... 3.0
297        | Maximum value max:.......... 4.0
298        | Aggregation type:........... sum
299        | Number of registered maps:.. 2
300        |
301        | Title:
302        | Aggregated precipitation
303        | Description:
304        | Aggregated precipitation dataset
305        | Command history:
306        | # 2014-11-23 16:53:23
307        | t.rast.aggregate.ds input="precipitation_daily"
308        |     output="precipitation_agg" sample="points" type="stvds" basename="prec_agg"
309        |     method="sum" sampling="contains"
310        | # 2014-11-23 16:53:28
311        | t.support input="precipitation_agg"
312        |     title="Aggregated precipitation"
313        |     description="Aggregated precipitation dataset"
314        |
315        +----------------------------------------------------------------------------+
316
317   MODIS satellite sensor daily data aggregation to 8 days
318       In this example the aggregation from daily data to eight days is shown.
319       This "eight-day week" is used in some MODIS satellite sensor products.
320       # NOTE: the example is written in shell language
321       # create maps every 8 days as seed maps
322       for year in `seq 2000 2001` ; do
323          for doy in `seq -w 1 8 365` ; do
324             r.mapcalc -s expression="8day_${year}_${doy} = rand(0.0,40.0)"
325          done
326       done
327       # From de name of each map, we take year and doy, and convert it
328       # to a YYYY-MM-DD date for start and end, and create a file with
329       # mapnames, start date and end date
330       g.list type=raster pattern=8day_20??_* > names_list
331       for NAME in `cat names_list` ; do
332          # Parse
333          YEAR=`echo $NAME | cut -d’_’ -f2`
334          DOY=`echo $NAME | cut -d’_’ -f3`
335          # convert YYYY_DOY to YYYY-MM-DD
336          DOY=`echo "$DOY" | sed ’s/^0*//’`
337          doy_end=0
338          if [ $DOY -le "353" ] ; then
339             doy_end=$(( $DOY + 8 ))
340          elif [ $DOY -eq "361" ] ; then
341             if [ $[$YEAR % 4] -eq 0 ] && [ $[$YEAR % 100] -ne 0 ] || [ $[$YEAR % 400] -eq 0 ] ; then
342                doy_end=$(( $DOY + 6 ))
343             else
344                 doy_end=$(( $DOY + 5 ))
345             fi
346          fi
347          DATE_START=`date -d "${YEAR}-01-01 +$(( ${DOY} - 1 ))days" +%Y-%m-%d`
348          DATE_END=`date -d "${YEAR}-01-01 +$(( ${doy_end} -1 ))days" +%Y-%m-%d`
349          # text file with mapnames, start date and end date
350          echo "$NAME|$DATE_START|$DATE_END" >> list_map_start_end_time.txt
351       done
352       # check the list created.
353       cat list_map_start_end_time.txt
354       8day_2000_001|2000-01-01|2000-01-09
355       8day_2000_009|2000-01-09|2000-01-17
356       ...
357       8day_2000_353|2000-12-18|2000-12-26
358       8day_2000_361|2000-12-26|2001-01-01
359       8day_2001_001|2001-01-01|2001-01-09
360       8day_2001_009|2001-01-09|2001-01-17
361       ...
362       8day_2001_345|2001-12-11|2001-12-19
363       8day_2001_353|2001-12-19|2001-12-27
364       8day_2001_361|2001-12-27|2002-01-01
365       # all maps except for the last map in each year represent 8-days
366       # intervals. But the aggregation starts all over again every
367       # January 1st.
368       # create 8-day MODIS-like strds
369       t.create type=strds temporaltype=absolute \
370          output=8day_ts title="8 day time series" \
371          description="STRDS with MODIS like 8 day aggregation"
372       # register maps
373       t.register type=raster input=8day_ts \
374          file=list_map_start_end_time.txt
375       # check
376       t.info input=8day_ts
377       t.rast.list input=8day_ts
378       # finally, copy the aggregation to a daily time series
379       t.rast.aggregate.ds input=daily_ts sample=8day_ts \
380          output=8day_agg basename=8day_agg method=average \
381          sampling=contains suffix=gran
382       # add metadata
383       t.support input=8day_agg \
384          title="8 day aggregated ts" \
385          description="8 day MODIS-like aggregated dataset"
386       # check map list in newly created aggregated strds
387       t.rast.list input=8day_agg
388       name|mapset|start_time|end_time
389       8day_agg_2000_01_01|modis|2000-01-01 00:00:00|2000-01-09 00:00:00
390       8day_agg_2000_01_09|modis|2000-01-09 00:00:00|2000-01-17 00:00:00
391       8day_agg_2000_01_17|modis|2000-01-17 00:00:00|2000-01-25 00:00:00
392       ...
393       8day_agg_2000_12_18|modis|2000-12-18 00:00:00|2000-12-26 00:00:00
394       8day_agg_2000_12_26|modis|2000-12-26 00:00:00|2001-01-01 00:00:00
395       8day_agg_2001_01_01|modis|2001-01-01 00:00:00|2001-01-09 00:00:00
396       ...
397       8day_agg_2001_12_11|modis|2001-12-11 00:00:00|2001-12-19 00:00:00
398       8day_agg_2001_12_19|modis|2001-12-19 00:00:00|2001-12-27 00:00:00
399       8day_agg_2001_12_27|modis|2001-12-27 00:00:00|2002-01-01 00:00:00
400

SEE ALSO

402        t.rast.aggregate, t.create, t.info
403

AUTHOR

405       Sören Gebbert, Thünen Institute of Climate-Smart Agriculture
406

SOURCE CODE

408       Available at: t.rast.aggregate.ds source code (history)
409
410       Main index | Temporal index | Topics index | Keywords index | Graphical
411       index | Full index
412
413       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
414
415
416
417GRASS 7.8.5                                             t.rast.aggregate.ds(1)
Impressum