oce (version 0.9-23)

predict.tidem: Predict a Time Series from a Tidem Tidal Model

Description

Predict a time series from a tidal model. This is a wrapper around the predict method for object$model.

Usage

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

Arguments

object

A tidem object, i.e. one inheriting from tidem-class.

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.

See Also

Other things related to tidem data: [[,tidem-method, [[<-,tidem-method, plot,tidem-method, summary,tidem-method, tidedata, tidem-class, tidemAstron, tidemVuf, tidem

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
library(oce)
# 1. tidal anomaly
data(sealevelTuktoyaktuk)
time <- sealevelTuktoyaktuk[["time"]]
elevation <- sealevelTuktoyaktuk[["elevation"]]
oce.plot.ts(time, elevation, type='l', ylab="Height [m]", ylim=c(-2, 6))
tide <- tidem(sealevelTuktoyaktuk)
lines(time, elevation - predict(tide), col="red")
abline(h=0, col="red")

# 2. 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)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab