Skip to contents

This function calculates the distance between a shallower and deeper depth to a target depth. These values are then swapped so they can be used in a weighted average to linearly interpolate to the target depth.

Usage

calculate_proximity_weight(depths, target)

Arguments

depths

A numeric vector of a shallower and deeper depth.

target

An intermediate depth we would like to interpolate to.

Value

A vector of weights to match the vector of depths.

Examples

calculate_proximity_weight(c(0, 100), target = 30)
#> [1] 70 30

calculate_proximity_weight(c(0, 100), target = 50)
#> [1] 50 50

calculate_proximity_weight(c(0, 100), target = 80)
#> [1] 20 80