library(oce)
# Contouring example, with wind-speed data from Koch et al. (1983)
data(wind)
u <- interpBarnes(wind$x, wind$y, wind$u)
contour(u$xg, u$yg, u$zg, col="red", labcex=1)
text(wind$x, wind$y, wind$u, cex=0.7, col="blue")
# One-dimensional example, smoothing a salinity profile
data(ctd)
p <- ctd$data$pressure
y <- rep(1, length(p)) # fake y data, with arbitrary value
S <- ctd$data$salinity
pg <- pretty(p, n=100)
g <- interpBarnes(p, y, S, xg=pg, xr=2)
plot(S, p, cex=0.5, col="blue", ylim=rev(range(p)))
lines(g$zg, g$xg, col="red")
Run the code above in your browser using DataLab