SIGCLEAR Program reference

sginterp

Interpolate fields from an auxiliary dataset

Package: sigclear-dsp · Version: 1.2.0-2 Download JSON

Description

Interpolate selected fields from an auxiliary dataset at the coordinates in
the input dataset. Use inverse-distance weighting for multidimensional keys,
or one-dimensional linear/previous/next/nearest joins for a single key.

Interpolation options:
1. suitable for unstructured data
2. IDW for multi-dimensional data
3. linear, previous, next, and nearest joins for a one-dimensional key

For linear, previous/hold, next, and nearest interpolation, exactly one in.*
field is required. Auxiliary keys are sorted internally. The outside option is
clamp, zero, or error. The duplicate option is error, first, last, or mean.
Nearest chooses the previous sample when distances are equal. IDW remains the
default and retains support for multiple interpolation dimensions.

Synopsis

sginterp <stdin aux= in.x=AUX(x) >stdout out.var=AUX(var) method=SG_METHOD_IDW idw.eps=1.0 idw.radius=1000000 outside=SG_TEMPORAL_CLAMP duplicate=SG_TEMPORAL_DUPLICATE_ERROR

Parameters

sginterp parameters
ParameterTypeDefaultDescription
in ifile stdin input dataset
aux ifile Unknown auxiliary dataset with all columns in one group
in.x field AUX(x) index fields
out ofile stdout output dataset
out.var field AUX(var) variable fields
method enum SG_METHOD_IDW interpolation method; non-IDW methods require one interpolation field
Allowed: idw linear previous hold next nearest
idw.eps floats 1.0 relative weighting for each interpolation dimension
idw.radius float 1000000 maximum weighted interpolation distance
outside enum SG_TEMPORAL_CLAMP behavior outside the auxiliary key range
Allowed: clamp zero error
duplicate enum SG_TEMPORAL_DUPLICATE_ERROR behavior for duplicate auxiliary keys
Allowed: error first last mean

Input and output

Input

input dataset

Output

output dataset

Examples

1. Interpolate velocity and temperature onto input depths

sginterp aux=reference.sg in.depth=z out.data=vel out.temperature=temp \
  <input.sg >interpolated.sg

Input depth is the query coordinate; auxiliary z is the reference coordinate.
Auxiliary vel and temp values become output data and temperature using IDW.
Keep all auxiliary columns in one group and verify coordinate units and ranges.

2. Interpolate ocean-bottom depth onto receiver positions

sginterp aux=reference.sg in.recx=x in.recy=y out.wdepth=data \
  <receivers.sg >depths.sg

Input recx/recy query auxiliary x/y; auxiliary data becomes output wdepth.
Use compatible coordinate units, one auxiliary group and appropriate IDW weights.

3. Interpolate a variable in a five-dimensional sampled model space

sginterp aux=models.sg out.data=var in.p1=m1 in.p2=m2 in.p3=m3 \
  in.p4=m4 in.p5=m5 <queries.sg >interpolated.sg

Input p1 through p5 query auxiliary m1 through m5; var becomes output data.
Keep auxiliary cases in one group and choose dimension weights for their units.

4. Linearly interpolate values at irregular one-dimensional coordinates

sginterp in.time=time aux=reference.sg out.value=value method=linear \
  <queries.sg >interpolated.sg

Exactly one input coordinate field is required. Auxiliary keys are sorted;
the default outside policy clamps and the default duplicate policy rejects.
These illustrative invocations require matching datasets and output checks;
they are not evidence of executed or scientifically validated experiments.

References

  1. Shepard, Donald. 1968. A two-dimensional interpolation function for
    irregularly-spaced data. Proceedings of the 1968 ACM National Conference.
    pp.517-524.