1SAMPLE1D(1) GMT SAMPLE1D(1)
2
3
4
6 sample1d - Resample 1-D table data using splines
7
9 sample1d [ table ] [ -Af|p|m|r|R[+l] ] [ -Fl|a|c|n[+1|+2] ] [
10 -Iinc[unit] ] [ -Nknotfile ] [ -Sstart[/stop] ] [ -Tcol ] [
11 -V[level] ] [ -bbinary ] [ -dnodata ] [ -eregexp ] [ -fflags ] [ -ggaps
12 ] [ -hheaders ] [ -iflags ] [ -oflags ]
13
14 Note: No space is allowed between the option flag and the associated
15 arguments.
16
18 sample1d reads a multi-column ASCII [or binary] data set from file [or
19 standard input] and interpolates the time-series or spatial profile at
20 locations where the user needs the values. The user must provide the
21 column number of the independent (monotonically increasing or decreas‐
22 ing) variable, here called time (it may of course be any type of quan‐
23 tity). Equidistant or arbitrary sampling can be selected. All columns
24 are resampled based on the new sampling interval. Several interpolation
25 schemes are available. Extrapolation outside the range of the input
26 data is not supported.
27
29 None.
30
32 table This is one or more ASCII [of binary, see -bi] files with one
33 column containing the independent time variable (which must be
34 monotonically in/de-creasing) and the remaining columns holding
35 other data values. If no file is provided, sample1d reads from
36 standard input.
37
38 -Af|p|m|r|R
39 For track resampling (if -T...unit is set) we can select how
40 this is to be performed. Append f to keep original points, but
41 add intermediate points if needed; note this selection does not
42 necessarily yield equidistant points [Default], m as f, but
43 first follow meridian (along y) then parallel (along x), p as f,
44 but first follow parallel (along y) then meridian (along x), r
45 to resample at equidistant locations; input points are not nec‐
46 essarily included in the output, and R as r, but adjust given
47 spacing to fit the track length exactly. Finally, append +l if
48 distances should be measured along rhumb lines (loxodromes).
49
50 -Fl|a|c|n[+1|+2]
51 Choose from l (Linear), a (Akima spline), c (natural cubic
52 spline), and n (no interpolation: nearest point) [Default is
53 -Fa]. You may change the default interpolant; see GMT_INTER‐
54 POLANT in your gmt.conf file. You may optionally evaluate the
55 first or second derivative of the spline by appending 1 or 2,
56 respectively.
57
58 -Iinc[unit]
59 inc defines the sampling interval [Default is the separation
60 between the first and second abscissa point in the table].
61 Append a distance unit (see UNITS) to indicate that the first
62 two columns contain longitude, latitude and you wish to resample
63 this path with a spacing of inc in the chosen units. For sam‐
64 pling of (x, y) Cartesian tracks, specify the unit as c. Use -A
65 to control how path resampling is performed.
66
67 -Nknotfile
68 knotfile is an optional ASCII file with the time locations where
69 the data set will be resampled in the first column. Note: If -H
70 is selected it applies to both table and knotfile. Also note
71 that -i never applies to knotfile since we always consider the
72 first column only.
73
74 -Sstart[stop]
75 For equidistant sampling, start indicates the time of the first
76 output value. [Default is the smallest even multiple of inc
77 inside the range of table]. Optionally, append /stop to indicate
78 the time of the last output value [Default is the largest even
79 multiple of inc inside the range of table].
80
81 -Tcol Sets the column number of the independent time variable [Default
82 is 0 (first)].
83
84 -V[level] (more ...)
85 Select verbosity level [c].
86
87 -bi[ncols][t] (more ...)
88 Select native binary input. [Default is 2 (or at least the num‐
89 ber of columns implied by -T)].
90
91 -bo[ncols][type] (more ...)
92 Select native binary output. [Default is same as input].
93
94 -d[i|o]nodata (more ...)
95 Replace input columns that equal nodata with NaN and do the
96 reverse on output.
97
98 -e[~]"pattern" | -e[~]/regexp/[i] (more ...)
99 Only accept data records that match the given pattern.
100
101 -f[i|o]colinfo (more ...)
102 Specify data types of input and/or output columns.
103
104 -g[a]x|y|d|X|Y|D|[col]z[+|-]gap[u] (more ...)
105 Determine data gaps and line breaks.
106
107 -h[i|o][n][+c][+d][+rremark][+rtitle] (more ...)
108 Skip or produce header record(s).
109
110 -icols[+l][+sscale][+ooffset][,...] (more ...)
111 Select input columns and transformations (0 is first column).
112
113 -ocols[,...] (more ...)
114 Select output columns (0 is first column).
115
116 -^ or just -
117 Print a short message about the syntax of the command, then
118 exits (NOTE: on Windows just use -).
119
120 -+ or just +
121 Print an extensive usage (help) message, including the explana‐
122 tion of any module-specific option (but not the GMT common
123 options), then exits.
124
125 -? or no arguments
126 Print a complete usage (help) message, including the explanation
127 of all options, then exits.
128
130 For map distance unit, append unit d for arc degree, m for arc minute,
131 and s for arc second, or e for meter [Default], f for foot, k for km, M
132 for statute mile, n for nautical mile, and u for US survey foot. By
133 default we compute such distances using a spherical approximation with
134 great circles. Prepend - to a distance (or the unit is no distance is
135 given) to perform "Flat Earth" calculations (quicker but less accurate)
136 or prepend + to perform exact geodesic calculations (slower but more
137 accurate).
138
140 The ASCII output formats of numerical data are controlled by parameters
141 in your gmt.conf file. Longitude and latitude are formatted according
142 to FORMAT_GEO_OUT, absolute time is under the control of FOR‐
143 MAT_DATE_OUT and FORMAT_CLOCK_OUT, whereas general floating point val‐
144 ues are formatted according to FORMAT_FLOAT_OUT. Be aware that the for‐
145 mat in effect can lead to loss of precision in ASCII output, which can
146 lead to various problems downstream. If you find the output is not
147 written with enough precision, consider switching to binary output (-bo
148 if available) or specify more decimals using the FORMAT_FLOAT_OUT set‐
149 ting.
150
152 If the abscissa are calendar times then you must use the -f option to
153 indicate this. Furthermore, -I then expects an increment in the current
154 TIME_UNIT units. There is not yet support for variable intervals such
155 as months.
156
158 To resample the file profiles.tdgmb, which contains (time,dis‐
159 tance,gravity,magnetics,bathymetry) records, at 1km equidistant inter‐
160 vals using Akima's spline, use
161
162 gmt sample1d profiles.tdgmb -I1 -Fa -T1 > profiles_equi_d.tdgmb
163
164 To resample the file depths.dt at positions listed in the file
165 grav_pos.dg, using a cubic spline for the interpolation, use
166
167 gmt sample1d depths.dt -Ngrav_pos.dg -Fc > new_depths.dt
168
169 To resample the file points.txt every 0.01 from 0-6, using a cubic
170 spline for the interpolation, but output the first derivative instead
171 (the slope), try
172
173 gmt sample1d points.txt S0/6 -I0.01 -Fc+1 > slopes.txt
174
175 To resample the file track.txt which contains lon, lat, depth every 2
176 nautical miles, use
177
178 gmt sample1d track.txt -I2n -AR > new_track.dt
179
180 To do approximately the same, but make sure the original points are
181 included, use
182
183 gmt sample1d track.txt -I2n -Af > new_track.dt
184
185 To obtain a rhumb line (loxodrome) sampled every 5 km instead, use
186
187 gmt sample1d track.txt -I5k -AR+l > new_track.dt
188
190 gmt, gmt.conf, greenspline, filter1d
191
193 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
194
195
196
197
1985.4.5 Feb 24, 2019 SAMPLE1D(1)