Learn R Programming

oce (version 0.2-1)

predict.tidem: Predict a time series from a tidal model

Description

Predict a time series from a tidal model.

Usage

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

Arguments

object
a tidem object.
newdata
optional vector of POSIXt times at which to make the prediction. If not present, predict.tidem uses the times that were provided in the original call to tidem.
...
optional arguments passed on to children.

Value

  • A vector of predictions.

Details

This is a wrapper around the predict method for object$model.

See Also

tidem fits a tidal model.

Examples

Run this code
library(oce)
#
# 1. tidal anomaly
data(sealevelTuktoyaktuk)
tide <- tidem(sealevelTuktoyaktuk)
oce.plot.ts(sealevelTuktoyaktuk$data$time, sealevelTuktoyaktuk$data$elevation,
  type='l', ylim=c(-2,5))
lines(sealevelTuktoyaktuk$data$time, sealevelTuktoyaktuk$data$elevation - predict(tide),
  col="red")
abline(h=0, col="red")
#
# 2. prediction at specified times
data(sealevelHalifax)
m <- tidem(sealevelHalifax)
look <- 1:24                          # examine first day
oce.plot.ts(sealevelHalifax$data$time[look], sealevelHalifax$data$elevation[look])
# Notice that t is at a 10-minute interval
t <- seq(from=sealevelHalifax$data$time[1], 
  to=sealevelHalifax$data$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)

Run the code above in your browser using DataLab