Resampling of 1-d data sets
sample1d infile [ -Fl|a|c ] [ -H[nrec] ] [ -Ixinc ] [ -M[flag] ] [ -Nknotfile ] [ -Sxstart ] [ -Tx-col] [ -V ] [ -bi[s][n] ] [ -bo[s][n] ]
sample1d reads a multi-column ASCII [or binary] data set from file [or standard input] and resamples 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.
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.
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 .gmtdefaults file.
-H
Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults file. If used, GMT default is 1 header record.
-I
xinc defines the sampling interval. [Default is the separation between the first and second abcissa 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 double]. Append n for the number of columns in the binary file(s). [Default is 2 (or at least the number of columns implied by -T].
-bo
Selects binary output. Append s for single precision [Default is double].
To resample the file profiles.tdgmb, which contains (time,distance,gravity,magnetics,bathymetry) records, at 1km equidistant intervals using Akima's spline, try'
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, try
sample1d depths.dt -Ngrav_pos.dg -Fc > new_depths.dt
gmt(1gmt), filter1d(1gmt)