predict.tidem: Predict a Tidal Signal

View source: R/tides.R

predict.tidemR Documentation

Predict a Tidal Signal

Description

This creates a time-series of predicted tides, based on a tidal model object that was created by as.tidem() or tidem().

Usage

## S3 method for class 'tidem'
predict(object, newdata, ...)

Arguments

object

a tidem object.

newdata

vector of POSIXt times at which to make the prediction. For models created with tidem(), the newdata argument is optional, and if it is not provided, then the predictions are at the observation times given to tidem(). However, newdata is required if as.tidem() had been used to create object.

...

optional arguments passed on to children.

Details

All the tidal constituents that are stored in object are used, not just those that are statistically significant or that have amplitude exceeding any particular value. In this respect, predict.tidem() follows a pattern established by e.g. predict.lm(). Note that the constituents in object are straightforward if it was constructed with as.tidem(), but considerably more complicated for tidem(), and so the documentation for the latter ought to be studied closely, especially with regard to the Rayleigh criterion.

Value

A vector of predictions.

Sample of Usage

# prediction at specified times
data(sealevel)
m <- tidem(sealevel)
# Check fit over 2 days (interpolating to finer timescale)
look <- 1:48
time <- sealevel[["time"]]
elevation <- sealevel[["elevation"]]
oce.plot.ts(time[look], elevation[look])
# 360s = 10 minute timescale
t <- seq(from=time[1], to=time[max(look)], by=360)
lines(t, predict(m, newdata=t), col="red")
legend("topright", col=c("black","red"),
legend=c("data","model"),lwd=1)

Author(s)

Dan Kelley

See Also

Other things related to tides: [[,tidem-method, [[<-,tidem-method, as.tidem(), plot,tidem-method, summary,tidem-method, tidalCurrent, tidedata, tidem, tidem-class, tidemAstron(), tidemVuf(), webtide()

Examples


# Show non-tidal sealevel signal in Halifax Harbour during
# the year 2002. The spike resulted from Hurricane Juan.
library(oce)
data(sealevel)
time <- sealevel[["time"]]
elevation <- sealevel[["elevation"]]
prediction <- tidem(sealevel) |> predict()
oce.plot.ts(time, elevation - prediction)


oce documentation built on Sept. 11, 2024, 7:09 p.m.