.TH GRDCUT 1gmt "Feb 27 2014" "GMT 4.5.13 (SVN)" "Generic Mapping Tools" .SH NAME grdcut \- Extract a subregion out of a grid file .SH SYNOPSIS \fBgrdcut\fP \fIinput_file.grd\fP \fB\-G\fP\fIoutput_file.grd\fP \fB\-R\fP\fIwest\fP/\fIeast\fP/\fIsouth\fP/\fInorth\fP[\fBr\fP] [ \fB\-V\fP ] [ \fB\-Z\fP[\fBn\fP]\fImin/max\fP] ] [ \fB\-f\fP[\fBi\fP|\fBo\fP]\fIcolinfo\fP ] .SH DESCRIPTION \fBgrdcut\fP will produce a new \fIoutput_file.grd\fP file which is a subregion of \fIinput_file.grd\fP. The subregion is specified with \fB\-R\fP as in other programs; the specified range must not exceed the range of \fIinput_file.grd\fP. If in doubt, run \fBgrdinfo\fP to check range. Alternatively, define the subregion indirectly via a range check on the node values. Complementary to \fBgrdcut\fP there is \fBgrdpaste\fP, which will join together two grid files along a common edge. .TP \fIinput_file.grd\fP this is the input \fI.grd\fP format file. .TP \fB\-G\fP\fIoutput_file.grd\fP this is the output \fI.grd\fP format file. .TP \fB\-R\fP \fIxmin\fP, \fIxmax\fP, \fIymin\fP, and \fIymax\fP specify the Region of interest. For geographic regions, these limits correspond to \fIwest, east, south,\fP and \fInorth\fP and you may specify them in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append \fBr\fP if lower left and upper right map coordinates are given instead of w/e/s/n. The two shorthands \fB\-Rg\fP and \fB\-Rd\fP 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 \fB\-R\fP 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 \fBTIME_EPOCH\fP and in the selected \fBTIME_UNIT\fP; append \fBt\fP to \fB\-JX\fP|\fBx\fP), or (b) absolute time of the form [\fIdate\fP]\fBT\fP[\fIclock\fP] (append \fBT\fP to \fB\-JX\fP|\fBx\fP). At least one of \fIdate\fP and \fIclock\fP must be present; the \fBT\fP is always required. The \fIdate\fP string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the \fIclock\fP 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 \fBgmtdefaults\fP). This defines the subregion to be cut out. .SH OPTIONS .TP \fB\-V\fP Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. .TP \fB\-Z\fP Determine the new rectangular region so that all nodes outside this region are also outside the given \fIz\fP-range [-inf/+inf]. To indicate no limit on min or max, specify a hyphen (-). Normally, any NaNs encountered are simply skipped. Use \fB\-Zn\fP to consider a NaN to be outside the \fIz\fP-range. .TP \fB\-f\fP Special formatting of input and/or output columns (time or geographical data). Specify \fBi\fP or \fBo\fP 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 \fBT\fP (absolute calendar time), \fBt\fP (relative time in chosen \fBTIME_UNIT\fP since \fBTIME_EPOCH\fP), \fBx\fP (longitude), \fBy\fP (latitude), or \fBf\fP (floating point) to each column or column range item. Shorthand \fB\-f\fP[\fBi\fP|\fBo\fP]\fBg\fP means \fB\-f\fP[\fBi\fP|\fBo\fP]0\fBx\fP,1\fBy\fP (geographic coordinates). .SH GRID FILE FORMATS By default \fBGMT\fP writes out grid as single precision floats in a COARDS-complaint netCDF file format. However, \fBGMT\fP 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 \fB=\fP\fIid\fP[\fB/\fP\fIscale\fP\fB/\fP\fIoffset\fP[\fB/\fP\fInan\fP]], where \fIid\fP is a two-letter identifier of the grid type and precision, and \fIscale\fP and \fIoffset\fP are optional scale factor and offset to be applied to all grid values, and \fInan\fP 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 \fBgrdreformat\fP(1) and Section 4.17 of the GMT Technical Reference and Cookbook for more information. .P When reading a netCDF file that contains multiple grids, \fBGMT\fP will read, by default, the first 2-dimensional grid that can find in that file. To coax \fBGMT\fP into reading another multi-dimensional variable in the grid file, append \fB?\fP\fIvarname\fP to the file name, where \fIvarname\fP is the name of the variable. Note that you may need to escape the special meaning of \fB?\fP 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 \fB?\fP\fIvarname\fP suffix can also be used for output grids to specify a variable name different from the default: "z". See \fBgrdreformat\fP(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. .SH 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 \fB\-f\fP or \fB\-R\fP options. For example, both \fB\-f0x\fP \fB\-f1t\fP and \fB\-R\fP 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 \fBTIME_UNIT\fP and \fBTIME_EPOCH\fP in the \.gmtdefaults file or on the command line. In addition, the \fBunit\fP attribute of the time variable will indicate both this unit and epoch. .SH EXAMPLES Suppose you have used \fBsurface\fP 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: .sp \fBgrdcut\fP grav_148_162_8_32.nc \fB\-G\fP grav_150_160_10_30.nc \fB\-R\fP 150/160/10/30 \fB\-V\fP To return the subregion of a grid such that any boundary strips where all values are entirely above 0, try .sp \fBgrdcut\fP bathy.nc \fB\-G\fP trimmed_bathy.nc \fB\-Z\fP-/0 \fB\-V\fP .SH "SEE ALSO" .IR grdpaste (1), .IR grdinfo (1), .IR GMT (1)