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
74 AZIMUTHAL PROJECTIONS:
75
76 -Jalon0/lat0[/horizon]/scale (Lambert Azimuthal Equal-Area)
77 -Jelon0/lat0[/horizon]/scale (Azimuthal Equidistant)
78 -Jflon0/lat0[/horizon]/scale (Gnomonic)
79 -Jglon0/lat0[/horizon]/scale (Orthographic)
80 -Jglon0/lat0/altitude/azimuth/tilt/twist/Width/Height/scale
81 (General Perspective).
82 -Jslon0/lat0[/horizon][/slat]/scale (General Stereographic)
83
84 MISCELLANEOUS PROJECTIONS:
85
86 -Jh[lon0/]scale (Hammer)
87 -Ji[lon0/]scale (Sinusoidal)
88 -Jkf[lon0/]scale (Eckert IV)
89 -Jk[s][lon0/]scale (Eckert IV)
90 -Jn[lon0/]scale (Robinson)
91 -Jr[lon0/]scale (Winkel Tripel)
92 -Jv[lon0/]scale (Van der Grinten)
93 -Jw[lon0/]scale (Mollweide)
94
95 NON-GEOGRAPHICAL PROJECTIONS:
96
97 -Jp[a]scale[/origin][r|z] (Polar coordinates (theta,r))
98 -Jxx-scale[d|l|ppow|t|T][/y-scale[d|l|ppow|t|T]] (Linear, log,
99 and power scaling)
100
102 No space between the option flag and the associated arguments.
103
104 -A Force 1:1 scaling, i.e., output (or input, see -I) data are in
105 actual projected meters. To specify other units, append k (km),
106 m (mile),n (nautical mile), i (inch), c (cm), or p (points).
107 Without -A, the output (or input, see -I) are in the units spec‐
108 ified by MEASURE_UNIT (but see -M).
109
110 -C Let projected coordinates be relative to projection center
111 [Default is relative to lower left corner]. Optionally, add
112 offsets in the projected units to be added (or subtracted when
113 -I is set) to (from) the projected coordinates, such as false
114 eastings and northings for particular projection zones [0/0].
115
116 -D Set the grid spacing for the new grid. Append m for minutes, c
117 for seconds.
118
119 -E Set the resolution for the new grid in dots per inch.
120
121 -F Toggle between pixel and gridline node registration [Default is
122 same as input].
123
124 -I Do the Inverse transformation, from rectangular to geographical.
125
126 -M Append c, i, or m to indicate that cm, inch, or meter should be
127 the projected measure unit [Default is set by MEASURE_UNIT in
128 .gmtdefaults4]. Cannot be used with -A.
129
130 -N Set the number of grid nodes in the new grid.
131
132 -R xmin, xmax, ymin, and ymax specify the Region of interest. For
133 geographic regions, these limits correspond to west, east,
134 south, and north and you may specify them in decimal degrees or
135 in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left
136 and upper right map coordinates are given instead of w/e/s/n.
137 The two shorthands -Rg and -Rd stand for global domain (0/360
138 and -180/+180 in longitude respectively, with -90/+90 in lati‐
139 tude). For calendar time coordinates you may either give (a)
140 relative time (relative to the selected TIME_EPOCH and in the
141 selected TIME_UNIT; append t to -JX|x), or (b) absolute time of
142 the form [date]T[clock] (append T to -JX|x). At least one of
143 date and clock must be present; the T is always required. The
144 date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
145 calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
146 string must be of the form hh:mm:ss[.xxx]. The use of delim‐
147 iters and their type and positions must be exactly as indicated
148 (however, input, output and plot formats are customizable; see
149 gmtdefaults). You may ask to project only a subset of the grid
150 by specifying a smaller input w/e/s/n region [Default is the
151 region given by the grid file].
152
153 -S Select the interpolation mode by adding b for B-spline smooth‐
154 ing, c for bicubic interpolation, l for bilinear interpolation,
155 or n for nearest-neighbor value (for example to plot categorical
156 data). Optionally, prepend - to switch off antialiasing. Add
157 /threshold to control how close to nodes with NaNs the interpo‐
158 lation will go. A threshold of 1.0 requires all (4 or 16) nodes
159 involved in interpolation to be non-NaN. 0.5 will interpolate
160 about half way from a non-NaN value; 0.1 will go about 90% of
161 the way, etc. [Default is bicubic interpolation with antialias‐
162 ing and a threshold of 0.5].
163
164 -V Selects verbose mode, which will send progress reports to stderr
165 [Default runs "silently"].
166
168 By default GMT writes out grid as single precision floats in a COARDS-
169 complaint netCDF file format. However, GMT is able to produce grid
170 files in many other commonly used grid file formats and also facili‐
171 tates so called "packing" of grids, writing out floating point data as
172 2- or 4-byte integers. To specify the precision, scale and offset, the
173 user should add the suffix =id[/scale/offset[/nan]], where id is a two-
174 letter identifier of the grid type and precision, and scale and offset
175 are optional scale factor and offset to be applied to all grid values,
176 and nan is the value used to indicate missing data. When reading
177 grids, the format is generally automatically recognized. If not, the
178 same suffix can be added to input grid file names. See grdreformat(1)
179 and Section 4.17 of the GMT Technical Reference and Cookbook for more
180 information.
181
182 When reading a netCDF file that contains multiple grids, GMT will read,
183 by default, the first 2-dimensional grid that can find in that file. To
184 coax GMT into reading another multi-dimensional variable in the grid
185 file, append ?varname to the file name, where varname is the name of
186 the variable. Note that you may need to escape the special meaning of ?
187 in your shell program by putting a backslash in front of it, or by
188 placing the filename and suffix between quotes or double quotes. The
189 ?varname suffix can also be used for output grids to specify a variable
190 name different from the default: "z". See grdreformat(1) and Section
191 4.18 of the GMT Technical Reference and Cookbook for more information,
192 particularly on how to read splices of 3-, 4-, or 5-dimensional grids.
193
195 To transform the geographical grid dbdb5.grd onto a pixel Mercator grid
196 at 300 dpi, run
197
198 grdproject dbdb5.grd -R20/50/12/25 -Jm0.25i -E300 -F -Gdbdb5_merc.grd
199
200 To inversely transform the file topo_tm.grd back onto a geographical
201 grid, use
202
203 grdproject topo_tm.grd -R-80/-70/20/40 -Jt-75/1:500000 -I -D5m -V
204 -Gtopo.grd
205
206 This assumes, of course, that the coordinates in topo_tm.grd were cre‐
207 ated with the same projection parameters.
208 To inversely transform the file topo_utm.grd (which is in UTM meters)
209 back to a geographical grid we specify a one-to-one mapping with meter
210 as the measure unit:
211
212 grdproject topo_utm.grd -R203/205/60/65 -Ju5/1:1 -I -Mm -V -Gtopo.grd
213
215 The boundaries of a projected (rectangular) data set will not necessar‐
216 ily give rectangular geographical boundaries (Mercator is one excep‐
217 tion). In those cases some nodes may be unconstrained (set to NaN).
218 To get a full grid back, your input grid may have to cover a larger
219 area than you are interrested in.
220
222 GMT(1), gmtdefaults(1), mapproject(1)
223
224
225
226GMT 4.3.1 15 May 2008 GRDPROJECT(1)