Grid models of terrains often contain individual cells or groups of cells that are surrounded by cells with larger (higher) values. Pits are uncommon features of natural terrains, except in karst landscapes and some types of desert, so in many instances observed pits arise from errors in data capture and subsequent modeling of the surface. Pit filling is thus primarily a form of error correction procedure.
For hydrological analysis pits can be assumed to fill with water during flow and it is often convenient to remove them prior to analysis. This is an application-specific form of smoothing, but may be applied to any grid file, assuming that the result is meaningful for the problem at hand. GIS software such as Landserf, SAGA, PCRaster, GRASS, ArcGIS and Idrisi all provide such functionality as standard (e.g. see the lddcreatedem and related functions in PCRaster, the specialized procedures provided in ANUDEM and similar functions in other packages). Some of these implementations involve simple pit removal working on the assumption that such pits are likely to be minor errors in modeling the landscape, whilst many adopt a broader view of the hydrology. These programs attempt to distinguish between errors or artifacts, and true hydrological depressions. They then seek to remove selected pits (generally by filling) using an iterative process in order to correctly generate local drainage directions and from these, a completely connected drainage network. Several programs, including GRASS and Idrisi implement the algorithm developed by Jenson and Domingue (1988), whilst ArcGIS utilizes their work and also the work of Tarboton et al. (1991) and Hutchinson (1989).
Implementations vary depending upon the number of cells to replace, the conditions applied and the value used for replacement. The simplest condition is that all 8-neighbor cells must contain values greater than a single central cell and the replaced value is the minimum of those surrounding the central cell. Output will consist of a new, pit-less grid file and in some cases, a grid file showing the removed pits and their values. Variants of this operation include masked fill in which a pre-defined sub-region is subject to pit removal, and depression removal in which multi-cell pits (depressions) are removed based on hydrological flow and the depth of fill required. ANUDEM applies a more complex procedure, as described briefly in Section 6.6.14, Topogrid/Topo to raster.