clined: Detect the position of a cline

Description Usage Arguments Value See Also Examples

View source: R/clined.R

Description

The cline of a variable is the depth at which it varies most sharply along the cast; here it is computed as the maximum of the moving standard deviation over the (possibly smoothed) cast.

Usage

1
clined(x, depth = NULL, n.smooth = 0, k = 2)

Arguments

x

vector of the variable of interest. It must have been recorded at approximately regular intervals (see slide() as to why).

depth

vector of depths at which x is measured; optional.

n.smooth

integer, number of times to smooth the data before computing the moving standard deviation.

k

order of the window; the window size is 2k+1.

Value

When depth is NULL, return the index of x corresponding to the cline, i. When depth is provided, return depth[i], the value of the depth of the cline.

See Also

slide() for the underlying implementation of the moving standard deviation, smooth() for smoothing.

Other functions computing remarkable depths: maxd, mld, ze_from_chla, ze_from_par, ze_from_surface_chla

Examples

1
2
3
4
5
6
7
plot(-depth ~ temp, data=d, type="l")
thermocline <- clined(d$temp, d$depth)
abline(h=-thermocline, col="red")

plot(-depth ~ sal, data=d, type="l")
halocline <- clined(d$sal, d$depth)
abline(h=-halocline, col="red")

jiho/castr documentation built on April 5, 2020, 2:12 p.m.