t.rast.accumulate(1)
π t.rast.accumulate π
okay bestie, welcome to t.rast.accumulate(1) from the GRASS GIS User's Manual β this is the one that does cyclic accumulations of a space time raster dataset and honestly? it's giving main character energy. sit down, grab a strawberry π, we're doing this together.
πΈ KEYWORDS πΈ
temporal, accumulation, raster, time
β¨ SYNOPSIS β¨
t.rast.accumulate
t.rast.accumulate --help
t.rast.accumulate [-nr] input=name output=name [lower=name]
[upper=name] start=string [stop=string] cycle=string [offset=string]
[granularity=string] basename=string [suffix=string]
limits=lower,upper [scale=float] [shift=float] [method=string]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π Flags π
-nβ registers empty maps in the output space time raster dataset. if you don't pass this, those empty maps get deleted. no cap.-rβ reverse time direction in cyclic accumulation π--overwriteβ allow output files to overwrite existing files (be brave, but like, be aware)--helpβ print usage summary--verboseβ verbose module output (she talks a lot, we love her)--quietβ quiet module output--uiβ force launching GUI dialog
π¦ Parameters π¦
input=name[required] β name of the input space time raster dataset. this is the moment where you hand her your data.output=name[required] β name of the output space time raster datasetlower=nameβ input space time raster dataset that defines the lower threshold. values lower than this threshold are excluded from accumulation. bye bye tiny values πupper=nameβ input space time raster dataset that defines the upper threshold. values higher than this threshold are excluded from accumulation.start=string[required] β the temporal starting point to begin the accumulation, egβ2001-01-01βstop=stringβ the temporal date to stop the accumulation, egβ2009-01-01βcycle=string[required] β the temporal cycle to restart the accumulation, egβ12 monthsβoffset=stringβ the temporal offset to the beginning of the next cycle, egβ6 monthsβgranularity=stringβ the granularity for accumulationβ1 dayβ- Default:
1 day
- Default:
basename=string[required] β basename of the new generated output maps. a numerical suffix separated by an underscore will be attached to create a unique identifier.suffix=stringβ suffix to add to the basename. setβgranβfor granularity,βtimeβfor the full time format,βnumβfor numerical suffix with a specific number of digits (default%05)- Default:
gran
- Default:
limits=lower,upper[required] β use these limits in case lower and/or upper input space time raster datasets are not defined or contain NULL valuesscale=floatβ scale factor for input space time raster datasetshift=floatβ shift factor for input space time raster datasetmethod=stringβ this method will be applied to compute the accumulative values from the input maps in a single granule. Growing Degree Days or Winkler indices; Mean: sum(input maps)/(number of input maps); Biologically Effective Degree Days; Huglin Heliothermal index- Options:
mean,gdd,bedd,huglin - Default:
mean
- Options:
π DESCRIPTION π
so t.rast.accumulate is literally designed to perform temporal accumulations of space time raster datasets. she expects a space time raster dataset as input that will be sampled by a given granularity. every map that has the start time during the actual granule gets accumulated with the predecessor granule accumulation result using the raster module r.series.accumulate. the default granularity is 1 day, but bestie, you can set any temporal granularity you want. iconic behavior honestly.
the start time and the end time of the accumulation process must be set, eg. start="2000-03-01" end="2011-01-01". in addition, a cycle, eg. cycle="8 months", can be specified, that defines after which interval of time the accumulation process restarts. the offset option specifies the time that should be skipped between two cycles, eg. offset="4 months". π
the lower and upper limits of the accumulation process can be set, either by using space time raster datasets or by using fixed values for all raster cells and time steps. the raster maps that specify the lower and upper limits of the actual granule will be detected using the following temporal relations: equals, during, overlaps, overlapped and contains. first, all maps with time stamps equal to the current granule will be detected, the first lower map and the first upper map found will be used as limit definitions. if no equal maps are found, then maps with a temporal during relation are detected, then maps that temporally overlap the actual granules, until maps that have a temporal contain relation are detected. if no maps are found or lower/upper STRDS are not defined, then the limits option is used, eg. limits=10,30. π
β οΈ heads up bestie: the upper limit is only used in the Biologically Effective Degree Days calculation. don't come for me, that's just how she is.
the options shift, scale and method are passed to r.series.accumulate. please refer to the manual page of r.series.accumulate for detailed option description. iykyk π
the output is a new space time raster dataset with the provided start time, end time and granularity containing the accumulated raster maps. the base name of the generated maps must always be set. the output space time raster dataset can then be analyzed using t.rast.accdetect to detect specific accumulation patterns. π
...more to come, bestie, don't go anywhere π
β¨ EXAMPLE β¨
Okay bestie, story time πΈ This is an example of how to accumulate the daily mean temperature of Europe from 1990 to 2000 using the growing-degree-day method, to detect grass hopper reproduction cycles that are critical to agriculture. Yes, actual real-world science, we love to see it.
First things first, we gotta get the data. Grab the temperature tarball, make a temporary project directory, spin up GRASS with a new project and a PERMANENT mapset, import the thing, and set the region correctly. Also we zoom to the raster map, because why not, main character energy:
# Get the temperature data
wget http://www-pool.math.tu-berlin.de/~soeren/grass/temperature_mean_1990_2000_daily_celsius.tar.gz
# Create a temporary project directory
mkdir -p /tmp/grassdata/LL
# Start GRASS and create a new project with PERMANENT mapset
grass -c EPSG:4326 /tmp/grassdata/LL/PERMANENT
# Import the temperature data
t.rast.import input=temperature_mean_1990_2000_daily_celsius.tar.gz \
output=temperature_mean_1990_2000_daily_celsius directory=/tmp
# We need to set the region correctly
g.region -p raster=`t.rast.list input=temperature_mean_1990_2000_daily_celsius column=name | tail -1`
# We can zoom to the raster map
g.region -p zoom=`t.rast.list input=temperature_mean_1990_2000_daily_celsius column=name | tail -1`
π± Accumulation using the GDD method
So the computation of grashopper pest control cycles is based on:
- Using Growing Degree Days For Insect Management
- Nancy E. Adams
- Extension Educator, Agricultural Resources
available here: http://extension.unh.edu/agric/gddays/docs/growch.pdf
Now we compute the Biologically Effective Degree Days from 1990 to 2000 for each year (12 month cycle) with a granularity of one day. Base temperature is 10Β°C, upper limit is 30Β°C. So basically the accumulation starts at 10Β°C and does not accumulate values above 30Β°C. It's giving bounded, it's giving controlled π
#############################################################################
#### ACCUMULATION USING GDD METHOD ##########################################
#############################################################################
# The computation of grashopper pest control cycles is based on:
#
# Using Growing Degree Days For Insect Management
# Nancy E. Adams
# Extension Educator, Agricultural Resources
#
# available here: http://extension.unh.edu/agric/gddays/docs/growch.pdf
# Now we compute the Biologically Effective Degree Days
# from 1990 - 2000 for each year (12 month cycle) with
# a granularity of one day. Base temperature is 10Β°C, upper limit is 30Β°C.
# Hence the accumulation starts at 10Β°C and does not accumulate values above 30Β°C.
t.rast.accumulate input="temperature_mean_1990_2000_daily_celsius" \
output="temperature_mean_1990_2000_daily_celsius_accumulated_10_30" \
limits="10,30" start="1990-01-01" stop="2000-01-01" cycle="12 months" \
basename="temp_acc_daily_10_30" method="bedd"
π Accumulation pattern detection
Now we detect the three grasshopper pest control cycles. First cycle at 325Β°C - 427Β°C GDD, second cycle at 685Β°C - 813Β°C GDD, third cycle at 1047Β°C - 1179Β°C GDD. Three separate t.rast.accdetect runs, one per cycle, each with its own occ and indicator outputs:
#############################################################################
#### ACCUMULATION PATTERN DETECTION #########################################
#############################################################################
# Now we detect the three grasshopper pest control cycles
# First cycle at 325Β°C - 427Β°C GDD
t.rast.accdetect input=temperature_mean_1990_2000_daily_celsius_accumulated_10_30@PERMANENT \
occ=leafhopper_occurrence_c1_1990_2000 start="1990-01-01" stop="2000-01-01" \
cycle="12 months" range=325,427 basename=lh_c1 indicator=leafhopper_indicator_c1_1990_2000
# Second cycle at 685Β°C - 813Β°C GDD
t.rast.accdetect input=temperature_mean_1990_2000_daily_celsius_accumulated_10_30@PERMANENT \
occ=leafhopper_occurrence_c2_1990_2000 start="1990-01-01" stop="2000-01-01" \
cycle="12 months" range=685,813 basename=lh_c2 indicator=leafhopper_indicator_c2_1990_2000
# Third cycle at 1047Β°C - 1179Β°C GDD
t.rast.accdetect input=temperature_mean_1990_2000_daily_celsius_accumulated_10_30@PERMANENT \
occ=leafhopper_occurrence_c3_1990_2000 start="1990-01-01" stop="2000-01-01" \
cycle="12 months" range=1047,1179 basename=lh_c3 indicator=leafhopper_indicator_c3_1990_2000
πΊοΈ Yearly spatial occurrence computation of all cycles
Next up: extract the areas that have full cycles. We aggregate each indicator to 1 year with method=maximum, then use t.rast.mapcalc to keep only the cells that hit the magic == 3 value (turning them into 1, 2, or 3 respectively, and everything else into null()), then combine all three cleaned layers into one expression. We also write a little color.table with cat > and paint the whole thing with t.rast.colors:
#############################################################################
#### YEARLY SPATIAL OCCURRENCE COMPUTATION OF ALL CYCLES ####################
#############################################################################
# Extract the areas that have full cycles
t.rast.aggregate input=leafhopper_indicator_c1_1990_2000 gran="1 year" \
output=leafhopper_cycle_1_1990_2000_yearly method=maximum basename=li_c1
t.rast.mapcalc input=leafhopper_cycle_1_1990_2000_yearly basename=lh_clean_c1 \
output=leafhopper_cycle_1_1990_2000_yearly_clean \
expression="if(leafhopper_cycle_1_1990_2000_yearly == 3, 1, null())"
t.rast.aggregate input=leafhopper_indicator_c2_1990_2000 gran="1 year" \
output=leafhopper_cycle_2_1990_2000_yearly method=maximum basename=li_c2
t.rast.mapcalc input=leafhopper_cycle_2_1990_2000_yearly basename=lh_clean_c2 \
output=leafhopper_cycle_2_1990_2000_yearly_clean \
expression="if(leafhopper_cycle_2_1990_2000_yearly == 3, 2, null())"
t.rast.aggregate input=leafhopper_indicator_c3_1990_2000 gran="1 year" \
output=leafhopper_cycle_3_1990_2000_yearly method=maximum basename=li_c3
t.rast.mapcalc input=leafhopper_cycle_3_1990_2000_yearly basename=lh_clean_c3 \
output=leafhopper_cycle_3_1990_2000_yearly_clean \
expression="if(leafhopper_cycle_3_1990_2000_yearly == 3, 3, null())"
t.rast.mapcalc input=leafhopper_cycle_1_1990_2000_yearly_clean,leafhopper_cycle_2_1990_2000_yearly_clean,leafhopper_cycle_3_1990_2000_yearly_clean \
basename=lh_cleann_all_cycles \
output=leafhopper_all_cycles_1990_2000_yearly_clean \
expression="if(isnull(leafhopper_cycle_3_1990_2000_yearly_clean), \
if(isnull(leafhopper_cycle_2_1990_2000_yearly_clean), \
if(isnull(leafhopper_cycle_1_1990_2000_yearly_clean), \
null() ,1),2),3)"
cat > color.table << EOF
3 yellow
2 blue
1 red
EOF
t.rast.colors input=leafhopper_cycle_1_1990_2000_yearly_clean rules=color.table
t.rast.colors input=leafhopper_cycle_2_1990_2000_yearly_clean rules=color.table
t.rast.colors input=leafhopper_cycle_3_1990_2000_yearly_clean rules=color.table
t.rast.colors input=leafhopper_all_cycles_1990_2000_yearly_clean rules=color.table
β³ Duration computation
Now we extract the duration in days of each cycle. For every cycle we aggregate the occurrence layer twice β once with method=minimum and once with method=maximum β and then subtract min from max with t.rast.mapcalc to get the duration. Then we colour all three with color=rainbow, because obviously π
#############################################################################
################ DURATION COMPUTATION #######################################
#############################################################################
# Extract the duration in days of the first cycle
t.rast.aggregate input=leafhopper_occurrence_c1_1990_2000 gran="1 year" \
output=leafhopper_min_day_c1_1990_2000 method=minimum basename=occ_min_day_c1
t.rast.aggregate input=leafhopper_occurrence_c1_1990_2000 gran="1 year" \
output=leafhopper_max_day_c1_1990_2000 method=maximum basename=occ_max_day_c1
t.rast.mapcalc input=leafhopper_min_day_c1_1990_2000,leafhopper_max_day_c1_1990_2000 \
basename=occ_duration_c1 \
output=leafhopper_duration_c1_1990_2000 \
expression="leafhopper_max_day_c1_1990_2000 - leafhopper_min_day_c1_1990_2000"
# Extract the duration in days of the second cycle
t.rast.aggregate input=leafhopper_occurrence_c2_1990_2000 gran="1 year" \
output=leafhopper_min_day_c2_1990_2000 method=minimum basename=occ_min_day_c2
t.rast.aggregate input=leafhopper_occurrence_c2_1990_2000 gran="1 year" \
output=leafhopper_max_day_c2_1990_2000 method=maximum basename=occ_max_day_c2
t.rast.mapcalc input=leafhopper_min_day_c2_1990_2000,leafhopper_max_day_c2_1990_2000 \
basename=occ_duration_c2 \
output=leafhopper_duration_c2_1990_2000 \
expression="leafhopper_max_day_c2_1990_2000 - leafhopper_min_day_c2_1990_2000"
# Extract the duration in days of the third cycle
t.rast.aggregate input=leafhopper_occurrence_c3_1990_2000 gran="1 year" \
output=leafhopper_min_day_c3_1990_2000 method=minimum basename=occ_min_day_c3
t.rast.aggregate input=leafhopper_occurrence_c3_1990_2000 gran="1 year" \
output=leafhopper_max_day_c3_1990_2000 method=maximum basename=occ_max_day_c3
t.rast.mapcalc input=leafhopper_min_day_c3_1990_2000,leafhopper_max_day_c3_1990_2000 \
basename=occ_duration_c3 \
output=leafhopper_duration_c3_1990_2000 \
expression="leafhopper_max_day_c3_1990_2000 - leafhopper_min_day_c3_1990_2000"
t.rast.colors input=leafhopper_duration_c1_1990_2000 color=rainbow
t.rast.colors input=leafhopper_duration_c2_1990_2000 color=rainbow
t.rast.colors input=leafhopper_duration_c3_1990_2000 color=rainbow
ποΈ Monthly cycles occurrence
Now we extract the monthly indicator that shows the start and end of a cycle. Same pattern, different granularity: aggregate the indicator with gran="1 month" using method=minimum and method=maximum, then t.rast.mapcalc the two together with a nested if() β 1 if the min month equals 1, 3 if the max month equals 3, otherwise 2. Do it for all three cycles, then write a fresh color.table (3 red, 2 yellow, 1 green) and apply it:
#############################################################################
################ MONTHLY CYCLES OCCURRENCE ##################################
#############################################################################
# Extract the monthly indicator that shows the start and end of a cycle
# First cycle
t.rast.aggregate input=leafhopper_indicator_c1_1990_2000 gran="1 month" \
output=leafhopper_indi_min_month_c1_1990_2000 method=minimum basename=occ_indi_min_month_c1
t.rast.aggregate input=leafhopper_indicator_c1_1990_2000 gran="1 month" \
output=leafhopper_indi_max_month_c1_1990_2000 method=maximum basename=occ_indi_max_month_c1
t.rast.mapcalc input=leafhopper_indi_min_month_c1_1990_2000,leafhopper_indi_max_month_c1_1990_2000 \
basename=indicator_monthly_c1 \
output=leafhopper_monthly_indicator_c1_1990_2000 \
expression="if(leafhopper_indi_min_month_c1_1990_2000 == 1, 1, if(leafhopper_indi_max_month_c1_1990_2000 == 3, 3, 2))"
# Second cycle
t.rast.aggregate input=leafhopper_indicator_c2_1990_2000 gran="1 month" \
output=leafhopper_indi_min_month_c2_1990_2000 method=minimum basename=occ_indi_min_month_c2
t.rast.aggregate input=leafhopper_indicator_c2_1990_2000 gran="1 month" \
output=leafhopper_indi_max_month_c2_1990_2000 method=maximum basename=occ_indi_max_month_c2
t.rast.mapcalc input=leafhopper_indi_min_month_c2_1990_2000,leafhopper_indi_max_month_c2_1990_2000 \
basename=indicator_monthly_c2 \
output=leafhopper_monthly_indicator_c2_1990_2000 \
expression="if(leafhopper_indi_min_month_c2_1990_2000 == 1, 1, if(leafhopper_indi_max_month_c2_1990_2000 == 3, 3, 2))"
# Third cycle
t.rast.aggregate input=leafhopper_indicator_c3_1990_2000 gran="1 month" \
output=leafhopper_indi_min_month_c3_1990_2000 method=minimum basename=occ_indi_min_month_c3
t.rast.aggregate input=leafhopper_indicator_c3_1990_2000 gran="1 month" \
output=leafhopper_indi_max_month_c3_1990_2000 method=maximum basename=occ_indi_max_month_c3
t.rast.mapcalc input=leafhopper_indi_min_month_c3_1990_2000,leafhopper_indi_max_month_c3_1990_2000 \
basename=indicator_monthly_c3 \
output=leafhopper_monthly_indicator_c3_1990_2000 \
expression="if(leafhopper_indi_min_month_c3_1990_2000 == 1, 1, if(leafhopper_indi_max_month_c3_1990_2000 == 3, 3, 2))"
cat > color.table << EOF
3 red
2 yellow
1 green
EOF
t.rast.colors input=leafhopper_monthly_indicator_c1_1990_2000 rules=color.table
t.rast.colors input=leafhopper_monthly_indicator_c2_1990_2000 rules=color.table
t.rast.colors input=leafhopper_monthly_indicator_c3_1990_2000 rules=color.table
π¬ Visualization
And finally (for this bit), we use g.gui.animation to visualize the yearly occurrence, the duration and the monthly occurrence. Yearly occurrence of all reproduction cycles first, then the yearly duration of reproduction cycle 1:
#############################################################################
################ VISUALIZATION ##############################################
#############################################################################
# Now we use g.gui.animation to visualize the yearly occurrence, the duration and the monthly occurrence
# Yearly occurrence of all reproduction cycles
g.gui.animation strds=leafhopper_all_cycles_1990_2000_yearly_clean
# Yearly duration of reproduction cycle 1
g.gui.animation strds=leafhopper_duration_c1_1990_2000
hold on bestie, we are so not done yet π
# Yearly duration of reproduction cycle 2
g.gui.animation strds=leafhopper_duration_c2_1990_2000
# Yearly duration of reproduction cycle 3
g.gui.animation strds=leafhopper_duration_c3_1990_2000
# Monthly occurrence of reproduction cycle 1
g.gui.animation strds=leafhopper_monthly_indicator_c1_1990_2000
# Monthly occurrence of reproduction cycle 2
g.gui.animation strds=leafhopper_monthly_indicator_c2_1990_2000
# Monthly occurrence of reproduction cycle 3
g.gui.animation strds=leafhopper_monthly_indicator_c3_1990_2000
π REFERENCES
ok bestie this is the receipts section, the peer-reviewed source material, the citation π
- Jones, G.V., Duff, A.A., Hall, A., Myers, J.W., 2010. Spatial Analysis of Climate in Winegrape Growing Regions in the Western United States. Am. J. Enol. Vitic. 61, 313-326.
yes that's a real journal, American Journal of Enology and Viticulture, very demure, very viticultural π
π SEE ALSO
the whole friend group π«Ά go hang out with these next:
t.rast.accdetectt.rast.aggregatet.rast.mapcalct.infog.regionr.series.accumulate
π AUTHOR
SΓΆren Gebbert, ThΓΌnen Institute of Climate-Smart Agriculture
we stan a legend β¨
π» SOURCE CODE
Available at: t.rast.accumulate source code (history)
Accessed: Saturday Jan 17 05:41:53 2026
Main index | Temporal index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's a wrap bestie, that's the whole page, no crumbs left π You just read the GRASS 8.4.2 manual page for t.rast.accumulate, last accessed Saturday Jan 17 05:41:53 2026 β go accumulate some rasters, you absolute icon, and don't forget to cite your sources πΈπ¦β
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· 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