calc_thermocline: Calculate thermocline strength

View source: R/calc_helpers.R

calc_thermoclineR Documentation

Calculate thermocline strength

Description

This function calculates thermocline strength from FVCOM temperature predictions.

Usage

calc_thermocline(l)

Arguments

l

A list composed of a single environmental array (comprising temperature predictions for hours x layers x nodes) for a particular day.

Details

Thermocline strength is approximated as the difference in temperature between the shallowest and the deepest Sigma layers. This is computationally faster than calculating other metrics (e.g. the standard deviation in temperature across layers). Positive numbers indicate the temperature at the surface is higher than at the bottom. This function cannot be applied properly to the data supplied with this package, which is a small subset of the temperature predictions including only the top two layers.

Value

The function returns a 2-dimensional array of the thermocline strength for each hour and each node in the original array.

Author(s)

Edward Lavender

See Also

This function can be implemented within compute_field_from_fvcom.

Examples

#### Step 1: Read example temperature file into a list
path <- system.file("WeStCOMS_files/temp",
                    package = "fvcom.tbx", mustWork = TRUE)

file <- list.files(path, full.names = TRUE)[1]
l <- list(R.matlab::readMat(file)$data)
str(l)

#### Step 2: Compute thermocline strength
# (Note this is only for demonstration purposes:
# ... example package temperature predictions only include layers 1 and 2!)
thermocline_strength <- calc_thermocline(l)
hist(thermocline_strength)


edwardlavender/fvcom.tbx documentation built on Nov. 26, 2022, 10:28 p.m.