1GRDRASTER(1) GMT GRDRASTER(1)
2
3
4
6 grdraster - Extract subregion from a binary raster and save as a GMT
7 grid
8
10 grdraster [ filenumber | "text pattern" ]
11 -Rregion [ -Ggrdfile ] [ -Iincrement ] [ -Jparameters ] [
12 -V[level] ] [ -bobinary ] [ -donodata ] [ -oflags ]
13
14 Note: No space is allowed between the option flag and the associated
15 arguments.
16
18 grdraster reads a file called grdraster.info from the current working
19 directory, the directories pointed to by the environment variables
20 $GMT_USERDIR and $GMT_DATADIR, or in $GMT_SHAREDIR/dbase (in that
21 order). The file grdraster.info defines binary arrays of data stored in
22 scan-line format in data files. Each file is given a filenumber in the
23 info file. grdraster figures out how to load the raster data into a
24 grid file spanning a region defined by -R. By default the grid spacing
25 equals the raster spacing. The -I option may be used to sub-sample the
26 raster data. No filtering or interpolating is done, however; the x_inc
27 and y_inc of the grid must be multiples of the increments of the raster
28 file and grdraster simply takes every n'th point. The output of
29 grdraster is either grid or pixel registered depending on the registra‐
30 tion of the raster used. It is up to the GMT system person to maintain
31 the grdraster.info file in accordance with the available rasters at
32 each site. Raster data sets are not supplied with GMT but can be
33 obtained by anonymous ftp and on CD-ROM (see README page in dbase
34 directory). grdraster will list the available files if no arguments
35 are given. Finally, grdraster will write xyz-triplets to stdout if no
36 output gridfile name is given
37
39 filenumber
40 If an integer matching one of the files listed in the
41 grdraster.info file is given we will use that data set, else we
42 will match the given text pattern with the data set description
43 in order to determine the data set.
44
45 -Rwest/east/south/north[/zmin/zmax][+r][+uunit]
46 west, east, south, and north specify the region of interest, and
47 you may specify them in decimal degrees or in
48 [±]dd:mm[:ss.xxx][W|E|S|N] format Append +r if lower left and
49 upper right map coordinates are given instead of w/e/s/n. The
50 two shorthands -Rg and -Rd stand for global domain (0/360 and
51 -180/+180 in longitude respectively, with -90/+90 in latitude).
52 Alternatively for grid creation, give Rcodelon/lat/nx/ny, where
53 code is a 2-character combination of L, C, R (for left, center,
54 or right) and T, M, B for top, middle, or bottom. e.g., BL for
55 lower left. This indicates which point on a rectangular region
56 the lon/lat coordinate refers to, and the grid dimensions nx and
57 ny with grid spacings via -I is used to create the corresponding
58 region. Alternatively, specify the name of an existing grid
59 file and the -R settings (and grid spacing, if applicable) are
60 copied from the grid. Appending +uunit expects projected (Carte‐
61 sian) coordinates compatible with chosen -J and we inversely
62 project to determine actual rectangular geographic region. For
63 perspective view (-p), optionally append /zmin/zmax. In case of
64 perspective view (-p), a z-range (zmin, zmax) can be appended to
65 indicate the third dimension. This needs to be done only when
66 using the -Jz option, not when using only the -p option. In the
67 latter case a perspective view of the plane is plotted, with no
68 third dimension. If r is appended, you may also specify a map
69 projection to define the shape of your region. The output region
70 will be rounded off to the nearest whole grid-step in both
71 dimensions.
72
74 -Ggrdfile
75 Name of output grid file. If not set, the grid will be written
76 as ASCII (or binary; see -bo) xyz-triplets to stdout instead.
77
78 -Ixinc[unit][+e|n][/yinc[unit][+e|n]]
79 x_inc [and optionally y_inc] is the grid spacing. Optionally,
80 append a suffix modifier. Geographical (degrees) coordinates:
81 Append m to indicate arc minutes or s to indicate arc seconds.
82 If one of the units e, f, k, M, n or u is appended instead, the
83 increment is assumed to be given in meter, foot, km, Mile, nau‐
84 tical mile or US survey foot, respectively, and will be con‐
85 verted to the equivalent degrees longitude at the middle lati‐
86 tude of the region (the conversion depends on PROJ_ELLIPSOID).
87 If y_inc is given but set to 0 it will be reset equal to x_inc;
88 otherwise it will be converted to degrees latitude. All coordi‐
89 nates: If +e is appended then the corresponding max x (east) or
90 y (north) may be slightly adjusted to fit exactly the given
91 increment [by default the increment may be adjusted slightly to
92 fit the given domain]. Finally, instead of giving an increment
93 you may specify the number of nodes desired by appending +n to
94 the supplied integer argument; the increment is then recalcu‐
95 lated from the number of nodes and the domain. The resulting
96 increment value depends on whether you have selected a grid‐
97 line-registered or pixel-registered grid; see App-file-formats
98 for details. Note: if -Rgrdfile is used then the grid spacing
99 has already been initialized; use -I to override the values.
100
101 -Jparameters (more ...)
102 Select map projection.
103
104 -V[level] (more ...)
105 Select verbosity level [c].
106
107 -bo[ncols][type] (more ...)
108 Select native binary output.
109
110 -donodata (more ...)
111 Replace output columns that equal NaN with nodata.
112
113 -ocols[,...] (more ...)
114 Select output columns (0 is first column).
115
116 This option applies only if no -G option has been set.
117
118
119 -^ or just -
120 Print a short message about the syntax of the command, then
121 exits (NOTE: on Windows just use -).
122
123 -+ or just +
124 Print an extensive usage (help) message, including the explana‐
125 tion of any module-specific option (but not the GMT common
126 options), then exits.
127
128 -? or no arguments
129 Print a complete usage (help) message, including the explanation
130 of all options, then exits.
131
133 To extract data from raster 1, taking one point every 30 minutes, in an
134 area extended beyond 360 degrees to allow later filtering, run
135
136 gmt grdraster 1 -R-4/364/-62/62 -I30m -Gdata.nc
137
138 To obtain data for an oblique Mercator projection we need to extract
139 more data that is actually used. This is necessary because the output
140 of grdraster has edges defined by parallels and meridians, while the
141 oblique map in general does not. Hence, to get all the data from the
142 ETOPO2 data needed to make a contour map for the region defined by its
143 lower left and upper right corners and the desired projection, use
144
145 gmt grdraster ETOPO2 -R160/20/220/30r -Joc190/25.5/292/69/1 -Gdata.nc
146
147 To extract data from the 2 min Geoware relief blend and write it as
148 binary double precision xyz-triplets to standard output:
149
150 gmt grdraster "2 min Geoware" -R20/25/-10/5 -bo > triplets.b
151
153 gmtdefaults, gmt, grdsample, grdfilter
154
156 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
157
158
159
160
1615.4.5 Feb 24, 2019 GRDRASTER(1)