Learn R Programming

oce (version 0.2-1)

oce.approx: Interpolate with Reiniger-Ross algorithm

Description

Interpolate with weighted-parabola method developed by Reiniger and Ross (1968).

Usage

oce.approx(x, y, xout, method=c("reiniger-ross"))

Arguments

x
the independent variable (z or p, usually).
y
the dependent variable.
xout
the values of the independent variable at which interpolation is to be done.
method
method to use. See Details.

Value

  • A vector of interplated values, corresponding to the xout values and equal in number.

Details

Only one method is provided at present. This is the weighted-parabola algorithm of Reiniger and Ross (1968). For procedure is as follows. First, the interpolant for any xout value that is outside the range of x is set to NA. Next, linear interpolation is used for any xout value that has only one smaller neighboring x value, or one larger neighboring value. For all other values of xout, the 4 neighboring points x are sought, two smaller and two larger. Then two parabolas are determined, one from the two smaller points plus the nearest larger point, and the other from the nearest smaller point and the two larger points. A weighted sum of these two parabolas provides the interpolated value.

Note that, in the notation of Reiniger and Ross (1968), this algorithm uses m=2 and n=1. (A future version of this routine might provide the ability to modify these values.)

References

R.F. Reiniger and C.K. Ross, 1968. A method of interpolation with application to oceanographic data. Deep Sea Research, 15, 185-193.

Examples

Run this code
library(oce)
data(RRprofile)
zz <- seq(0,2000,5)
plot(RRprofile$temperature, RRprofile$depth, ylim=c(500,0), xlim=c(2,11))
TT <- oce.approx(RRprofile$depth, RRprofile$temperature, zz)
lines(TT, zz)

Run the code above in your browser using DataLab