GRDCLIP(1gmt) | GMT | GRDCLIP(1gmt) |
grdclip - Clip the range of grids
grdclip ingrid -Goutgrid [ -Rregion ] [ -Sahigh/above ] [ -Sblow/below ] [ -Silow/high/between ] [ -Srold/new ] [ -V[level] ]
Note: No space is allowed between the option flag and the associated arguments.
grdclip will set values < low to below and/or values > high to above. You can also specify one or more intervals where all values should be set to IT(between), or replace individual values. Such operations are useful when you want all of a continent or an ocean to fall into one color or gray shade in image processing, when clipping of the range of data values is required, or for reclassification of data values. above, below, between, old and new can be any number or even NaN (Not a Number). You must choose at least one of the -S options. Use -R to only extract a subset of the ingrid file.
By default GMT writes out grid as single precision floats in a COARDS-complaint netCDF file format. However, GMT is able to produce grid files in many other commonly used grid file formats and also facilitates so called "packing" of grids, writing out floating point data as 1- or 2-byte integers. (more ...)
To set all values > 70 to NaN and all values < 0 to 0 in file data.nc:
gmt grdclip data.nc -Gnew_data.nc -Sa70/NaN -Sb0/0 -V
To reclassify all values in the 25-30 range to 99, those in 35-39 to 55, exchange 17 for 11 and all values < 10 to 0 in file classes.nc, try
gmt grdclip classes.nc -Gnew_classes.nc -Si25/30/99 -Si35/39/55 -Sr17/11 -Sb10/0 -V
gmt, grdlandmask, grdmask, grdmath, grd2xyz, xyz2grd
2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
May 21, 2019 | 5.4.5 |