1GRDTRACK(1)                  Generic Mapping Tools                 GRDTRACK(1)
2
3
4

NAME

6       grdtrack  - Sampling of a 2-D grid file along 1-D trackline (a sequence
7       of x,y points)
8

SYNOPSIS

10       grdtrack xyfile -Ggrdfile [ -H[i][nrec] ] [ -Lflag ] [ -M[i|o][flag]  ]
11       [  -Q[b|c|l|n][[/]threshold]  ] [ -Rwest/east/south/north[r] ] [ -S ] [
12       -V ] [ -Z ]  [  -:[i|o]  ]  [  -b[i|o][s|S|d|D[ncol]|c[var1/...]]  ]  [
13       -f[i|o]colinfo ]
14

DESCRIPTION

16       grdtrack  reads  a grid file (or a Sandwell/Smith IMG file) and a table
17       (from file or standard input) with (x,y) positions  in  the  first  two
18       columns  (more columns may be present). It interpolates the grid at the
19       positions in the table and writes out the table with  the  interpolated
20       values  added as a new column.  A bicubic [Default], bilinear, B-spline
21       or nearest-neighbor (see -Q) interpolation is used, requiring  boundary
22       conditions at the limits of the region (see -L).
23
24       xyfile This is an ASCII (or binary, see -b) file where the first 2 col‐
25              umns hold the (x,y) positions where the user wants to sample the
26              2-D data set.
27
28       -G     grdfile  is a 2-D binary grid file with the function f(x,y).  If
29              the specified grid is in Sandwell/Smith Mercator format you must
30              append a comma-separated list of arguments that includes a scale
31              to multiply the data (usually 1 or 0.1), the  mode  which  stand
32              for  the  following:  (0)  Img  files  with  no constraint code,
33              returns data at all points, (1) Img file with constraints coded,
34              return  data at all points, (2) Img file with constraints coded,
35              return data only at constrained points and  NaN  elsewhere,  and
36              (3) Img file with constraints coded, return 1 at constraints and
37              0 elsewhere, and optionally the max latitude  in  the  IMG  file
38              [72.0059773539].  (See GRID FILE FORMAT below.)
39

OPTIONS

