Skip to contents

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.

Value

A vector of predictions.

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.

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)

See also

Author

Dan Kelley

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()
#> Note: the tidal record is too short to fit for constituents: SA, PI1, S1, PSI1, GAM2, H1, H2, T2, R2
oce.plot.ts(time, elevation - prediction)