GRDTRACK

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ASCII FORMAT PRECISION
HINTS
EXAMPLES
SEE ALSO

NAME

grdtrack − Sampling of a 2-D grdfile along 1-D trackline (a sequence of x,y points)

SYNOPSIS

grdtrack xyfile −Ggrdfile [ −H[i][nrec] ] [ −Lflag ] [ −M[i|o][flag] ] [ −Q[value] [ −Rwest/east/south/north[r] ] [ −S ] [ −V ] [ −Z ] [ −:[i|o] ] [ −b[i|o][s|S|d|D][ncol] ] [ −f[i|o]colinfo ]

DESCRIPTION

grdtrack reads a grdfile (or a Sandwell/Smith IMG file) and a table (from file or standard input) with (x,y) positions in the first two columns (more columns may be present). It interpolates the grid at the positions in the table and writes out the table with the interpolated values added as a new column. A bicubic [Default] or bilinear [−Q] interpolation is used, requiring boundary conditions at the limits of the region (see −L).

xyfile

This is an ASCII [or binary, see −b] file where the first 2 columns hold the (x,y) positions where the user wants to sample the 2-D data set.

−G

grdfile is a 2-D binary grd file with the function f(x,y). If the specified grid is in Sandwell/Smith Mercator format you must append a comma-separated list of arguments that includes a scale to multiply the data (usually 1 or 0.1), the mode which stand for the following: (0) Img files with no constraint code, returns data at all points, (1) Img file with constraints coded, return data at all points, (2) Img file with constraints coded, return data only at constrained points and NaN elsewhere, and (3) Img file with constraints coded, return 1 at constraints and 0 elsewhere, and optionally the max latitude in the IMG file [72.0059773539].

OPTIONS

No space between the option flag and the associated arguments.

−H

Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults4 file. If used, GMT default is 1 header record. Use −Hi if only input data should have header records [Default will write out header records if the input data have them].

−L

Boundary condition flag may be x or y or xy indicating data is periodic in range of x or y or both set by −R, or flag may be g indicating geographical conditions (x and y are lon and lat). [Default uses "natural" conditions (second partial derivative normal to edge is zero).]

−M

Multiple segment file. Segment separator is a record beginning with flag. [Default is ’>’].

−Q

Quick mode, use bilinear rather than bicubic interpolation [Default]. Optionally, append value in the 0 <= value <= 1 range. This parameter controls how close to nodes with NaN values the interpolation will go. E.g., a value of 0.5 will interpolate about 1/2-way from a non-NaN to a NaN node, whereas 0.1 will go about 90% of the way, etc. [Default is 1, which means none of the four nearby nodes may be NaN]. A value of 0 will just return the value of the nearest node instead of interpolating.

−R

xmin, xmax, ymin, and ymax specify the Region of interest. For geographic regions, these limits correspond to west, east, south, and north and you may specify them in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of wesn. The two shorthands −Rg −Rd stand for global domain (0/360 or -180/+180 in longitude respectively, with -90/+90 in latitude). For calendar time coordinates you may either give relative time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to −JX|x), or absolute time of the form [date]T[clock] (append T to −JX|x). At least one of date and clock must be present; the T is always required. The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock string must be of the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be as indicated (however, input/output and plotting formats are flexible).

−S

Suppress the output of interpolated points that result in NaN values.

−V

Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].

−Z

Only write out the sampled z-values [Default writes all columns].

−:

Toggles between (longitude,latitude) and (latitude,longitude) input/output. [Default is (longitude,latitude)].

−bi

Selects binary input. Append s for single precision [Default is d (double)]. Uppercase S (or D) will force byte-swapping. Optionally, append ncol, the number of columns in your binary file if it exceeds the columns needed by the program. [Default is 2 input columns].

−bo

Selects binary output. Append s for single precision [Default is d (double)]. Uppercase S (or D) will force byte-swapping. Optionally, append ncol, the number of desired columns in your binary output file. [Default is one more than input].

−f

Special formatting of input and output columns (time or geographical data). Specify i(nput) or o(utput) [Default is both input and output]. Give one or more columns (or column ranges) separated by commas. Append T (Absolute calendar time), t (time relative to chosen TIME_EPOCH), x (longitude), y (latitude), or f (floating point) to each column or column range item. Shorthand −f[i|o]g means −f[i|o]0x,1y (geographic coordinates).

ASCII FORMAT PRECISION

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

HINTS

If an interpolation point is not on a node of the input grid, then a NaN at any node in the neighborhood surrounding the point will yield an interpolated NaN. Bicubic interpolation [default] yields continuous first derivatives but requires a neighborhood of 4 nodes by 4 nodes. Bilinear interpolation [−Q] uses only a 2 by 2 neighborhood, but yields only zeroth-order continuity. Use bicubic when smoothness is important. Use bilinear to minimize the propagation of NaNs.

EXAMPLES

To sample the file hawaii_topo.grd along the SEASAT track track_4.xyg (An ASCII table containing longitude, latitude, and SEASAT-derived gravity, preceded by one header record):

grdtrack track_4.xyg −Ghawaii_topo.grd −H > track_4.xygt

To sample the Sandwell/Smith IMG format file topo.8.2.img (2 minute predicted bathymetry on a Mercator grid) along the lon,lat coordinates given in the file cruise_track.xy, try

grdtrack cruise_track.xy −Gtopo.8.2.img,1,1 > obs_and_predicted.d

SEE ALSO

GMT(l), surface(l), sample1d(l)