1GRDPROJECT(1) Generic Mapping Tools GRDPROJECT(1)
2
3
4
6 grdproject - Forward and Inverse map transformation of 2-D grid files
7
9 grdproject in_grdfile -Gout_grdfile -Jparameters [ -A[k|m|n|i|c|p] ] [
10 -C[dx/dy] ] [ -Dxinc[unit][=|+][/yinc[unit][=|+]] ] [ -Edpi ] [ -F ] [
11 -I ] [ -Mc|i|m|p ] [ -Nnx/ny ] [ -Rwest/east/south/north[r] ] [
12 -S[-]b|c|l|n[/threshold] ] [ -V ]
13
15 grdproject will do one of two things depending whether -I has been set.
16 If set, it will transform a gridded data set from a rectangular coordi‐
17 nate system onto a geographical system by resampling the surface at the
18 new nodes. If not set, it will project a geographical gridded data set
19 onto a rectangular grid. To obtain the value at each new node, its
20 location is inversely projected back onto the input grid after which a
21 value is interpolated between the surrounding input grid values. By
22 default bi-cubic interpolation is used. Aliasing is avoided by also
23 forward projecting the input grid nodes. If two or more nodes are pro‐
24 jected onto the same new node, their average will dominate in the cal‐
25 culation of the new node value. Interpolation and aliasing is con‐
26 trolled with the -S option. The new node spacing may be determined in
27 one of several ways by specifying the grid spacing, number of nodes, or
28 resolution. Nodes not constrained by input data are set to NaN.
29 The -R option can be used to select a map region larger or smaller than
30 that implied by the extent of the grid file.
31
32 in_grdfile
33 2-D binary grid file to be transformed. (See GRID FILE FORMATS
34 below.)
35
36 -G Specify the name of the output grid file. (See GRID FILE FOR‐
37 MATS below.)
38
39 -J Selects the map projection. Scale is UNIT/degree, 1:xxxxx, or
40 width in UNIT (upper case modifier). UNIT is cm, inch, or m,
41 depending on the MEASURE_UNIT setting in .gmtdefaults4, but this
42 can be overridden on the command line by appending c, i, or m to
43 the scale/width value. When central meridian is optional,
44 default is center of longitude range on -R option. Default
45 standard parallel is the equator. For map height, max dimen‐
46 sion, or min dimension, append h, +, or - to the width, respec‐
47 tively.
48 More details can be found in the psbasemap man pages.
49
50 CYLINDRICAL PROJECTIONS:
51
52 -Jclon0/lat0/scale (Cassini)
53 -Jcyl_stere/[lon0/[lat0/]]scale (Cylindrical Stereographic)
54 -Jj[lon0/]scale (Miller)
55 -Jm[lon0/[lat0/]]scale (Mercator)
56 -Jmlon0/lat0/scale (Mercator - Give meridian and standard paral‐
57 lel)
58 -Jo[a]lon0/lat0/azimuth/scale (Oblique Mercator - point and
59 azimuth)
60 -Jo[b]lon0/lat0/lon1/lat1/scale (Oblique Mercator - two points)
61 -Joclon0/lat0/lonp/latp/scale (Oblique Mercator - point and
62 pole)
63 -Jq[lon0/[lat0/]]scale (Cylindrical Equidistant)
64 -Jtlon0/[lat0/]scale (TM - Transverse Mercator)
65 -Juzone/scale (UTM - Universal Transverse Mercator)
66 -Jy[lon0/[lat0/]]scale (Cylindrical Equal-Area)
67
68 CONIC PROJECTIONS:
69
70 -Jblon0/lat0/lat1/lat2/scale (Albers)
71 -Jdlon0/lat0/lat1/lat2/scale (Conic Equidistant)
72 -Jllon0/lat0/lat1/lat2/scale (Lambert Conic Conformal)
73 -Jpoly/[lon0/[lat0/]]scale ((American) Polyconic)
74
75 AZIMUTHAL PROJECTIONS:
76
77 -Jalon0/lat0[/horizon]/scale (Lambert Azimuthal Equal-Area)
78 -Jelon0/lat0[/horizon]/scale (Azimuthal Equidistant)
79 -Jflon0/lat0[/horizon]/scale (Gnomonic)
80 -Jglon0/lat0[/horizon]/scale (Orthographic)
81 -Jglon0/lat0/altitude/azimuth/tilt/twist/Width/Height/scale
82 (General Perspective).
83 -Jslon0/lat0[/horizon]/scale (General Stereographic)
84
85 MISCELLANEOUS PROJECTIONS:
86
87 -Jh[lon0/]scale (Hammer)
88 -Ji[lon0/]scale (Sinusoidal)
89 -Jkf[lon0/]scale (Eckert IV)
90 -Jk[s][lon0/]scale (Eckert VI)
91 -Jn[lon0/]scale (Robinson)
92 -Jr[lon0/]scale (Winkel Tripel)
93 -Jv[lon0/]scale (Van der Grinten)
94 -Jw[lon0/]scale (Mollweide)
95
96 NON-GEOGRAPHICAL PROJECTIONS:
97
98 -Jp[a]scale[/origin][r|z] (Polar coordinates (theta,r))
99 -Jxx-scale[d|l|ppow|t|T][/y-scale[d|l|ppow|t|T]] (Linear, log,
100 and power scaling)
101
103 No space between the option flag and the associated arguments.
104
105 -A Force 1:1 scaling, i.e., output (or input, see -I) data are in
106 actual projected meters. To specify other units, append k (km),
107 m (mile),n (nautical mile), i (inch), c (cm), or p (points).
108 Without -A, the output (or input, see -I) are in the units spec‐
109 ified by MEASURE_UNIT (but see -M).
110
111 -C Let projected coordinates be relative to projection center
112 [Default is relative to lower left corner]. Optionally, add
113 offsets in the projected units to be added (or subtracted when
114 -I is set) to (from) the projected coordinates, such as false
115 eastings and northings for particular projection zones [0/0].
116
117 -D x_inc [and optionally y_inc] is the grid spacing. Optionally,
118 append a suffix modifier. Geographical (degrees) coordinates:
119 Append m to indicate arc minutes or c to indicate arc seconds.
120 If one of the units e, k, i, or n is appended instead, the
121 increment is assumed to be given in meter, km, miles, or nauti‐
122 cal miles, respectively, and will be converted to the equivalent
123 degrees longitude at the middle latitude of the region (the con‐
124 version depends on ELLIPSOID). If /y_inc is given but set to 0
125 it will be reset equal to x_inc; otherwise it will be converted
126 to degrees latitude. All coordinates: If = is appended then the
127 corresponding max x (east) or y (north) may be slightly adjusted
128 to fit exactly the given increment [by default the increment may
129 be adjusted slightly to fit the given domain]. Finally, instead
130 of giving an increment you may specify the number of nodes
131 desired by appending + to the supplied integer argument; the
132 increment is then recalculated from the number of nodes and the
133 domain. The resulting increment value depends on whether you
134 have selected a gridline-registered or pixel-registered grid;
135 see Appendix B for details. Note: if -Rgrdfile is used then
136 grid spacing has already been initialized; use -D to override
137 the values.
138
139 -E Set the resolution for the new grid in dots per inch.
140
141 -F Toggle between pixel and gridline node registration [Default is
142 same as input].
143
144 -I Do the Inverse transformation, from rectangular to geographical.
145
146 -M Append c, i, or m to indicate that cm, inch, or meter should be
147 the projected measure unit [Default is set by MEASURE_UNIT in
148 .gmtdefaults4]. Cannot be used with -A.
149
150 -N Set the number of grid nodes in the new grid.
151
152 -R xmin, xmax, ymin, and ymax specify the Region of interest. For
153 geographic regions, these limits correspond to west, east,
154 south, and north and you may specify them in decimal degrees or
155 in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left
156 and upper right map coordinates are given instead of w/e/s/n.
157 The two shorthands -Rg and -Rd stand for global domain (0/360
158 and -180/+180 in longitude respectively, with -90/+90 in lati‐
159 tude). Alternatively, specify the name of an existing grid file
160 and the -R settings (and grid spacing, if applicable) are copied
161 from the grid. For calendar time coordinates you may either
162 give (a) relative time (relative to the selected TIME_EPOCH and
163 in the selected TIME_UNIT; append t to -JX|x), or (b) absolute
164 time of the form [date]T[clock] (append T to -JX|x). At least
165 one of date and clock must be present; the T is always required.
166 The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
167 calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
168 string must be of the form hh:mm:ss[.xxx]. The use of delim‐
169 iters and their type and positions must be exactly as indicated
170 (however, input, output and plot formats are customizable; see
171 gmtdefaults). You may ask to project only a subset of the grid
172 by specifying a smaller input w/e/s/n region [Default is the
173 region given by the grid file].
174
175 -S Select the interpolation mode by adding b for B-spline smooth‐
176 ing, c for bicubic interpolation, l for bilinear interpolation,
177 or n for nearest-neighbor value (for example to plot categorical
178 data). Optionally, prepend - to switch off antialiasing. Add
179 /threshold to control how close to nodes with NaNs the interpo‐
180 lation will go. A threshold of 1.0 requires all (4 or 16) nodes
181 involved in interpolation to be non-NaN. 0.5 will interpolate
182 about half way from a non-NaN value; 0.1 will go about 90% of
183 the way, etc. [Default is bicubic interpolation with antialias‐
184 ing and a threshold of 0.5].
185
186 -V Selects verbose mode, which will send progress reports to stderr
187 [Default runs "silently"].
188
190 By default GMT writes out grid as single precision floats in a COARDS-
191 complaint netCDF file format. However, GMT is able to produce grid
192 files in many other commonly used grid file formats and also facili‐
193 tates so called "packing" of grids, writing out floating point data as
194 2- or 4-byte integers. To specify the precision, scale and offset, the
195 user should add the suffix =id[/scale/offset[/nan]], where id is a two-
196 letter identifier of the grid type and precision, and scale and offset
197 are optional scale factor and offset to be applied to all grid values,
198 and nan is the value used to indicate missing data. When reading
199 grids, the format is generally automatically recognized. If not, the
200 same suffix can be added to input grid file names. See grdreformat(1)
201 and Section 4.17 of the GMT Technical Reference and Cookbook for more
202 information.
203
204 When reading a netCDF file that contains multiple grids, GMT will read,
205 by default, the first 2-dimensional grid that can find in that file. To
206 coax GMT into reading another multi-dimensional variable in the grid
207 file, append ?varname to the file name, where varname is the name of
208 the variable. Note that you may need to escape the special meaning of ?
209 in your shell program by putting a backslash in front of it, or by
210 placing the filename and suffix between quotes or double quotes. The
211 ?varname suffix can also be used for output grids to specify a variable
212 name different from the default: "z". See grdreformat(1) and Section
213 4.18 of the GMT Technical Reference and Cookbook for more information,
214 particularly on how to read splices of 3-, 4-, or 5-dimensional grids.
215
217 To transform the geographical grid dbdb5.grd onto a pixel Mercator grid
218 at 300 dpi, run
219
220 grdproject dbdb5.grd -R20/50/12/25 -Jm0.25i -E300 -F -Gdbdb5_merc.grd
221
222 To inversely transform the file topo_tm.grd back onto a geographical
223 grid, use
224
225 grdproject topo_tm.grd -R-80/-70/20/40 -Jt-75/1:500000 -I -D5m -V
226 -Gtopo.grd
227
228 This assumes, of course, that the coordinates in topo_tm.grd were cre‐
229 ated with the same projection parameters.
230 To inversely transform the file topo_utm.grd (which is in UTM meters)
231 back to a geographical grid we specify a one-to-one mapping with meter
232 as the measure unit:
233
234 grdproject topo_utm.grd -R203/205/60/65 -Ju5/1:1 -I -Mm -Gtopo.grd -V
235
237 The boundaries of a projected (rectangular) data set will not necessar‐
238 ily give rectangular geographical boundaries (Mercator is one excep‐
239 tion). In those cases some nodes may be unconstrained (set to NaN).
240 To get a full grid back, your input grid may have to cover a larger
241 area than you are interested in.
242
244 GMT(1), gmtdefaults(1), mapproject(1)
245
246
247
248GMT 4.5.6 10 Mar 2011 GRDPROJECT(1)