Learn R Programming

TideHarmonics (version 0.1-1)

predict.tide: Predict The Tide Using Tidal Object

Description

Predict the tide values at specified times.

Usage

# S3 method for tide
predict(object, from, to, by = NULL, split = FALSE, 
  which = NULL, msl = !split, …)

Arguments

object
An object of class 'tide'.
from
Time and date from which to calculate tide values. Should be a POSIXct object or something which can be converted to a POSIXct object. If no time zone is given then UTC is assumed.
to
Time and date up to which to calculate tide values. Should be a POSIXct object or something which can be converted to a POSIXct object. If no time zone is given then UTC is assumed.
by
The time interval in hours between calculated tidal predictions. If NULL, then the time interval is that which produces 1000 evaluations between from and to.
split
If TRUE, predictions are given for harmonic constituents separately. Otherwise, the constituents are summed.
which
If NULL, use all fitted harmonic constituents. If not NULL, then should be a character vector giving the names of the selected constituents.
msl
Add the mean sea-level to the predictions? A time-varying mean sea-level will be used if this has been implemented for the tidal object.
Not used.

Value

A numeric vector of predictions (if split is FALSE) or a numeric matrix of predictions (if split is TRUE).

Details

Note that nodal corrections and time-varying mean sea-levels will be used if and only if they were implemented for the tidal object. The longitude formulas will also be the same as those used for the tidal object.

See Also

ftide, plot.tide

Examples

Run this code
hfit1 <- ftide(Hillarys$SeaLevel, Hillarys$DateTime, hc60)
hfit2 <- ftide(Hillarys$Sea, Hillarys$Date, hc7, smsl=TRUE)
t1 <- as.POSIXct("2012-12-31 23:00", tz = "UTC")
t2 <- as.POSIXct("2013-01-01 14:00", tz = "UTC")
predict(hfit1, t1, t2)
predict(hfit2, t1, t2, split = TRUE)
predict(hfit2, t1, t2, split = TRUE, which = c("M2","S2"))
predict(hfit2, t1, t2, which = "M2", msl = FALSE)

Run the code above in your browser using DataLab