grdfill¶
Interpolate across holes in a grid
Synopsis¶
gmt grdfill ingrid -Amode[arg] -Goutgrid [ -Rregion ] [ -L[p] ] [ -V[level] ] [ -fflags ] [ --PAR=value ]
Note: No space is allowed between the option flag and the associated arguments.
Description¶
grdfill 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. There are several different algorithms that can be used to replace the hole values.
Required Arguments¶
- ingrid
This is the input grid file.
- -Amode[arg]
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 [NOT IMPLEMENTED YET].
- -Goutgrid
This is the output grid file.
Optional Arguments¶
- -N[nodata]
Sets the node value that identifies a point as a member of a hole [Default is NaN].
- -Rxmin/xmax/ymin/ymax[+r][+uunit]
Specify the region of interest. This defines the subregion to be cut out. (See full description) (See cookbook information).
- -L[p]
Just list the rectangular subregions west east south north of each hole. No grid fill takes place and -G is ignored. Optionally, append p to instead write closed polygons for all subregions.
- -V[level]
Select verbosity level [w]. (See full description) (See cookbook information).
- -f[i|o]colinfo (more …)
Specify data types of input and/or output columns.
- -^ or just -
Print a short message about the syntax of the command, then exit (NOTE: on Windows just use -).
- -+ or just +
Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exit.
- -? or no arguments
Print a complete usage (help) message, including the explanation of all options, then exit.
- --PAR=value
Temporarily override a GMT default setting; repeatable. See gmt.conf for parameters.
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 -f or -R options. For example, both -f0x -f1t and -R90w/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¶
Note: Below are some examples of valid syntax for this module.
The examples that use remote files (file names starting with @
)
can be cut and pasted into your terminal for testing.
Other commands requiring input files are just dummy examples of the types
of uses that are common but cannot be run verbatim as written.
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
gmt grdfill data.grd -L > wesn_listing.txt
To identify the same areas but this time write a multisegment file with polygons corresponding to the rectangular subregions, use
gmt grdfill data.grd -Lp > NaN_regions.txt
To replace all NaN values in the file data.grd with the value 999.0, use
gmt grdfill data.grd -Ac999 -Gno_NaNs_data.grd
To replace all NaN values in the file data.grd with the values at the nearest non-NaN neighbor, try
gmt grdfill data.grd -An -Gno_NaNs_NN_data.grd