Your company here — click to reach over 10,000 unique daily visitors

r.fillnulls.1grass - Man Page

Fills no-data areas in raster maps using spline interpolation.


raster, surface, elevation, interpolation, splines, no-data filling


r.fillnulls --help
r.fillnulls input=name output=name method=string  [tension=float]   [smooth=float]   [edge=integer]   [npmin=integer]   [segmax=integer]   [lambda=float]   [memory=memory in MB]   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]



Allow output files to overwrite existing files


Print usage summary


Verbose module output


Quiet module output


Force launching GUI dialog


input=name [required]

Name of input raster map

output=name [required]

Name for output raster map

method=string [required]

Interpolation method to use
Options: bilinear, bicubic, rst
Default: rst


Spline tension parameter
Default: 40.


Spline smoothing parameter
Default: 0.1


Width of hole edge used for interpolation (in cells)
Options: 2-100
Default: 3


Minimum number of points for approximation in a segment (>segmax)
Options: 2-10000
Default: 600


Maximum number of points in a segment
Options: 2-10000
Default: 300


Tykhonov regularization parameter (affects smoothing)
Used in bilinear and bicubic spline interpolation
Default: 0.01

memory=memory in MB

Maximum memory to be used (in MB)
Cache size for raster rows
Default: 300


r.fillnulls fills NULL pixels (no data areas) in input raster map and stores filled data to a new output raster map. The fill areas are interpolated from the no data area boundaries buffer using v.surf.rst regularized spline interpolation with tension (method=rst) or r.resamp.bspline cubic or linear spline interpolation with Tykhonov regularization.


Each area boundary buffer is set to three times the map resolution to get nominally three points around the edge. This way the algorithm interpolates into the hole with a trained slope and curvature at the edges, in order to avoid that such a flat plane is generated in a hole. The width of edge area can be adjusted by changing the edge parameter.

During the interpolation following warning may occur when using the RST method:

Warning: strip exists with insufficient data
Warning: taking too long to find points for interpolation--please change the region to area where your points are

This warning is generated if large data holes exist within the surface. As the idea of r.fillnulls is to fill such holes, the user may ignore the warning. The interpolation will be continued. However, the user may pay attention to below notes.

If interpolation fails, temporary raster and vector maps are left in place to allow unfilled map holes (NULL areas) to be identified and manually repaired.

When using the default RST method, the algorithm is based on v.surf.rst regularized splines with tension interpolation module which interpolates the raster cell values for NULL data areas from the boundary values of the NULL data area. An eventual raster MASK is respected during the NULL data area(s) filling. The interpolated values are patched into the NULL data area(s) of the input map and saved into a new raster map. Otherwise, either the linear or cubic spline interpolation with Tykhonov regularization can be selected (based on r.resamp.bspline).


Depending on the shape of the NULL data area(s) problems may occur due to an insufficient number of input cell values for the interpolation process. Most problems will occur if a NULL data area reaches a large amount of the map boundary. The user will have to carefully check the result using r.mapcalc (generating a difference map to the input map and applying the "differences" color table with r.colors) and/or to query individual cell values.

RST method stores temporary maps on hard disk. It will require at least as much free space as one extra input raster map takes.


In this example, the SRTM elevation map in the North Carolina sample dataset location is filtered for outlier elevation values; missing pixels are then re-interpolated to obtain a complete elevation map:

g.region raster=elev_srtm_30m -p
d.mon wx0
d.histogram elev_srtm_30m
# remove SRTM outliers, i.e. SRTM below 50m (esp. lakes), leading to no data areas
r.mapcalc "elev_srtm_30m_filt = if(elev_srtm_30m < 50.0, null(), elev_srtm_30m)"
d.histogram elev_srtm_30m_filt
d.rast elev_srtm_30m_filt
# using the default RST method to fill these holes in DEM
r.fillnulls input=elev_srtm_30m_filt output=elev_srtm_30m_rst tension=20
# using the bilinear method to fill these holes in DEM
r.fillnulls input=elev_srtm_30m_filt output=elev_srtm_30m_bilin method=bilinear
d.histogram elev_srtm_30m_rst
d.rast elev_srtm_30m_rst
d.histogram elev_srtm_30m_bilin
d.rast elev_srtm_30m_bilin
r.mapcalc "diff_rst_bilin = elev_srtm_30m_rst - elev_srtm_30m_bilin"
r.colors diff_rst_bilin color=differences
r.univar -e diff_rst_bilin
d.rast diff_rst_bilin
d.legend diff_rst_bilin


See Also

r.fill.dir, r.mapcalc, r.resamp.bspline, v.surf.bspline, v.surf.rst


Markus Neteler, University of Hannover and Fondazione Edmund Mach
Improvement by Hamish Bowman, NZ

Source Code

Available at: r.fillnulls source code (history)

Accessed: Tuesday May 14 13:42:01 2024

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2024 GRASS Development Team, GRASS GIS 8.3.2 Reference Manual


GRASS 8.3.2 GRASS GIS User's Manual