## NAME

t.rast.aggregate.py - Aggregates temporally the maps of a space time raster dataset by a user defined granularity.

## KEYWORDS

temporal, aggregation, raster

## SYNOPSIS

t.rast.aggregate.py
t.rast.aggregate.py --help
t.rast.aggregate.py [-ns] input=name output=name basename=string granularity=string method=string [offset=integer] [nprocs=integer] [sampling=name[,name,...]] [where=sql_query] [--overwrite] [--help] [--verbose] [--quiet] [--ui]

### Flags:

-n
  Register Null maps
-s
  Use start time - truncated accoring to granularity - as suffix. This flag overrides the offset option.
--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 the input space time raster dataset
output=name [required]
  Name of the output space time raster dataset
basename=string [required]
  Basename of the new generated output maps
  Either a numerical suffix or the start time (s-flag) separated by an underscore will be attached to create a unique identifier
granularity=string [required]
  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 [required]
  Aggregate operation to be performed on the raster maps
  Options: average, count, median, mode, minimum, min_raster, maximum, max_raster, stddev, range, sum, variance, diversity, slope, offset, detcoeff, quart1, quart3, perc90, quantile, skewness, kurtosis
  Default: average
offset=integer
  Offset that is used to create the output map ids, output map id is generated as: basename_ (count + offset)
  Default: 0
nprocs=integer
  Number of r.series processes to run in parallel
  Default: 1
sampling=name[,name,...]
  The method to be used for sampling the input dataset
  Options: equal, overlaps, overlapped, starts, started, finishes, finished, during, contains
  Default: contains
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'

## DESCRIPTION

t.rast.aggregate temporally aggregates space time raster datasets by a specific temporal granularity. This module support absolute and relative time. The temporal granularity of absolute time can be seconds, minutes, hours, days, weeks, months or years. Mixing of granularities eg. "1 year, 3 months 5 days" is not supported. In case of relative time the temporal unit of the input space time raster dataset is used. The granularity must be specified with an integer value.

This module is sensitive to the current region and mask settings, hence spatial extent and spatial resolution. In case the registered raster maps of the input space time raster dataset have different spatial resolutions, the default nearest neighbor resampling method is used for runtime spatial aggregation.

## NOTES

The raster module r.series is used internally. Hence all aggregate methods of r.series are supported. See the r.series manual page for details.

This module will shift the start date for each aggregation process depending on the provided temporal granularity. The following shifts will performed:

- granularity years: will start at the first of January, hence 14-08-2012 00:01:30 will be shifted to 01-01-2012 00:00:00
- granularity months: will start at the first day of a month, hence 14-08-2012 will be shifted to 01-08-2012 00:00:00
- granularity weeks: will start at the first day of a week (Monday), hence 14-08-2012 01:30:30 will be shifted to 13-08-2012 01:00:00
- granularity days: will start at the first hour of a day, hence 14-08-2012 00:01:30 will be shifted to 14-08-2012 00:00:00
- granularity hours: will start at the first minute of a hour, hence 14-08-2012 01:30:30 will be shifted to 14-08-2012 01:00:00
- granularity minutes: will start at the first second of a minute, hence 14-08-2012 01:30:30 will be shifted to 14-08-2012 01:30:00

The specification of the temporal relation between the aggregation intervals and the raster map layers is always formulated from the aggregation interval viewpoint. Hence, the relation contains has to be specified to aggregate map layer that are temporally located in an aggregation interval.

Parallel processing is supported in case that more than one interval is available for aggregation computation. Internally several r.series modules will be started, depending on the number of specified parallel processes (nprocs) and the number of intervals to aggregate.

## EXAMPLE

In this example the user is going to aggregate monthly data into yearly data, running:

    t.rast.aggregate in=tempmean_monthly out=tempmean_yearly basename=tempmean_year \
                     granularity='1 year' method=average

    t.support input=tempmean_yearly \
              title="Yearly precipitation" \
              description="Aggregated precipitation dataset with yearly resolution"

    t.info tempmean_yearly
     +-------------------- Space Time Raster Dataset -----------------------------+
     |                                                                            |
     +-------------------- Basic information -------------------------------------+
     | Id: ........................ tempmean_yearly@climate_2000_2012
     | Name: ...................... tempmean_yearly
     | Mapset: .................... climate_2000_2012
     | Creator: ................... lucadelu
     | Temporal type: ............. absolute
     | Creation time: ............. 2014-11-27 10:25:21.243319
     | Modification time:.......... 2014-11-27 10:25:21.862136
     | Semantic type:.............. mean
     +-------------------- Absolute time -----------------------------------------+
     | Start time:................. 2009-01-01 00:00:00
     | End time:................... 2013-01-01 00:00:00
     | Granularity:................ 1 year
     | Temporal type of maps:...... interval
     +-------------------- Spatial extent ----------------------------------------+
     | North:...................... 320000.0
     | South:...................... 10000.0
     | East:.. .................... 935000.0
     | West:....................... 120000.0
     | Top:........................ 0.0
     | Bottom:..................... 0.0
     +-------------------- Metadata information ----------------------------------+
     | Raster register table:...... raster_map_register_514082e62e864522a13c8123d1949dea
     | North-South resolution min:. 500.0
     | North-South resolution max:. 500.0
     | East-west resolution min:... 500.0
     | East-west resolution max:... 500.0
     | Minimum value min:.......... 7.370747
     | Minimum value max:.......... 8.81603
     | Maximum value min:.......... 17.111387
     | Maximum value max:.......... 17.915511
     | Aggregation type:........... average
     | Number of registered maps:.. 4
     |
     | Title: Yearly precipitation
     | Monthly precipitation
     | Description: Aggregated precipitation dataset with yearly resolution
     | Dataset with monthly precipitation
     | Command history:
     | # 2014-11-27 10:25:21
     | t.rast.aggregate in="tempmean_monthly"
     |     out="tempmean_yearly" basename="tempmean_year" granularity="1 years"
     |     method="average"
     |
     | # 2014-11-27 10:26:21
     | t.support input=tempmean_yearly \
     |        title="Yearly precipitation" \
     |        description="Aggregated precipitation dataset with yearly resolution"
     +----------------------------------------------------------------------------+

## SEE ALSO

t.rast.aggregate.ds, t.rast.extract, t.info, r.series, g.region, r.mask

Temporal data processing Wiki

## AUTHOR

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

Last changed: $Date: 2015-07-20 16:16:59 +0200 (po, 20 7 2015) $

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

© 2003-2015 GRASS Development Team, GRASS GIS 7.0.1 Reference Manual