# NOT RUN {
library(oce)
## Example 1.
d <- read.csv("towyow.csv", header=TRUE)
towyow <- as.ctd(d$salinity, d$temperature, d$pressure)
casts <- ctdFindProfiles(towyow)
par(mfrow=c(length(casts), 3))
for (cast in casts) {
plotProfile(cast, "salinity")
plotProfile(cast, "temperature")
plotTS(cast, type='o')
}
## Example 2.
## Using a moving average to smooth pressure, instead of the default
## smooth.spline() method. This avoids a tendency of smooth.spline()
## to smooth out the profiles in a tow-yo with many (dozens or more) cycles.
movingAverage <- function(x, n = 11, ...)
{
f <- rep(1/n, n)
stats::filter(x, f, ...)
}
casts <- ctdFindProfiles(towyo, smoother=movingAverage)
## Example 3: glider data, with profiles separated by >10dbar jump.
breaks <- which(diff(ctd[["pressure"]]) > 10))
profiles <- ctdFindProfiles(ctd, breaks=breaks)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab