predict.tidem: Predict a Tidal Signal

Description Usage Arguments Value Author(s) See Also Examples

View source: R/tides.R

Description

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

Usage

1
2
## 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.

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-class, tidemAstron(), tidemVuf(), tidem, webtide()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## 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)

## End(Not run)

oce documentation built on March 28, 2021, 9:09 a.m.