sample1d

Langue: en

Version: 369971 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

NAME

sample1d - Resampling of 1-D data sets

SYNOPSIS

sample1d infile [ -Fl|a|c|n ] [ -H[i][nrec] ] [ -Ixinc ] [ -Nknotfile ] [ -Sxstart ] [ -Tx_col] [ -V ] [ -b[i|o][s|S|d|D[ncol]|c[var1/...]] ] [ -f[i|o]colinfo ] [ -m[i|o][flag] ]

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), c (natural cubic spline), and n (no interpolation: nearest point) [Default is -Fa]. You may change the default interpolant; see INTERPOLANT in your .gmtdefaults4 file.
-H
Input file(s) has header record(s). If used, the default number of header records is N_HEADER_RECS. Use -Hi if only input data should have header records [Default will write out header records if the input data have them]. Blank lines and lines starting with # are always skipped.
-I
xinc defines the sampling interval. [Default is the separation between the first and second abscissa point in the infile]
-N
knotfile is an optional ASCII file with the x locations where the data set will be resampled in the first column. Note: if -H is selected it applies to both infile and knotfile.
-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 input file if it exceeds the columns needed by the program. Or append c if the input file is netCDF. Optionally, append var1/var2/... to specify the variables to be read. [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/or output columns (time or geographical data). Specify i or o to make this apply only to input or output [Default applies to both]. Give one or more columns (or column ranges) separated by commas. Append T (absolute calendar time), t (relative time in chosen TIME_UNIT since 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).
-m
Multiple segment file(s). Segments are separated by a special record. For ASCII files the first character must be flag [Default is '>']. For binary files all fields must be NaN and -b must set the number of output columns explicitly. By default the -m setting applies to both input and output. Use -mi and -mo to give separate settings to input and output.

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.

CALENDAR TIME SAMPLING

If the abscissa are calendar times then you must use the -f option to indicate this. Furthermore, -I then expects an increment in the current TIME_UNIT units. There is not yet support for variable intervals such as months.

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(1), filter1d(1)