pygmt.grdfill

pygmt.grdfill(grid, *, mode=None, outgrid=None, region=None, verbose=None, **kwargs)[source]

Fill blank areas from a grid file.

Read a grid that presumably has unfilled holes that the user wants to fill in some fashion. Holes are identified by NaN values but this criteria can be changed. There are several different algorithms that can be used to replace the hole values.

Full option list at https://docs.generic-mapping-tools.org/latest/grdfill.html

Aliases:

  • A = mode

  • G = outgrid

  • R = region

  • V = verbose

Parameters
  • grid (str or xarray.DataArray) – The file name of the input grid or the grid loaded as a DataArray.

  • outgrid (str or None) – The name of the output netCDF file with extension .nc to store the grid in.

  • mode (str) – Specify the hole-filling algorithm to use. Choose from c for constant fill and append the constant value, n for nearest neighbor (and optionally append a search radius in pixels [default radius is \(r^2 = \sqrt{ X^2 + Y^2 }\), where (X,Y) are the node dimensions of the grid]), or s for bicubic spline (optionally append a tension parameter [Default is no tension]).

  • region (str or list) – Required if this is the first plot command. xmin/xmax/ymin/ymax[+r][+uunit]. Specify the region of interest.

  • verbose (bool or str) –

    Select verbosity level [Default is w], which modulates the messages written to stderr. Choose among 7 levels of verbosity:

    • q - Quiet, not even fatal error messages are produced

    • e - Error messages only

    • w - Warnings [Default]

    • t - Timings (report runtimes for time-intensive algorithms);

    • i - Informational messages (same as verbose=True)

    • c - Compatibility warnings

    • d - Debugging messages

Returns

ret (xarray.DataArray or None) – Return type depends on whether the outgrid parameter is set:

  • xarray.DataArray if outgrid is not set

  • None if outgrid is set (grid output will be stored in file set by outgrid)