1GRDCUT(1) Generic Mapping Tools GRDCUT(1)
2
3
4
6 grdcut - Extract a subregion out of a grid file
7
9 grdcut input_file.grd -Goutput_file.grd -Rwest/east/south/north[r] [ -V
10 ] [ -Z[n]min/max] ] [ -f[i|o]colinfo ]
11
13 grdcut will produce a new output_file.grd file which is a subregion of
14 input_file.grd. The subregion is specified with -R as in other pro‐
15 grams; the specified range must not exceed the range of input_file.grd.
16 If in doubt, run grdinfo to check range. Alternatively, define the
17 subregion indirectly via a range check on the node values. Complemen‐
18 tary to grdcut there is grdpaste, which will join together two grid
19 files along a common edge.
20
21 input_file.grd
22 this is the input .grd format file.
23
24 -Goutput_file.grd
25 this is the output .grd format file.
26
27 -R xmin, xmax, ymin, and ymax specify the Region of interest. For
28 geographic regions, these limits correspond to west, east,
29 south, and north and you may specify them in decimal degrees or
30 in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left
31 and upper right map coordinates are given instead of w/e/s/n.
32 The two shorthands -Rg and -Rd stand for global domain (0/360
33 and -180/+180 in longitude respectively, with -90/+90 in lati‐
34 tude). Alternatively, specify the name of an existing grid file
35 and the -R settings (and grid spacing, if applicable) are copied
36 from the grid. For calendar time coordinates you may either
37 give (a) relative time (relative to the selected TIME_EPOCH and
38 in the selected TIME_UNIT; append t to -JX|x), or (b) absolute
39 time of the form [date]T[clock] (append T to -JX|x). At least
40 one of date and clock must be present; the T is always required.
41 The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
42 calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
43 string must be of the form hh:mm:ss[.xxx]. The use of delim‐
44 iters and their type and positions must be exactly as indicated
45 (however, input, output and plot formats are customizable; see
46 gmtdefaults). This defines the subregion to be cut out.
47
49 -V Selects verbose mode, which will send progress reports to stderr
50 [Default runs "silently"].
51
52 -Z Determine the new rectangular region so that all nodes outside
53 this region are also outside the given z-range [-inf/+inf]. To
54 indicate no limit on min or max, specify a hyphen (-). Nor‐
55 mally, any NaNs encountered are simply skipped. Use -Zn to con‐
56 sider a NaN to be outside the z-range.
57
58 -f Special formatting of input and/or output columns (time or geo‐
59 graphical data). Specify i or o to make this apply only to
60 input or output [Default applies to both]. Give one or more
61 columns (or column ranges) separated by commas. Append T (abso‐
62 lute calendar time), t (relative time in chosen TIME_UNIT since
63 TIME_EPOCH), x (longitude), y (latitude), or f (floating point)
64 to each column or column range item. Shorthand -f[i|o]g means
65 -f[i|o]0x,1y (geographic coordinates).
66
68 By default GMT writes out grid as single precision floats in a COARDS-
69 complaint netCDF file format. However, GMT is able to produce grid
70 files in many other commonly used grid file formats and also facili‐
71 tates so called "packing" of grids, writing out floating point data as
72 2- or 4-byte integers. To specify the precision, scale and offset, the
73 user should add the suffix =id[/scale/offset[/nan]], where id is a two-
74 letter identifier of the grid type and precision, and scale and offset
75 are optional scale factor and offset to be applied to all grid values,
76 and nan is the value used to indicate missing data. When reading
77 grids, the format is generally automatically recognized. If not, the
78 same suffix can be added to input grid file names. See grdreformat(1)
79 and Section 4.17 of the GMT Technical Reference and Cookbook for more
80 information.
81
82 When reading a netCDF file that contains multiple grids, GMT will read,
83 by default, the first 2-dimensional grid that can find in that file. To
84 coax GMT into reading another multi-dimensional variable in the grid
85 file, append ?varname to the file name, where varname is the name of
86 the variable. Note that you may need to escape the special meaning of ?
87 in your shell program by putting a backslash in front of it, or by
88 placing the filename and suffix between quotes or double quotes. The
89 ?varname suffix can also be used for output grids to specify a variable
90 name different from the default: "z". See grdreformat(1) and Section
91 4.18 of the GMT Technical Reference and Cookbook for more information,
92 particularly on how to read splices of 3-, 4-, or 5-dimensional grids.
93
95 When the output grid type is netCDF, the coordinates will be labeled
96 "longitude", "latitude", or "time" based on the attributes of the input
97 data or grid (if any) or on the -f or -R options. For example, both
98 -f0x -f1t and -R90w/90e/0t/3t will result in a longitude/time grid.
99 When the x, y, or z coordinate is time, it will be stored in the grid
100 as relative time since epoch as specified by TIME_UNIT and TIME_EPOCH
101 in the .gmtdefaults file or on the command line. In addition, the unit
102 attribute of the time variable will indicate both this unit and epoch.
103
105 Suppose you have used surface to grid ship gravity in the region
106 between 148E - 162E and 8N - 32N, and you do not trust the gridding
107 near the edges, so you want to keep only the area between 150E - 160E
108 and 10N - 30N, then:
109
110 grdcut grav_148_162_8_32.nc -Ggrav_150_160_10_30.nc -R150/160/10/30 -V
111 To return the subregion of a grid such that any boundary strips where
112 all values are entirely above 0, try
113
114 grdcut bathy.nc -Gtrimmed_bathy.nc -Z-/0 -V
115
117 grdpaste(1), grdinfo(1), GMT(1)
118
119
120
121GMT 4.5.6 10 Mar 2011 GRDCUT(1)