GRASS logo

NAME

t.rast.what.aggr - Sample a space time raster dataset at specific vector point map returning aggregate values and write the output to stdout or to attribute table

KEYWORDS

temporal, sampling, raster, time, parallel

SYNOPSIS

t.rast.what.aggr
t.rast.what.aggr --help
t.rast.what.aggr [-uac] input=name strds=name [date_column=name] [date=string] [final_date=string] [output=name] [final_date_column=name[,name,...]] [columns=name[,name,...]] [granularity=string] method=string[,string,...] [separator=character] [nprocs=integer] [date_format=string] [--overwrite] [--help] [--verbose] [--quiet] [--ui]

Flags:

-u
Update attribute table of input vector map
Instead of creating a new vector map update the attribute table with value(s)
-a
Query STRDS with dates after the 'date' or 'column_date' value
Usually t.rast.what.aggr aggregate values before the selected dates, using a flag it will query values after the selected dates
-c
Create new columns, it combine STRDS and method names
Create new columns for the selected methods, it combine STRDS and method names
--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:

input=name [required]
Name of input vector map
Or data source for direct OGR access
strds=name [required]
Name of the input space time raster dataset
date_column=name
Name of the column containing starting dates for aggregates
date=string
The starting date for aggregation
final_date=string
The end date for aggregation, requires date option
output=name
Name for the output file or "-" in case stdout should be used
Default: -
final_date_column=name[,name,...]
Column with ending date for aggregation, requires date_columns option
columns=name[,name,...]
Name of attribute column(s)
granularity=string
Aggregation granularity, format absolute time "x years, x months, x weeks, x days, x hours, x minutes, x seconds" or an integer value for relative time
method=string[,string,...] [required]
Aggregate operation to be performed on the raster maps
Options: average, median, mode, minimum, maximum, stddev, sum, variance, quart1, quart3, perc90, quantile
Default: average
separator=character
Field separator
Special characters: pipe, comma, space, tab, newline
Default: pipe
nprocs=integer
Number of processes to run in parallel
Default: 1
date_format=string
Tha date format
Default: %Y-%m-%d

Table of contents

DESCRIPTION

t.rast.what.aggr samples a space time raster dataset at points from a vector map and returns aggregated values either printing them to stdout or updating the attribute table. A single date for the aggregation can be provided with the option date or alteratively, different dates for each point in the vector map can be passed through the option date_column. Either date or date_column must be provided. The aggregation is done by default backwards in time starting from the date provided and with the granularity set. Alternatively, the data can be aggregated forward in time by using the a flag. By default, the output is printed to stdout. To write the output into the attribute table of the vector map, u flag must be set and the target column should be created beforehand (See v.db.addcolumn). Alternatively, c flag creates the columns using the name of the space time raster dataset (strds) and the method(s) as column name(s).

NOTES

For method=mode the module requires scipy library to be installed.

EXAMPLES

Average NDVI for the previous 2 months starting from 2015-05-01 (i.e.: date="2015-05-01") for all points in the vector map.
t.rast.what.aggr input=GR_GSOM_stations strds=ndvi_16_5600m \
 date=2015-05-01 granularity="2 months"

1|2015-05-01|4480.0
2|2015-05-01|5852.66666667
3|2015-05-01|5683.33333333
4|2015-05-01|4985.0
Average, minimum and maximum NDVI for the previous 2 months starting from 2015-05-01 (i.e.: date="2015-05-01") for all points in the vector map.
t.rast.what.aggr input=GR_GSOM_stations strds=ndvi_16_5600m \
 date=2015-05-01 granularity="2 months" method=average,minimum,maximum

1|2015-05-01|4480.0|4371.0|4545.0
2|2015-05-01|5852.66666667|5618.0|6249.0
3|2015-05-01|5683.33333333|5530.0|5955.0
4|2015-05-01|4985.0|4820.0|5169.0
Average NDVI for the previous 2 months, starting from different dates for each point in the vector map (i.e.: providing date_column).
t.rast.what.aggr input=GR_GSOM_stations strds=ndvi_16_5600m \
 granularity="2 months" date_column=fechas

1|2015-01-01|*
2|2015-02-01|5254.0
3|2015-03-01|6023.66666667
4|2015-04-01|4399.66666667
Minimum and maximum NDVI for the previous 2 months, starting from different dates for each point in the vector map (i.e.: providing date_column).
t.rast.what.aggr input=GR_GSOM_stations strds=ndvi_16_5600m \
 date_column=fechas granularity="2 months" \
 method=minimum,maximum

1|2015-01-01|*|*
2|2015-02-01|5254.0|5254.0
3|2015-03-01|5944.0|6119.0
4|2015-04-01|3786.0|4820.0
Minimum and maximum NDVI for the 2 months after (i.e.: set -a flag) the date provided in date_column. Note that in this example the first point gets populated.
t.rast.what.aggr -a input=GR_GSOM_stations date_column=fechas \
 granularity="2 months" strds=ndvi_16_5600m method=minimum,maximum

1|2015-01-01|3497.0|4280.0
2|2015-02-01|4801.0|6249.0
3|2015-03-01|5530.0|5955.0
4|2015-04-01|5169.0|6390.0
Minimum and maximum NDVI for the previous 2 months, starting from different dates for each point in the vector map (i.e.: providing date_column) and write the output into the vector atrribute's table.
# create columns
v.db.addcolumn map=GR_GSOM_stations column="ndvi_min double precision"
v.db.addcolumn map=GR_GSOM_stations column="ndvi_max double precision"

# write the aggregated values to the attribute table
t.rast.what.aggr -u input=GR_GSOM_stations strds=ndvi_16_5600m \
 date_column=fechas granularity="2 months" columns=ndvi_min,ndvi_max \
 method=minimum,maximum

# check the result
v.db.select map=GR_GSOM_stations

cat|station|name|long|lat|fechas|ndvi_min|ndvi_max
1|GRE00105244|LAMIA|22.4|38.9|2015-01-01||
2|GRE00105246|TANAGRA|23.53|38.32|2015-02-01|5254|5254
3|GRE00105240|CHIOS|26.13|38.33|2015-03-01|5944|6119
4|GRE00105242|FLORINA|21.4|40.78|2015-04-01|3786|4820
Automatically create the columns and populate them with the aggregated values.
t.rast.what.aggr -u -c input=GR_GSOM_stations date_column=fechas \
 granularity="2 months" strds=ndvi_16_5600m method=minimum,maximum

v.db.select map=GR_GSOM_stations
cat|station|name|long|lat|fechas|ndvi_mean|ndvi_max|ndvi_16_5600m_minimum|ndvi_16_5600m_maximum
1|GRE00105244|LAMIA|22.4|38.9|2015-01-01||||
2|GRE00105246|TANAGRA|23.53|38.32|2015-02-01|5254|5254|5254|5254
3|GRE00105240|CHIOS|26.13|38.33|2015-03-01|5944|6119|5944|6119
4|GRE00105242|FLORINA|21.4|40.78|2015-04-01|3786|4820|3786|4820

SEE ALSO

r.what, t.rast.what, t.rast.aggregate

GRASS GIS Wiki: temporal data processing

AUTHORS

Luca Delucchi
Documentation by Veronica Andreo

SOURCE CODE

Available at: t.rast.what.aggr source code (history)

Latest change: Monday Jan 30 19:52:26 2023 in commit: cac8d9d848299297977d1315b7e90cc3f7698730


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

© 2003-2024 GRASS Development Team, GRASS GIS 8.5.0dev Reference Manual