Manual Reference Pages - GRDCUT (1)
grdcut - Extract a subregion out of a grid file
Grid File Formats
Geographical And Time Coordinates
grdcut input_file.grd -Goutput_file.grd -Rwest/east/south/north[r]
[ -V ] [ -Z[n]min/max] ] [ -f[i|o]colinfo ]
grdcut will produce a new output_file.grd file which is a subregion of input_file.grd.
The subregion is specified with -R as in other programs; the
specified range must not exceed the range of input_file.grd. If in doubt, run grdinfo
to check range. Alternatively, define the subregion indirectly via a range check on the node values.
Complementary to grdcut there is grdpaste, which will join together two
grid files along a common edge.
this is the input .grd format file.
this is the output .grd format file.
xmin, xmax, ymin, and ymax specify the Region of interest. For geographic
regions, these limits correspond to west, east, south, and north and you may specify them
in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left and upper right
map coordinates are given instead of w/e/s/n. The two shorthands -Rg and -Rd stand for global domain
(0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude). Alternatively, specify the name
of an existing grid file and the -R settings (and grid spacing, if applicable) are copied from the grid.
For calendar time coordinates you may either give (a) relative
time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to
-JX|x), or (b) absolute time of the form [date]T[clock]
(append T to -JX|x). At least one of date and clock
must be present; the T is always required. The date string must be of the form [-]yyyy[-mm[-dd]]
(Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock string must be of
the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be exactly as indicated
(however, input, output and plot formats are customizable; see gmtdefaults).
This defines the subregion to be cut out.
Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].
Determine the new rectangular region so that all nodes outside this region are also outside the given z-range [-inf/+inf].
To indicate no limit on min or max, specify a hyphen (-). Normally, any NaNs encountered are simply skipped. Use
-Zn to consider a NaN to be outside the z-range.
Special formatting of input and/or output columns (time or geographical data).
Specify i or o to make this apply only to input or output [Default applies to both].
Give one or more columns (or column ranges) separated by commas.
Append T (absolute calendar time), t (relative time in chosen TIME_UNIT since TIME_EPOCH),
x (longitude), y (latitude), or f (floating point) to each column
or column range item. Shorthand -f[i|o]g means -f[i|o]0x,1y
GRID FILE FORMATS
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 2- or 4-byte integers. To specify the precision, scale and offset, the user should add the suffix
=id[/scale/offset[/nan]], where id is a two-letter identifier of the grid type and precision, and scale and offset are optional scale factor
and offset to be applied to all grid values, and nan is the value used to indicate missing data.
When reading grids, the format is generally automatically recognized. If not, the same suffix can be added to input grid file names.
See grdreformat(1) and Section 4.17 of the GMT Technical Reference and Cookbook for more information.
When reading a netCDF file that contains multiple grids, GMT will read, by default, the first 2-dimensional grid that can find in that
file. To coax GMT into reading another multi-dimensional variable in the grid file, append ?varname to the file name, where
varname is the name of the variable. Note that you may need to escape the special meaning of ? in your shell program
by putting a backslash in front of it, or by placing the filename and suffix between quotes or double quotes.
The ?varname suffix can also be used for output grids to specify a variable name different from the default: "z".
See grdreformat(1) and Section 4.18 of the GMT Technical Reference and Cookbook for more information,
particularly on how to read splices of 3-, 4-, or 5-dimensional grids.
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 -R 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 .gmtdefaults file or on the command line.
In addition, the unit attribute of the time variable will indicate both this unit and epoch.
Suppose you have used surface to grid ship gravity in the region between 148E - 162E and 8N - 32N, and you
do not trust the gridding near the edges, so you want to keep only the area between 150E - 160E and 10N - 30N, then:
grdcut grav_148_162_8_32.nc -G grav_150_160_10_30.nc -R 150/160/10/30 -V
To return the subregion of a grid such that any boundary strips where all values are entirely
above 0, try
grdcut bathy.nc -G trimmed_bathy.nc -Z-/0 -V
|GMT 4.5.14 ||GRDCUT (1) ||1 Nov 2015 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.