1SAMPLE1D(1) Generic Mapping Tools SAMPLE1D(1)
2
3
4
6 sample1d - Resampling of 1-D data sets
7
9 sample1d infile [ -Fl|a|c|n ] [ -H[i][nrec] ] [ -Ixinc ] [ -Nknotfile ]
10 [ -Sxstart ] [ -Tx_col ] [ -V ] [ -b[i|o][s|S|d|D[ncol]|c[var1/...]] ]
11 [ -f[i|o]colinfo ] [ -m[i|o][flag] ]
12
14 sample1d reads a multi-column ASCII [or binary] data set from file [or
15 standard input] and interpolates the timeseries/profile at locations
16 where the user needs the values. The user must provide the column num‐
17 ber of the independent (monotonically increasing or decreasing) vari‐
18 able. Equidistant or arbitrary sampling can be selected. All columns
19 are resampled based on the new sampling interval. Several interpola‐
20 tion schemes are available. Extrapolation outside the range of the
21 input data is not supported.
22
23 infile This is a multi-column ASCII [of binary, see -b] file with one
24 column containing the independent variable (which must be mono‐
25 tonically in/de-creasing) and the remaining columns holding
26 misc. data values. If no file is provided, sample1d reads from
27 standard input.
28
30 No space between the option flag and the associated arguments.
31
32 -F Choose from l (Linear), a (Akima spline), c (natural cubic
33 spline), and n (no interpolation: nearest point) [Default is
34 -Fa]. You may change the default interpolant; see INTERPOLANT
35 in your .gmtdefaults4 file.
36
37 -H Input file(s) has header record(s). If used, the default number
38 of header records is N_HEADER_RECS. Use -Hi if only input data
39 should have header records [Default will write out header
40 records if the input data have them]. Blank lines and lines
41 starting with # are always skipped.
42
43 -I xinc defines the sampling interval. [Default is the separation
44 between the first and second abscissa point in the infile]
45
46 -N knotfile is an optional ASCII file with the x locations where
47 the data set will be resampled in the first column. Note: if -H
48 is selected it applies to both infile and knotfile.
49
50 -S For equidistant sampling, xstart indicates the location of the
51 first output value. [Default is the smallest even multiple of
52 xinc inside the range of infile]
53
54 -T Sets the column number of the independent variable [Default is 0
55 (first)].
56
57 -V Selects verbose mode, which will send progress reports to stderr
58 [Default runs "silently"].
59
60 -bi Selects binary input. Append s for single precision [Default is
61 d (double)]. Uppercase S or D will force byte-swapping.
62 Optionally, append ncol, the number of columns in your binary
63 input file if it exceeds the columns needed by the program. Or
64 append c if the input file is netCDF. Optionally, append
65 var1/var2/... to specify the variables to be read. [Default is
66 2 (or at least the number of columns implied by -T)].
67
68 -bo Selects binary output. Append s for single precision [Default
69 is d (double)]. Uppercase S or D will force byte-swapping.
70 Optionally, append ncol, the number of desired columns in your
71 binary output file. [Default is same as input].
72
73 -f Special formatting of input and/or output columns (time or geo‐
74 graphical data). Specify i or o to make this apply only to
75 input or output [Default applies to both]. Give one or more
76 columns (or column ranges) separated by commas. Append T (abso‐
77 lute calendar time), t (relative time in chosen TIME_UNIT since
78 TIME_EPOCH), x (longitude), y (latitude), or f (floating point)
79 to each column or column range item. Shorthand -f[i|o]g means
80 -f[i|o]0x,1y (geographic coordinates).
81
82 -m Multiple segment file(s). Segments are separated by a special
83 record. For ASCII files the first character must be flag
84 [Default is '>']. For binary files all fields must be NaN and
85 -b must set the number of output columns explicitly. By default
86 the -m setting applies to both input and output. Use -mi and
87 -mo to give separate settings to input and output.
88
90 The ASCII output formats of numerical data are controlled by parameters
91 in your .gmtdefaults4 file. Longitude and latitude are formatted
92 according to OUTPUT_DEGREE_FORMAT, whereas other values are formatted
93 according to D_FORMAT. Be aware that the format in effect can lead to
94 loss of precision in the output, which can lead to various problems
95 downstream. If you find the output is not written with enough preci‐
96 sion, consider switching to binary output (-bo if available) or specify
97 more decimals using the D_FORMAT setting.
98
100 If the abscissa are calendar times then you must use the -f option to
101 indicate this. Furthermore, -I then expects an increment in the cur‐
102 rent TIME_UNIT units. There is not yet support for variable intervals
103 such as months.
104
106 To resample the file profiles.tdgmb, which contains (time,dis‐
107 tance,gravity,magnetics,bathymetry) records, at 1km equidistant inter‐
108 vals using Akima's spline, use
109
110 sample1d profiles.tdgmb -I1 -Fa -T1 > profiles_equi_d.tdgmb
111
112 To resample the file depths.dt at positions listed in the file
113 grav_pos.dg, using a cubic spline for the interpolation, use
114
115 sample1d depths.dt -Ngrav_pos.dg -Fc > new_depths.dt
116
118 GMT(1), filter1d(1)
119
120
121
122GMT 4.5.6 10 Mar 2011 SAMPLE1D(1)