interp_btw_hours: Interpolate an FVCOM prediction between hours

View source: R/interps.R

interp_btw_hoursR Documentation

Interpolate an FVCOM prediction between hours

Description

This function linearly interpolates an FVCOM prediction between hours.

Usage

interp_btw_hours(x, h1, h2, p1, p2)

Arguments

x

A number which specifies the fractional hour for which a prediction is desired.

h1

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

h2

An integer which specifies the hour of the surrounding FVCOM prediction.

p1

A number which specifies the FVCOM prediction at h1.

p2

A number which specifies the FVCOM prediction at h2.

Value

The function returns an interpolated FVCOM prediction for a time between two hours at which FVCOM predictions are available.

Author(s)

Edward Lavender

Examples

#### Example (1): Interpolate environmental conditions between hours
# Imagine we want to know the predicted temperature at 10:10 am on a given day.
# FVCOM outputs the predictions on every hour, so we have predictions for
# ... 10 am and 11 am of 12 and 13 dg C respectively. Then, the interpolated
# ... temperature at 10:10 am is
interp_btw_hours(10+10/60, 10, 11, 12, 13)


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