ftide: Fit Tidal Data

Description Usage Arguments Details Value See Also Examples


Fit tidal data using any of over 400 harmonic constituents. Daily nodal corrections and time-varying mean sea-levels can be used.


ftide(x, dto, hcn = TideHarmonics::hc60, astlon = c("task","cartwright"),
   nodal = TRUE, smsl = FALSE, span = 0.75, degree = 1, ...)



A numeric vector or time series object giving the sea-levels. Missing values are allowed.


A date/time vector of the same length as x, which 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. No missing values are allowed.


A vector of constituent names. Some in-built vectors of names can be used: hc4, hc7, hc37, hc60 and hc114. If not specified, the vector hc60 is used by default.


The longitude formula to be used. The default "task" is the formulas use in the TASK-2000 software. The alternative "cartwright" uses Cartwright(1982).


Should nodal corrections be be used?


If TRUE, then a smooth curve is fitted to the mean sea-level based on the loess function. This is designed to account for smooth changes at periods longer than the lowest speed harmonic, which by default is the solar annual term Sa.

span, degree

Arguments passed to the loess function.


Passed to the linear model function lm.


The function first removes the mean sea-level from the data (which by default is a single number) and the fits a linear model without intercept to sine and cosine terms defined by the specified harmonics. This (by default) includes nodal corrections. The sine and cosine coefficients can then be used to derive the amplitude and phases. See the package vignette for details.

Different names are used by various organizations for identical constituents. This package is designed to be robust, so that any common name can be used. In the output, the name will get converted to the set of names that we employ.

For constituents based on underlying components, we use our own (logical) naming scheme rather than the (totally confusing) historical scheme. See harmonics and the package vignette for details. Either scheme should work for the input vector hcn.

The UTC time zone is assumed by default. Even if a different time zone is used, the phase lags will be calculated in UTC. The utc argument of coef.tide can be used to derive phase lags for different time zones.

An error will be produced if two specified harmonic components have virtually identical speeds (specifically, if the first five Doodson numbers are the same), even if the nodal corrections are different. This is to avoid numerical problems in the linear model fit, because these components will be difficult (or impossible) to identify separately.

The slowest harmonics in the default hc60 vector is the annual solar term Sa. If you do not have at least one year of data you should not include Sa. The fastest harmonics in hc60 have periods of just over 4 hours. If your frequency of observation is more than 2 hours you should not include the faster constituents.


A list object of class c('tide','lm'). This is exactly the save as a standard lm object but with the following additional components


The form factor, which in terms of amplitudes is calculated as (K1+O1)/(M2+S2). This component and the two components given below are only available if all four of these harmonics are included in the fit.


A vector of fitted features that are relevant for semi-diurnal sites. MLWS = Mean Low Water Springs. MLWN = Mean Low Water Neaps. MSL = Mean Sea-Level. MHWN = Mean High Water Neaps. MHWS = Mean High Water Springs.


A vector of fitted features that are relevant for diurnal or mixed semi-diurnal sites. MLLW = Mean Lower Low Water. MHLW = Mean Higher Low Water. MSL = Mean Sea-Level. MLHW = Mean Lower High Water. MHHW = Mean Higher High Water.


A matrix of sine and cosine coefficients, in the same order as the hcn vector.


A matrix of amplitudes, phase lags, sine and cosine coefficients, ordered by decreasing amplitude.


The POSIXct value used as the origin, which is in the centre of the dto vector.


A named vector containing reference signals (equilibrium phases) in degrees for each harmonic constituent.


The mean sea level, either a vector (if smsl is TRUE) or a single number (if smsl is FALSE).


The fitted loess object if smsl is TRUE.


The nodal argument.


The astlon argument.

See Also

harmonics, hc114, plot.tide, predict.tide


hfit1 <- ftide(Hillarys$SeaLevel, Hillarys$DateTime, hc60)
hfit2 <- ftide(Hillarys$Sea, Hillarys$Date, hc7, smsl=TRUE)

Example output

lm(formula = x ~ -1 + ., data = xmat, na.action = na.exclude)

Form Factor: 2.991049 

Features (Diurnal or Mixed):
     MLLW      MHLW       MSL      MLHW      MHHW 
0.4676174 0.5723951 0.8113304 1.0502657 1.1550435 

          amplitude   phase       sine        cosine    