41       No space between the option flag and the associated arguments.
42
43       -H     Input  file(s)  has  Header record(s).  Number of header records
44              can be changed by editing your .gmtdefaults4 file.  If used, GMT
45              default  is  1  header record. Use -Hi if only input data should
46              have header records [Default will write out  header  records  if
47              the input data have them]. Blank lines and lines starting with #
48              are always skipped.
49
50       -L     Boundary condition flag may be x or y or xy indicating  data  is
51              periodic  in range of x or y or both set by -R, or flag may be g
52              indicating geographical conditions (x and y are  lon  and  lat).
53              [Default  uses  "natural"  conditions (second partial derivative
54              normal to edge is zero) unless the grid is automatically  recog‐
55              nised as periodic.]
56
57       -M     Multiple  segment file.  Segment separator is a record beginning
58              with flag.  [Default is '>'].
59
60       -Q     Quick mode,  use  bilinear  rather  than  bicubic  interpolation
61              [Default].   Alternatively,  select  the  interpolation  mode by
62              adding b for B-spline smooting, c for bicubic  interpolation,  l
63              for  bilinear  interpolation  or  n  for nearest-neighbor value.
64              Optionally, append threshold in the range [0,1].  This parameter
65              controls  how  close  to nodes with NaN values the interpolation
66              will go.  E.g., a threshold of 0.5 will interpolate  about  half
67              way  from a non-NaN to a NaN node, whereas 0.1 will go about 90%
68              of the way, etc. [Default is 1, which means none of  the  (4  or
69              16) nearby nodes may be NaN].  -Q0 will just return the value of
70              the nearest node instead of interpolating.  This is the same  as
71              using -Qn.
72
73       -R     xmin,  xmax, ymin, and ymax specify the Region of interest.  For
74              geographic regions,  these  limits  correspond  to  west,  east,
75              south,  and north and you may specify them in decimal degrees or
76              in [+-]dd:mm[:ss.xxx][W|E|S|N] format.  Append r if  lower  left
77              and  upper  right  map coordinates are given instead of w/e/s/n.
78              The two shorthands -Rg and -Rd stand for  global  domain  (0/360
79              and  -180/+180  in longitude respectively, with -90/+90 in lati‐
80              tude).  For calendar time coordinates you may  either  give  (a)
81              relative  time  (relative  to the selected TIME_EPOCH and in the
82              selected TIME_UNIT; append t to -JX|x), or (b) absolute time  of
83              the  form  [date]T[clock]  (append T to -JX|x).  At least one of
84              date and clock must be present; the T is always  required.   The
85              date  string  must  be  of the form [-]yyyy[-mm[-dd]] (Gregorian
86              calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
87              string  must  be  of the form hh:mm:ss[.xxx].  The use of delim‐
88              iters and their type and positions must be exactly as  indicated
89              (however,  input,  output and plot formats are customizable; see
90              gmtdefaults).
91
92       -S     Suppress the output of interpolated points that  result  in  NaN
93              values.
94
95       -V     Selects verbose mode, which will send progress reports to stderr
96              [Default runs "silently"].
97
98       -Z     Only write out the sampled z-values  [Default  writes  all  col‐
99              umns].
100
101       -:     Toggles  between  (longitude,latitude)  and (latitude,longitude)
102              input/output.  [Default is (longitude,latitude)].
103
104       -bi    Selects binary input.  Append s for single precision [Default is
105              d  (double)].   Uppercase  S  or  D  will  force  byte-swapping.
106              Optionally, append ncol, the number of columns  in  your  binary
107              input  file if it exceeds the columns needed by the program.  Or
108              append c  if  the  input  file  is  netCDF.  Optionally,  append
109              var1/var2/...  to specify the variables to be read.  [Default is
110              2 input columns].
111
112       -bo    Selects binary output.  Append s for single  precision  [Default
113              is  d  (double)].   Uppercase  S  or D will force byte-swapping.
114              Optionally, append ncol, the number of desired columns  in  your
115              binary output file.  [Default is one more than input].
116
117       -f     Special  formatting of input and/or output columns (time or geo‐
118              graphical data).  Specify i or o to  make  this  apply  only  to
119              input  or  output  [Default  applies to both].  Give one or more
120              columns (or column ranges) separated by commas.  Append T (abso‐
121              lute  calendar time), t (relative time in chosen TIME_UNIT since
122              TIME_EPOCH), x (longitude), y (latitude), or f (floating  point)
123              to  each  column or column range item.  Shorthand -f[i|o]g means
124              -f[i|o]0x,1y (geographic coordinates).
125

ASCII FORMAT PRECISION

127       The ASCII output formats of numerical data are controlled by parameters
128       in  your  .gmtdefaults4  file.   Longitude  and  latitude are formatted
129       according to OUTPUT_DEGREE_FORMAT, whereas other values  are  formatted
130       according  to D_FORMAT.  Be aware that the format in effect can lead to
131       loss of precision in the output, which can  lead  to  various  problems
132       downstream.   If  you find the output is not written with enough preci‐
133       sion, consider switching to binary output (-bo if available) or specify
134       more decimals using the D_FORMAT setting.
135

GRID FILE FORMATS

137       GMT  is  able to recognize many of the commonly used grid file formats,
138       as well as the precision, scale and offset of the values  contained  in
139       the  grid file. When GMT needs a little help with that, you can add the
140       suffix =id[/scale/offset[/nan]], where id is a two-letter identifier of
141       the  grid  type  and precision, and scale and offset are optional scale
142       factor and offset to be applied to all grid  values,  and  nan  is  the
143       value  used  to  indicate missing data.  See grdreformat(1) and Section
144       4.17 of the GMT Technical Reference and Cookbook for more information.
145
146       When reading a netCDF file that contains multiple grids, GMT will read,
147       by default, the first 2-dimensional grid that can find in that file. To
148       coax GMT into reading another multi-dimensional variable  in  the  grid
149       file,  append  ?varname  to the file name, where varname is the name of
150       the variable. Note that you may need to escape the special meaning of ?
151       in  your  shell  program  by  putting a backslash in front of it, or by
152       placing the filename and suffix between quotes or double  quotes.   See
153       grdreformat(1)  and  Section  4.18  of  the GMT Technical Reference and
154       Cookbook for more information, particularly on how to read  splices  of
155       3-, 4-, or 5-dimensional grids.
156

HINTS

158       If  an  interpolation  point is not on a node of the input grid, then a
159       NaN at any node in the neighborhood surrounding the point will yield an
160       interpolated  NaN.   Bicubic  interpolation [default] yields continuous
161       first derivatives but requires a neighborhood of 4 nodes  by  4  nodes.
162       Bilinear interpolation [-Q] uses only a 2 by 2 neighborhood, but yields
163       only zeroth-order continuity.  Use bicubic when  smoothness  is  impor‐
164       tant.   Use  bilinear  to  minimize  the  propagation of NaNs, or lower
165       threshold.
166

EXAMPLES

168       To sample the file hawaii_topo.grd along the SEASAT  track  track_4.xyg
169       (An  ASCII  table  containing  longitude,  latitude, and SEASAT-derived
170       gravity, preceded by one header record):
171
172       grdtrack track_4.xyg -Ghawaii_topo.grd -H > track_4.xygt
173
174       To sample the Sandwell/Smith IMG format  file  topo.8.2.img  (2  minute
175       predicted  bathymetry on a Mercator grid) along the lon,lat coordinates
176       given in the file cruise_track.xy, try
177
178       grdtrack cruise_track.xy -Gtopo.8.2.img,1,1 > obs_and_predicted.d
179

SEE ALSO

181       GMT(1), surface(1), sample1d(1)
182
183
184
185GMT 4.3.1                         15 May 2008                      GRDTRACK(1)
Impressum