OnWorks favicon

sample1dgmt - Online in the Cloud

Run sample1dgmt in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command sample1dgmt that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



sample1d - Resample 1-D table data using splines


sample1d [ table ] [ f|p|m|r|R[+l] ] [ l|a|c|n[+1|+2] ] [ inc[unit] ] [ knotfile ] [
start[/stop] ] [ col ] [ [level] ] [ -b<binary> ] [ -d<nodata> ] [ -f<flags> ] [ -g<gaps>
] [ -h<headers> ] [ -i<flags> ] [ -o<flags> ]

Note: No space is allowed between the option flag and the associated arguments.


sample1d reads a multi-column ASCII [or binary] data set from file [or standard input] and
interpolates the time-series or spatial 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.




table This is one or more ASCII [of binary, see -bi] files with one column containing the
independent variable (which must be monotonically in/de-creasing) and the remaining
columns holding other data values. If no file is provided, sample1d reads from
standard input.

For track resampling (if -T...unit is set) we can select how this is to be
performed. Append f to keep original points, but add intermediate points if needed;
note this selection does not necessarily yield equidistant points [Default], m as
f, but first follow meridian (along y) then parallel (along x), p as f, but first
follow parallel (along y) then meridian (along x), r to resample at equidistant
locations; input points are not necessarily included in the output, and R as r, but
adjust given spacing to fit the track length exactly. Finally, append +l if
distances should be measured along rhumb lines (loxodromes).

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 GMT_INTERPOLANT in your gmt.conf file. You may optionally
evaluate the first or second derivative of the spline by appending 1 or 2,

inc defines the sampling interval [Default is the separation between the first and
second abscissa point in the table]. Append a distance unit (see UNITS) to indicate
that the first two columns contain longitude, latitude and you wish to resample
this path with a spacing of inc in the chosen units. For sampling of (x, y)
Cartesian tracks, specify the unit as c. Use -A to control how path resampling is

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 table and
knotfile. Also note that -i never applies to knotfile since we always consider the
first column only.

For equidistant sampling, start indicates the location of the first output value.
[Default is the smallest even multiple of inc inside the range of table].
Optionally, append /stop to indicate the location of the last output value [Default
is the largest even multiple of inc inside the range of table].

-Tcol Sets the column number of the independent variable [Default is 0 (first)].

-V[level] (more ...)
Select verbosity level [c].

-bi[ncols][t] (more ...)
Select native binary input. [Default is 2 (or at least the number of columns
implied by -T)].

-bo[ncols][type] (more ...)
Select native binary output. [Default is same as input].

-d[i|o]nodata (more ...)
Replace input columns that equal nodata with NaN and do the reverse on output.

-f[i|o]colinfo (more ...)
Specify data types of input and/or output columns.

-g[a]x|y|d|X|Y|D|[col]z[+|-]gap[u] (more ...)
Determine data gaps and line breaks.

-h[i|o][n][+c][+d][+rremark][+rtitle] (more ...)
Skip or produce header record(s).

-icols[l][sscale][ooffset][,...] (more ...)
Select input columns (0 is first column).

-ocols[,...] (more ...)
Select output columns (0 is first column).

-^ or just -
Print a short message about the syntax of the command, then exits (NOTE: on Windows
use just -).

-+ or just +
Print an extensive usage (help) message, including the explanation of any
module-specific option (but not the GMT common options), then exits.

-? or no arguments
Print a complete usage (help) message, including the explanation of options, then

Print GMT version and exit.

Print full path to GMT share directory and exit.


For map distance unit, append unit d for arc degree, m for arc minute, and s for arc
second, or e for meter [Default], f for foot, k for km, M for statute mile, n for nautical
mile, and u for US survey foot. By default we compute such distances using a spherical
approximation with great circles. Prepend - to a distance (or the unit is no distance is
given) to perform "Flat Earth" calculations (quicker but less accurate) or prepend + to
perform exact geodesic calculations (slower but more accurate).


The ASCII output formats of numerical data are controlled by parameters in your gmt.conf
file. Longitude and latitude are formatted according to FORMAT_GEO_OUT, whereas other
values are formatted according to FORMAT_FLOAT_OUT. 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 FORMAT_FLOAT_OUT setting.


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.


To resample the file profiles.tdgmb, which contains
(time,distance,gravity,magnetics,bathymetry) records, at 1km equidistant intervals using
Akima's spline, use

gmt 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

gmt sample1d depths.dt -Ngrav_pos.dg -Fc > new_depths.dt

To resample the file points.txt every 0.01 from 0-6, using a cubic spline for the
interpolation, but output the first derivative instead (the slope), try

gmt sample1d points.txt S0/6 -I0.01 -Fc+1 > slopes.txt

To resample the file track.txt which contains lon, lat, depth every 2 nautical miles, use

gmt sample1d track.txt -I2n -AR > new_track.dt

To do approximately the same, but make sure the original points are included, use

gmt sample1d track.txt -I2n -Af > new_track.dt

To obtain a rhumb line (loxodrome) sampled every 5 km instead, use

gmt sample1d track.txt -I5k -AR+l > new_track.dt

Use sample1dgmt online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    KompoZer is a wysiwyg HTML editor using
    the Mozilla Composer codebase. As
    Nvu's development has been stopped
    in 2005, KompoZer fixes many bugs and
    adds a f...
    Download KompoZer
  • 2
    Free Manga Downloader
    Free Manga Downloader
    The Free Manga Downloader (FMD) is an
    open source application written in
    Object-Pascal for managing and
    downloading manga from various websites.
    This is a mirr...
    Download Free Manga Downloader
  • 3
    UNetbootin allows you to create bootable
    Live USB drives for Ubuntu, Fedora, and
    other Linux distributions without
    burning a CD. It runs on Windows, Linux,
    and ...
    Download UNetbootin
  • 4
    Dolibarr ERP - CRM
    Dolibarr ERP - CRM
    Dolibarr ERP - CRM is an easy to use
    ERP and CRM open source software package
    (run with a web php server or as
    standalone software) for businesses,
    Download Dolibarr ERP - CRM
  • 5
    SQuirreL SQL Client
    SQuirreL SQL Client
    SQuirreL SQL Client is a graphical SQL
    client written in Java that will allow
    you to view the structure of a JDBC
    compliant database, browse the data in
    Download SQuirreL SQL Client
  • 6
    Brackets is a free, modern open-source
    text editor made especially for Web
    Development. Written in HTML, CSS, and
    JavaScript with focused visual tools and
    Download Brackets
  • 7
    Free Pascal Compiler
    Free Pascal Compiler
    A 32/64/16-bit Pascal compiler for
    Win32/64/CE, Linux, Mac OS X/iOS,
    Android, FreeBSD, OS/2, Game Boy
    Advance, Nintendo NDS and DOS;
    semantically compatible wi...
    Download Free Pascal Compiler
  • More »

Linux commands