interp_btw_depths: Interpolate an FVCOM prediction between depths

View source: R/interps.R

interp_btw_depthsR Documentation

Interpolate an FVCOM prediction between depths

Description

This function linearly interpolates an FVCOM prediction between the depths of two layers.

Usage

interp_btw_depths(x, d1, d2, p1, p2)

Arguments

x

A number which specifies the depth for which a prediction is desired.

d1

An integer which specifies the depth of the first FVCOM prediction.

d2

An integer which specifies the depth of the second FVCOM prediction.

p1

A number which specifies the FVCOM prediction at d1.

p2

A number which specifies the FVCOM prediction at d2.

Details

This function implements linear interpolation between the depths of layers, rather than layer numbers, because the spacing between layers is non linear.

Value

The function returns an interpolated FVCOM prediction for a depth between two depths (the depths of two layers at which FVCOM predictions are available).

Author(s)

Edward Lavender

Examples

#### Example (1): Interpolate environmental conditions between depths
# Imagine we want to know the predicted temperature at depth 25 m on a given day.
# For nodes, FVCOM outputs the predictions for each layer. Imagine that the nearest
# ... predictions are for layers 2 and 3 which have depths 20 and 30 m respectively.
# Imagine these predictions are 8 and 9 dg C. Then the interpolated temperature at
# ... depth 25 m is:
interp_btw_depths(25, 20, 30, 8, 9)


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