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

ASCII FORMAT PRECISION

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

GRID FILE FORMATS

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

HINTS

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

EXAMPLES

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

SEE ALSO

186       GMT(1), surface(1), sample1d(1)
187
188
189
190GMT 4.5.6                         10 Mar 2011                      GRDTRACK(1)
Impressum