GeoEco.SpatialAnalysis.Interpolation.Interpolator.FindAndInpaintArcGISRasters

classmethod Interpolator.FindAndInpaintArcGISRasters(inputWorkspace, outputWorkspace, method='Del2a', maxHoleSize=None, xEdgesWrap=False, minValue=None, maxValue=None, wildcard='*', searchTree=False, rasterType=None, outputRasterPythonExpression='os.path.join(outputWorkspace, inputRaster[len(workspaceToSearch)+1:])', modulesToImport=['os.path'], skipExisting=False, overwriteExisting=False)

Finds rasters in an ArcGIS workspace and interpolates values for the NoData cells.

To run this tool, you either must have MATLAB R2026a or MATLAB Runtime R2026a installed. The MATLAB Runtime is free and may be downloaded from https://www.mathworks.com/help/compiler/install-the-matlab-runtime.html. Please follow the installation instructions carefully. Version R2026a must be used; other versions will not work. MATLAB Runtime allows multiple versions can be installed at the same time.

Use this tool to guess values for small clusters of NoData cells in rasters representing continuous surfaces, e.g. images of sea surface temperature in which cloudy pixels contain NoData. This tool provides several advantages over traditional moving-window methods provided by ArcGIS, such as the Focal Statistics tool of the ArcGIS Spatial Analyst:

  • It uses methods based on differential calculus that may provide more accurate guesses than traditional approaches, such as computing the focal mean of a 3x3 neighborhood.

  • It accurately handles rasters with global longitudinal extent, for which the east and west edges are connected.

  • It can fill NoData clusters of any size.

Although this tool can fill NoData clusters of any size, you should apply common sense when using it. The larger the cluster, the less accurate the guessed values will be, especially for rasters that represent a noisy surface.

This tool is implemented in MATLAB using the inpaint_nans function developed by John D’Errico. Many thanks to him for developing and sharing this function. Please see GeoEco’s LICENSE file for the relevant copyright statement.

Parameters:
  • inputWorkspace (str) – Workspace to search. Minimum length꞉ 1. Must exist.

  • outputWorkspace (str) – Workspace to receive the output rasters. Minimum length꞉ 1.

  • method (str, optional) –

    Method to use for interpolation and extrapolation of NoData values. One of:

    • Del2a - Performs Laplacian interpolation and linear extrapolation.

    • Del2b - Same as Del2a but does not build as large a linear system of equations. May use less memory and be faster than Del2a, at the cost of some accuracy. Use this method if Del2a fails due to insufficient memory or if it is too slow.

    • Del2c - Same as Del2a but solves a direct linear system of equations for the NoData values. Faster than both Del2a and Del2b but is the least robust to noise on the boundaries of NoData cells and least able to interpolate accurately for smooth surfaces. Use this method if Del2a and Del2b both fail due to insufficient memory or are too slow.

    • Del4 - Same as Del2a but instead of the Laplace operator (also called the ∇2 operator) it uses the biharmoic operator (also called the ∇4 operator). May result in more accurate interpolations, at some cost in speed.

    • Spring - Uses a spring metaphor. Assumes springs (with a nominal length of zero) connect each cell with every neighbor (horizontally, vertically and diagonally). Since each cell tries to be like its neighbors, extrapolation is as a constant function where this is consistent with the neighboring nodes.

    Allowed values꞉ 'Del2a', 'Del2b', 'Del2c', 'Del4', 'Spring'.

  • maxHoleSize (int, optional) – Maximum size, in cells, that a region of 4-connected NoData cells may be for it to be filled in. Use this option to prevent the filling of large NoData regions (e.g. large clouds in remote sensing images) when you are concerned that values cannot be accurately guessed for those regions. If this option is omitted, all regions will be filled, regardless of size. Must be greater than 0.

  • xEdgesWrap (bool, optional) – If True, the left and right edges of the raster are assumed to be connected and computations along those edges will consider the values on the opposite side of the raster.

  • minValue (float, optional) –

    Minimum allowed value to use when NoData cells are interpolated (or extrapolated). If this parameter is provided, all cells with less than the minimum value will be rounded up to the minimum. This includes not just the cells that had NoData in the original raster and were then interpolated or extrapolated, but also the cells that had values in the original raster.

    Use this parameter when the interpolation/extrapolation algorithm produces impossibly low values. For example, consider a situation in which a chlorophyll concentration raster coincidentally shows a negative gradient approaching a cloud that straddles the edge of the raster. Missing pixels at the edge of the raster will be filled by extrapolation. If the negative gradient is strong enough, the algorithm might extrapolate negative concentrations for the cloudy pixels. This should be impossible; chlorophyll concentration must be zero or higher. To enforce that, you could specify a minimum value of zero (or a very small non-zero number, if exactly zero would be problematic, as might occur if the values were in a log scale).

  • maxValue (float, optional) –

    Maximum allowed value to use when NoData cells are interpolated (or extrapolated). If this parameter is provided, all cells with greater than the maximum value will be rounded up to the maximum. This includes not just the cells that had NoData in the original raster and were then interpolated or extrapolated, but also the cells that had values in the original raster.

    Use this parameter when the interpolation/extrapolation algorithm produces impossibly high values. For example, consider a situation in which a percent sea ice concentration raster shows a positive gradient approaching the coastline but does not provide data right up to shore. Say you wanted to fill the missing cells close to shore and were willing to assume that whatever gradient occurred nearby was reasonable for filling them in. If the positive gradient is strong enough, the algorithm might extrapolate ice concentration values greater than 100 percent, which is impossible. To prevent values from exceeding 100 percent, you could specify a maximum value of 100.

  • wildcard (str, optional) – Wildcard expression specifying the rasters to find. Please see the documentation for the ArcGIS ListRasters() function for more information about the syntax. At the time of this writing, only the * wildcard character was supported, which would match zero or more of any character. Minimum length꞉ 1.

  • searchTree (bool, optional) – If True, child workspaces will be searched.

  • rasterType (str, optional) – Type of rasters to find. If provided, only rasters of this type will be found. At the time of this writing, the ArcGIS Pro 3.2 documentation specified that any of the following strings would be accepted: All (the default), BMP, GIF, GRID, IMG, JP2, JPG, PNG, TIFF. Minimum length꞉ 1.

  • outputRasterPythonExpression (str, optional) –

    Python expression used to calculate the absolute path of an output raster. The expression may be any Python statement appropriate for passing to the eval() function and must return a string. The expression may reference the following variables:

    • workspaceToSearch - the value provided for the workspace to search parameter

    • destinationWorkspace - the value provided for the destination workspace parameter

    • inputRaster - the absolute path to the input raster

    The default expression, os.path.join(destinationWorkspace, inputRaster[len(workspaceToSearch)+1:]), stores the raster in the destination workspace at the same relative location it appears in the workspace to search. The destination path is calculated by stripping the workspace to search from the source path and replacing it with the destination workspace.

    Minimum length꞉ 1.

  • modulesToImport (list of str, optional) – Python modules to import prior to evaluating the expression. If you need to access Python functions or classes that are provided by a module rather than being built-in to the interpreter, list the module here. For example, to be able to use the datetime class in your expression, list the datetime module here. In your expression, you must refer to the class using its fully-qualified name, datetime.datetime.

  • skipExisting (bool, optional) – If True, processing will be skipped for output rasters that already exist.

  • overwriteExisting (bool, optional) – If True and skipExisting is False, existing output rasters will be overwritten.

Returns:

Workspace to receive the output rasters.

Return type:

str