.TH SAMPLE1D 1gmt "15 Jul 2011" "GMT 4.5.7" "Generic Mapping Tools" .SH NAME sample1d \- Resampling of 1-D data sets .SH SYNOPSIS \fBsample1d\fP \fIinfile\fP [ \fB\-Fl\fP|\fBa\fP|\fBc\fP|\fBn\fP ] [ \fB\-H\fP[\fBi\fP][\fInrec\fP] ] [ \fB\-I\fP\fIxinc\fP ] [ \fB\-N\fP\fIknotfile\fP ] [ \fB\-S\fP\fIxstart\fP ] [ \fB\-T\fP\fIx_col\fP ] [ \fB\-V\fP ] [ \fB\-b\fP[\fBi\fP|\fBo\fP][\fBs\fP|\fBS\fP|\fBd\fP|\fBD\fP[\fIncol\fP]|\fBc\fP[\fIvar1\fP\fB/\fP\fI...\fP]] ] [ \fB\-f\fP[\fBi\fP|\fBo\fP]\fIcolinfo\fP ] [ \fB\-m\fP[\fBi\fP|\fBo\fP][\fIflag\fP] ] .SH DESCRIPTION \fBsample1d\fP 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 \fBor\fP 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. .TP \fIinfile\fP This is a multi-column ASCII [of binary, see \fB\-b\fP] 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, \fBsample1d\fP reads from standard input. .SH OPTIONS No space between the option flag and the associated arguments. .TP \fB\-F\fP Choose from \fBl\fP (Linear), \fBa\fP (Akima spline), \fBc\fP (natural cubic spline), and \fBn\fP (no interpolation: nearest point) [Default is \fB\-Fa\fP]. You may change the default interpolant; see \fBINTERPOLANT\fP in your \.gmtdefaults4 file. .TP \fB\-H\fP Input file(s) has header record(s). If used, the default number of header records is \fBN_HEADER_RECS\fP. Use \fB\-Hi\fP 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. .TP \fB\-I\fP \fIxinc\fP defines the sampling interval. [Default is the separation between the first and second abscissa point in the \fIinfile\fP] .TP \fB\-N\fP \fIknotfile\fP is an optional ASCII file with the x locations where the data set will be resampled in the first column. Note: if \fB\-H\fP is selected it applies to both \fIinfile\fP and \fIknotfile\fP. .TP \fB\-S\fP For equidistant sampling, \fIxstart\fP indicates the location of the first output value. [Default is the smallest even multiple of \fIxinc\fP inside the range of \fIinfile\fP] .TP \fB\-T\fP Sets the column number of the independent variable [Default is 0 (first)]. .TP \fB\-V\fP Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. .TP \fB\-bi\fP Selects binary input. Append \fBs\fP for single precision [Default is \fBd\fP (double)]. Uppercase \fBS\fP or \fBD\fP will force byte-swapping. Optionally, append \fIncol\fP, the number of columns in your binary input file if it exceeds the columns needed by the program. Or append \fBc\fP if the input file is netCDF. Optionally, append \fIvar1\fP\fB/\fP\fIvar2\fP\fB/\fP\fI...\fP to specify the variables to be read. [Default is 2 (or at least the number of columns implied by \fB\-T\fP)]. .TP \fB\-bo\fP Selects binary output. Append \fBs\fP for single precision [Default is \fBd\fP (double)]. Uppercase \fBS\fP or \fBD\fP will force byte-swapping. Optionally, append \fIncol\fP, the number of desired columns in your binary output file. [Default is same as input]. .TP \fB\-f\fP Special formatting of input and/or output columns (time or geographical data). Specify \fBi\fP or \fBo\fP 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 \fBT\fP (absolute calendar time), \fBt\fP (relative time in chosen \fBTIME_UNIT\fP since \fBTIME_EPOCH\fP), \fBx\fP (longitude), \fBy\fP (latitude), or \fBf\fP (floating point) to each column or column range item. Shorthand \fB\-f\fP[\fBi\fP|\fBo\fP]\fBg\fP means \fB\-f\fP[\fBi\fP|\fBo\fP]0\fBx\fP,1\fBy\fP (geographic coordinates). .TP \fB\-m\fP Multiple segment file(s). Segments are separated by a special record. For ASCII files the first character must be \fIflag\fP [Default is '>']. For binary files all fields must be NaN and \fB\-b\fP must set the number of output columns explicitly. By default the \fB\-m\fP setting applies to both input and output. Use \fB\-mi\fP and \fB\-mo\fP to give separate settings to input and output. .SH 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 \fBOUTPUT_DEGREE_FORMAT\fP, whereas other values are formatted according to \fBD_FORMAT\fP. 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 (\fB\-bo\fP if available) or specify more decimals using the \fBD_FORMAT\fP setting. .SH CALENDAR TIME SAMPLING If the abscissa are calendar times then you must use the \fB\-f\fP option to indicate this. Furthermore, \fB\-I\fP then expects an increment in the current \fBTIME_UNIT\fP units. There is not yet support for variable intervals such as months. .SH EXAMPLES To resample the file profiles.tdgmb, which contains (time,distance,gravity,magnetics,bathymetry) records, at 1km equidistant intervals using Akima's spline, use\"' .br .sp \fBsample1d\fP profiles.tdgmb \fB\-I\fP1 \fB\-Fa\fP \fB\-T\fP1 > profiles_equi_d.tdgmb .br .sp To resample the file depths.dt at positions listed in the file grav_pos.dg, using a cubic spline for the interpolation, use .br .sp \fBsample1d\fP depths.dt \fB\-N\fPgrav_pos.dg \fB\-Fc\fP > new_depths.dt .SH "SEE ALSO" .IR GMT (1), .IR filter1d (1)