stratif: Compute an index of stratification

Description Usage Arguments Value See Also Examples

View source: R/stratif.R

Description

Compute the difference in a given variable between a two depth layers, usually the surface, mixed layer and a bottom reference layer. This is often used with density to quantify the intensity of stratification.

Usage

1
2
stratif(x, depth, min.depths, max.depths, n.smooth = 0, k = 2,
  fun = mean)

Arguments

x

vector of the variable of interest, usually potential or in situ density.

depth

vector of depths at which x is measured.

min.depths

depth(s) of reference, near the surface; when min.depths is a vector, the value of x is averaged between those depths.

max.depths

similar to min.depths but at the bottom.

n.smooth

integer, number of times to smooth the data before applying the mixed layer criteria.

k

order of the moving average used for smoothing; the window size is 2k+1. NB: when data is smoothed, it should have been recorded at approximately regular intervals for the moving average to make sense.

fun

function used to summarise the values over min.depths and max.depths; typically this is mean but median could be used for a more robust estimate.

Value

The value of the stratification index.

See Also

mld() for the computation of the depth of the mixed layer, another quantification of the intensity of mixing/stratification; smooth() for smoothing.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# estimate the intensity of stratification using density
plot(-depth ~ sigma, data=d, type="l")
abline(h=-c(1, 5, 61, 65), col="red")
stratif(d$sigma, d$depth, min.depths=1:5, max.depths=61:65)
stratif(d$sigma, d$depth, min.depths=1:5, max.depths=61:65, fun=median)

# estimate the intensity of the peak of chlorophyll at the deep
# chlorophyll maximum
plot(-depth ~ chla, data=d, type="l")
DCM <- maxd(d$chla, d$depth, n.smooth=2)
abline(h=-c(0, 2, DCM-2, DCM+2), col="chartreuse4")
stratif(d$chla, d$depth, min.depths=0:2, max.depths=c(DCM-2, DCM+2))

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