interp_layer: Interpolate a fractional layer number for an observation...

View source: R/interps.R

interp_layerR Documentation

Interpolate a fractional layer number for an observation between Sigma layers

Description

This function linearly interpolates the layer number for an observation of a specified depth, depending on the depths of the nearest layers (see Examples). This approach is used in depth_from_unknown to define fractional layer numbers.

Usage

interp_layer(x, l1, l2, b1, b2)

Arguments

x

A number which specifies the depth of the observation.

l1

A number which specifies the layer ID of the nearest layer.

l2

A number which specifies the layer ID of the other surrounding layer.

b1

A number which specifies the depth of the first layer.

b2

A number which specifies the depth of the second layer.

Value

The function returns a (fractional) layer number for an observation that lies between two layers.

Author(s)

Edward Lavender

Examples

#### Example (1): Interpolate fractional layer numbers
# Imagine we have made an observation at 22 m deep. To compare this observation to
# ... FVCOM predictions we might want to define the layer number of that observation.
# Imagine we know that the observation lies between layers 2 and 3, which are 21 and 33 m deep
# ... respectively. We can interpolate the layer number of our observation between layers 2 and
# ... 3:
interp_layer(22, 2, 3, 21, 32)


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