t.rast.gapfill(1grass)
π t.rast.gapfill β the GRASS User's Manual glow-up
okay so bestie, meet t.rast.gapfill, aka the module that patches the holes in your space time raster dataset like it's doing skincare on your data β¨ Full name on the street: t.rast.gapfill from the GRASS manual, and she is serving.
β¨ NAME β¨
t.rast.gapfill β Replaces gaps in a space time raster dataset with interpolated raster maps. it's giving "spot the missing timestamps, fill them in, no drama" π
π·οΈ KEYWORDS π·οΈ
temporal, interpolation, raster, time, no-data filling
like, the whole vibe in five words π¦
πΈ SYNOPSIS πΈ
t.rast.gapfill
t.rast.gapfill --help
t.rast.gapfill [-t] input=name [where=sql_query] basename=string
[ suffix=name] [nprocs=integer] [--help] [--verbose] [--quiet]
[--ui]
(okay the original wraps it like this: t.rast.gapfill [-t] input=name [where=sql_query] basename=string [suffix=name] [nprocs=integer] [--help] [--verbose] [--quiet] [--ui] β same thing, just cozier π«Ά)
π Flags π
-tβ Assign the space time raster dataset start and end time to the output map. no cap, it stamps the timing onto your new maps π--helpβ Print usage summary. your emotional support documentation π--verboseβ Verbose module output. she will tell you everything, and honestly? we love that π--quietβ Quiet module output. shhh era π€«--uiβ Force launching GUI dialog. for the girlies who like buttons π±οΈβ¨
π Parameters π
input=name[required] β Name of the input space time raster dataset. this is the main character, the STRDS we're operating on π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β(yes you write the condition without typing the wordwhereβ it's already implied, iykyk)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. so likegapbecomesgap_6_1,gap_7_1, etc. the underscore is doing the heavy lifting fr fr πsuffix=nameβ Suffix to add at 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β that's the default, she's pre-decided for you π¦nprocs=integerβ Number of interpolation processes to run in parallel. multitasking queen energy. Default:1
π DESCRIPTION π
t.rast.gapfill fills temporal gaps in space time raster datasets using linear interpolation. Temporal all gaps will be detected in the input space time raster dataset automatically. The predecessor and successor maps of the gaps will be identified and used to linear interpolate the raster map between them.
so like β she looks at what's missing, finds the map before the hole and the map after the hole, and draws a straight line between them. mathematically romantic, honestly ππ
π₯ NOTES π₯
This module uses r.series.interp to perform the interpolation for each gap independently. Hence several interpolation processes can be run in parallel. (<- that's the nprocs thing, go wild if your machine can handle it π)
Each gap is re-sampled by the space time raster dataset granularity. Therefore several time stamped raster map layers will be interpolated if the gap is larger than the STRDS granularity.
translation: a big gap doesn't get ONE map, it gets as many maps as the granularity says, each with its own timestamp. the way that she fills a two-day hole with two separate maps... obsessed.
β EXAMPLES β
okay bestie, storytime. In this example we will create 3 raster maps and register them in the temporal database an then in the newly created space time raster dataset. There are gaps of one and two day size between the raster maps. The values of the maps are chosen so that the interpolated values can be estimated. We expect one map with a value of 2 for the first gap and two maps (values 3.666 and 4.333) for the second gap after interpolation.
first, the maps themselves:
r.mapcalc expression="map1 = 1"
r.mapcalc expression="map2 = 3"
r.mapcalc expression="map3 = 5"
register them in time:
t.register type=raster maps=map1 start=2012-08-20 end=2012-08-21
t.register type=raster maps=map2 start=2012-08-22 end=2012-08-23
t.register type=raster maps=map3 start=2012-08-25 end=2012-08-26
make the STRDS:
t.create type=strds temporaltype=absolute \
output=precipitation_daily \
title="Daily precipitation" \
description="Test dataset with daily precipitation"
register inside it:
t.register type=raster input=precipitation_daily maps=map1,map2,map3
peep the data with a comment telling you what you're about to see:
# the output shows three missing maps
t.rast.list input=precipitation_daily columns=name,start_time,min,max
name|start_time|min|max
map1|2012-08-20 00:00:00|1.0|1.0
map2|2012-08-22 00:00:00|3.0|3.0
map3|2012-08-25 00:00:00|5.0|5.0
and here's the gap inventory, deltagaps style:
t.rast.list input=precipitation_daily method=deltagaps
id|name|mapset|start_time|end_time|interval_length|distance_from_begin
map1@PERMANENT|map1|PERMANENT|2012-08-20 00:00:00|2012-08-21 00:00:00|1.0|0.0
None|None|None|2012-08-21 00:00:00|2012-08-22 00:00:00|1.0|1.0
map2@PERMANENT|map2|PERMANENT|2012-08-22 00:00:00|2012-08-23 00:00:00|1.0|2.0
None|None|None|2012-08-23 00:00:00|2012-08-25 00:00:00|2.0|3.0
map3@PERMANENT|map3|PERMANENT|2012-08-25 00:00:00|2012-08-26 00:00:00|1.0|5.0
see all those None rows? yeah. those are the gaps. π
now FILL THEM:
t.rast.gapfill input=precipitation_daily basename=gap
and look at her now:
t.rast.list input=precipitation_daily columns=name,start_time,min,max
name|start_time|min|max
map1|2012-08-20 00:00:00|1.0|1.0
gap_6_1|2012-08-21 00:00:00|2.0|2.0
map2|2012-08-22 00:00:00|3.0|3.0
gap_7_1|2012-08-23 00:00:00|3.666667|3.666667
gap_7_2|2012-08-24 00:00:00|4.333333|4.333333
map3|2012-08-25 00:00:00|5.0|5.0
THE GAPS ARE GONE. one map with value 2 for gap one, and two maps (3.666667 and 4.333333) for gap two, exactly like predicted. she ate and left no crumbs ππ₯
π¦ SEE ALSO π¦
r.series.interp, t.create, t.info
(go read those next, they're all besties fr fr)
π«Ά AUTHOR π«Ά
SΓΆren Gebbert, ThΓΌnen Institute of Climate-Smart Agriculture
thank you for your service legend πΈ
π SOURCE CODE π
Available at: t.rast.gapfill source code (history)
Latest change: Tuesday Jan 27 12:40:13 2026 in commit: 5e8b13d47dd4fc81efa5abefe90c34f7a8291fb9
Main index | Temporal index | Topics index | Keywords index | Graphical index | Full index
and that's the whole thing, bestie β¨ this was GRASS 8.5.0, the GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team, with the last change landing Tuesday Jan 27 12:40:13 2026. go fill some gaps, you've got this πππ¦
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· 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