Source code:

https://paloz.marum.de/bitbucket/projects/ESSP/repos/interpolate/browse

Usage
OVERVIEW: A command-line tool to interpolate numerical data from text at
fixed intervals.

This tool reads in rows of text from a file or standard in and
interpolates one or more columns using a selection of interpolation
methods. Results are printed to STDOUT.
Currently only linear, step-wise interpolation is implemented.
A (default) option is provided to integrate interpolation values between
interpolation steps.

There are various options to:
  - select the column for the abscissa ('x'-axis)
  - select the column for the ordinate ('y'-axis), or use 'all' columns
  - set filter to restrict abscissa range to begin/end
  - set first line for start of data (skipping headers)
  - specify interpolation step or use calculated median ∆abscissa
  - provide format string for output

USAGE: interpolate [<options>] [<file-path>]

ARGUMENTS:
  <file-path>             The filepath for data to be interpolated. '-' for
                          stdin. 

OPTIONS:
  --step <step>           Interpolation step (floating point, or 'median').
                          (default: median)
  -x, --abscissa <abscissa>
                          Column to use as independent (e.g. time/depth).
                          (default: 1)
  -y, --ordinate <ordinate>
                          Choose between single ordinate column number,
                           or string 'all' for all (non-abscissa) columns
                          (default: single(2))
  -b, --range-start <range-start>
                          Restrict range (low). (default: inferred)
  -e, --range-end <range-end>
                          Restrict range (high). (default: inferred)
  -m, --interpolation-mode <interpolation-mode>
                          Interpolation Mode (linear, …)
                          /*cubicSpline, staircase not yet implemented*/.
                          (default: linear)
  -i, --integration-mode <integration-mode>
                          Use integration during interpolation. (default:
                          integrate)
  --disable-extrapolation Disable extrapolation beyond start or end point(s). 
  -l, --headerLine <headerLine>
                          Use this line number for column labels. 
  -d, --data-first-line <data-first-line>
                          First line with data values. (default: 1)
  -s, --column-separator <column-separator>
                          Separator to be used to split columns instead of
                          default tab. (default: 	)
  --output-separator <output-separator>
                          Separator to be used on output instead of default
                          tab. (default: 	)
  -n, --ignore-line-marker <ignore-line-marker>
                          Ignore lines starting with this character or any of
                          these characters.
                           (default: <CFCharacterSet Items(U+0021 U+0023 U+0025
                          U+002F)>)
  --replace-dwith-e <replace-dwith-e>
                          Replace Fortran style doubles D to E. (default: true)
  -f, --format-string <format-string>
                          Output format string. (default: %f)
  --licenses              Show license for this project, and licenses of
                          projects used. 
  --versions              Show version for this tool. 
  -v, --verbosity         Verbose output. Multiple counts increase verbosity. 
  --version               Show the version.
  -h, --help              Show help information.


Pre-built binaries are provided for macOS, Linux and Windows:

https://paloz.marum.de/bitbucket/projects/ESSP/repos/interpolate/browse/Binaries


These can be build from source with a working Swift Toolchain in the standard way:

Build instructions
git clone https://paloz.marum.de/bitbucket/scm/essp/interpolate.git
cd interpolate
swift build -c release


Example Usage:

Example Usage
./.build/release/interpolate -s " " -b10.0 -e50.0 -y7 -l 1 --step 2.0 Tests/interpolateTests/Resources/testFile.txt
time_kyr	T_C
10.000000	5.959085
12.000000	5.937662
14.000000	5.891203
16.000000	5.811697
18.000000	5.712444
20.000000	5.608675
22.000000	5.528426
24.000000	5.481566
26.000000	5.492680
28.000000	5.532406
30.000000	5.561884
32.000000	5.597621
34.000000	5.632969
36.000000	5.664911
38.000000	5.683163
40.000000	5.694919
42.000000	5.694082
44.000000	5.684616
46.000000	5.664727
48.000000	5.635670
50.000000	5.595989






  • No labels