SAMPLE1D

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ASCII FORMAT PRECISION
EXAMPLES
SEE ALSO

NAME

sample1d − Resampling of 1-D data sets

SYNOPSIS

sample1d infile [ −Fl|a|c ] [ −H[i][nrec] ] [ −Ixinc ] [ −M[i|o][flag] ] [ −Nknotfile ] [ −Sxstart ] [ −Tx_col] [ −V ] [ −b[i|o][s|S|d|D][ncol] ] [ −f[i|o]colinfo ]

DESCRIPTION

sample1d reads a multi-column ASCII [or binary] data set from file [or standard input] and interpolates the timeseries/profile at locations where the user needs the values. The user must provide the column number of the independent (monotonically increasing or decreasing) variable. Equidistant or arbitrary sampling can be selected. All columns are resampled based on the new sampling interval. Several interpolation schemes are available. Extrapolation outside the range of the input data is not supported.

infile

This is a multi-column ASCII [of binary, see −b] file with one column containing the independent variable (which must be monotonically in/de-creasing) and the remaining columns holding misc. data values. If no file is provided, sample1d reads from standard input.

OPTIONS

No space between the option flag and the associated arguments.

−F

Choose from l (Linear), a (Akima spline), and c (natural cubic spline) [Default is −Fa]. You may change the default interpolant; see INTERPOLANT in your .gmtdefaults4 file.

−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].

−I

xinc defines the sampling interval. [Default is the separation between the first and second abscissa point in the infile]

−M

Multiple segment file. Segments are separated by a record whose first character is flag. [Default is ’>’].

−N

knotfile is an optional ASCII file with the x locations where the data set will be resampled in the first column

−S

For equidistant sampling, xstart indicates the location of the first output value. [Default is the smallest even multiple of xinc inside the range of infile]

−T

Sets the column number of the independent variable [Default is 0 (first)].

−V

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

−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 (or at least the number of columns implied by −T)].

−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 same as 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.

EXAMPLES

To resample the file profiles.tdgmb, which contains (time,distance,gravity,magnetics,bathymetry) records, at 1km equidistant intervals using Akima’s spline, use

sample1d profiles.tdgmb −I1 −Fa −T1 > profiles_equi_d.tdgmb

To resample the file depths.dt at positions listed in the file grav_pos.dg, using a cubic spline for the interpolation, use

sample1d depths.dt −Ngrav_pos.dg −Fc > new_depths.dt

SEE ALSO

GMT(l), filter1d(l)