# grdfill

grdfill(cmd0::String="", arg1=nothing, kwargs...)

Interpolate across holes in a grid.

## Description

Reads 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 via nodata. There are several different algorithms that can be used to replace the hole values. Note: One of mode or list is required, and if no holes are found we output the original unchanged grid.

## Required Arguments

The 2-D gridded data set.

## Optional Arguments

• A or mode : – mode=:c|:g|:n|:s[arg]
Specify the hole-filling algorithm to use. Choose among c for constant fill (and append the constant fill value), g to sample the (possibly coarser) grid arg at the nodes making up the holes, n for nearest neighbor (and optionally append a search radius in pixels [default radius is $$r = \sqrt{n^2 + m^2}$$, where (n,m) are the node dimensions of the grid]), or s for bicubic spline (optionally append a tension parameter [no tension]).

• G or save or outgrid or outfile : – save=file_name.grd
Write one or more fields directly to grids on disk; no data is returned to the Julia REPL. If more than one fields are specified via fields then file_name must contain the format flag %s so that we can embed the field code in the file names.

• N or nodata : – nodata=true | nodata=value
Sets the node value used to identify a point as a member of a hole [Default is NaN].

• R or region or limits : – limits=(xmin, xmax, ymin, ymax) | limits=(BB=(xmin, xmax, ymin, ymax),) | limits=(LLUR=(xmin, xmax, ymin, ymax),units="unit") | ...more
Specify the region of interest. More at limits. For perspective view view, optionally add zmin,zmax. This option may be used to indicate the range used for the 3-D axes. You may ask for a larger w/e/s/n region to have more room between the image and the axes.

• L or list : – list=true | list=:p
Just list the rectangular subregions west east south north of each hole. No grid fill takes place. Optionally, use list=:p to instead write closed polygons for all subregions.

• V or verbose : – verbose=true | verbose=level
Select verbosity level. More at verbose

• f or colinfo : – colinfo=??
Specify the data types of input and/or output columns (time or geographical data). More at

## Geographical And Time Coordinates

When the output grid type is netCDF, the coordinates will be labeled "longitude", "latitude", or "time" based on the attributes of the input data or grid (if any) or on the colinfo or region options. For example, both colinfo="0x" colinfo="1t" and region="90w/90e/0t/3t" will result in a longitude/time grid. When the x, y, or z coordinate is time, it will be stored in the grid as relative time since epoch as specified by TIME_UNIT and TIME_EPOCH in the gmt.conf file or on the command line. In addition, the unit attribute of the time variable will indicate both this unit and epoch.

## Examples

To identify all regions with NaNs in the grid data.grd and create a listing of the bounding coordinates of rectangular regions that would cover these NaN areas, try:

D = grdfill("data.grd", list=true)

To identify the same areas but this time write a multisegment file with polygons corresponding to the rectangular subregions, use:

D = grdfill("data.grd", list=:p)

To replace all NaN values in the file data.grd with the value 999.0, use:

G = grdfill("data.grd", mode="c999")

To replace all NaN values in the file data.grd with the values at the nearest non-NaN neighbor, try:

G = grdfill("data.grd", mode=:n)

To replace all NaN values in the file data.grd with a spline interpolation using a tension of 0.2, try:

G = grdfill("data.grd", mode="s0.2")

To replace all NaN values in the file data.grd by sampling another grid named background.grd, try:

G = grdfill("data.grd", mode="gbackground.grd")