K1         1.733e-01   1.973e+02  -5.147e-02  -1.655e-01
O1         1.181e-01   2.144e+02  -6.673e-02  -9.738e-02
Sa         9.930e-02   4.774e+01   7.350e-02   6.678e-02
P1         5.462e-02   1.903e+02  -9.720e-03  -5.375e-02
M2         5.239e-02   1.096e+02   4.936e-02  -1.757e-02
S2         4.501e-02   8.800e+01   4.498e-02   1.573e-03
Q1         2.956e-02   2.191e+02  -1.865e-02  -2.293e-02
Mf         2.300e-02   3.561e+02  -1.567e-03   2.294e-02
S1         2.223e-02   3.306e+02  -1.092e-02   1.936e-02
Ssa        1.998e-02   1.629e+02   5.862e-03  -1.910e-02
N2         1.582e-02   1.733e+02   1.833e-03  -1.571e-02
K2         1.398e-02   8.040e+01   1.378e-02   2.331e-03
Mm         1.073e-02   4.210e+01   7.196e-03   7.963e-03
J1         1.037e-02   2.058e+02  -4.523e-03  -9.337e-03
mu2        7.204e-03   1.682e+02   1.476e-03  -7.051e-03
MSf        6.632e-03   1.454e+02   3.766e-03  -5.458e-03
2Q1        5.091e-03   2.221e+02  -3.414e-03  -3.777e-03
rho1       4.946e-03   2.101e+02  -2.481e-03  -4.279e-03
M4         4.730e-03   2.686e+02  -4.729e-03  -1.124e-04
M1         4.728e-03   2.577e+02  -4.620e-03  -1.007e-03
2N2        4.488e-03   1.623e+02   1.366e-03  -4.275e-03
sig1       4.369e-03   2.239e+02  -3.028e-03  -3.149e-03
1S1k.3     4.187e-03   1.880e+02  -5.815e-04  -4.146e-03
phi1       4.004e-03   2.041e+02  -1.636e-03  -3.655e-03
1M1S.4     3.562e-03   3.195e+02  -2.315e-03   2.707e-03
L2         3.224e-03   7.157e+01   3.059e-03   1.019e-03
T2         3.214e-03   8.496e+01   3.202e-03   2.825e-04
pi1        3.203e-03   1.583e+02   1.186e-03  -2.975e-03
OO1        2.926e-03   2.115e+02  -1.530e-03  -2.494e-03
M3         2.552e-03   3.351e+02  -1.075e-03   2.315e-03
1M.1p1     2.537e-03   2.034e+02  -1.007e-03  -2.329e-03
the1       2.150e-03   1.751e+02   1.818e-04  -2.142e-03
1M1N.1S2   2.069e-03   1.529e+02   9.426e-04  -1.842e-03
1S.1o1     2.068e-03   2.371e+02  -1.737e-03  -1.123e-03
1M1N.4     1.720e-03   2.342e+02  -1.396e-03  -1.006e-03
nu2        1.715e-03   1.777e+02   6.774e-05  -1.714e-03
chi1       1.643e-03   1.640e+02   4.518e-04  -1.579e-03
lam2       1.516e-03   7.894e+01   1.488e-03   2.909e-04
psi1       1.488e-03   2.065e+02  -6.637e-04  -1.331e-03
1M1k.3     1.420e-03   2.494e+02  -1.329e-03  -5.005e-04
1M1o.3     1.203e-03   1.766e+02   7.126e-05  -1.200e-03
1M1K.4     1.061e-03   3.135e+02  -7.700e-04   7.298e-04
M6         1.003e-03   9.132e+01   1.003e-03  -2.310e-05
1k1j.2     9.816e-04   2.485e+02  -9.130e-04  -3.604e-04
S4         8.206e-04   2.562e+02  -7.970e-04  -1.957e-04
1o1p.2     7.511e-04   9.861e+01   7.426e-04  -1.125e-04
1S1o.3     7.233e-04   2.421e+02  -6.390e-04  -3.389e-04
1S1K.4     6.178e-04   3.552e+02  -5.119e-05   6.157e-04
1S1N.4     5.943e-04   3.198e+02  -3.839e-04   4.537e-04
1M1K.1S2   4.728e-04   2.021e+02  -1.775e-04  -4.382e-04
2M1N.6     4.564e-04   2.785e+01   2.132e-04   4.035e-04
2M1S.6     3.693e-04   1.740e+02   3.853e-05  -3.673e-04
2S.1M2     3.260e-04   3.177e+02  -2.193e-04   2.412e-04
1M1S.1N2   2.937e-04   2.796e+02  -2.896e-04   4.923e-05
1M1S1N.6   2.374e-04   7.091e+01   2.243e-04   7.762e-05
2M1K.6     1.883e-04   2.236e+02  -1.300e-04  -1.363e-04
R2         1.510e-04   5.277e+01   1.202e-04   9.136e-05
1o1q.2     1.308e-04   2.347e+02  -1.068e-04  -7.551e-05
2S1M.6     9.646e-05   2.971e+02  -8.586e-05   4.396e-05
1M1S1K.6   5.281e-05   3.579e+02  -1.976e-06   5.277e-05

lm(formula = x ~ -1 + ., data = xmat, na.action = na.exclude)

Form Factor: 2.990834 

Features (Diurnal or Mixed):
     MLLW      MHLW       MSL      MLHW      MHHW 
0.4672917 0.5720560 0.8108796 1.0497033 1.1544676 

    amplitude   phase       sine        cosine    
K1    0.173216  197.358105   -0.051678   -0.165327
O1    0.117990  214.371675   -0.066612   -0.097388
P1    0.054626  190.289438   -0.009757   -0.053747
M2    0.052382  109.620961    0.049341   -0.017590
S2    0.044984   87.978310    0.044956    0.001587
N2    0.015720  173.539053    0.001769   -0.015620
K2    0.014007   80.526441    0.013816    0.002306

TideHarmonics documentation built on May 2, 2019, 6:34 a.m.