---
name: "sample1d"
section: "1"
platform: "linux"
package: "gmt-manpages"
version: "3.4-1"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/sample1d"
---

# sample1d(1)

Resampling of 1-D data sets

## NAME

sample1d - Resampling of 1-D data sets

## SYNOPSIS

**sample1d** *infile* \[ **-Fl\|a\|c** \] \[ **-H**\[*nrec*\] \] \[ **-I***xinc* \] \[ **-M**\[*flag*\] \] \[ **-N***knotfile* \] \[ **-S***xstart* \] \[ **-T***x-col*\] \[ **-V \] \[ -bi\[s\]\[***n***\] \] \[ -bo\[s\] \]**

## DESCRIPTION

**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.**

## 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 .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\].**

## EXAMPLES

**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**

## SEE ALSO

*gmt*(l), *filter1d*(l)
