Classical Tidal Harmonic Analysis Including Error Estimates in MATLAB Using T TIDE
Classical Tidal Harmonic Analysis Including Error Estimates in MATLAB Using T TIDE
Department of Earth and Ocean Sciences, University of British Columbia, 6270 University Blvd., Vancouver, BC, Canada V6T 1Z4
b
Woods Hole Oceanographic Institution, Woods Hole, MA 02543 USA
Received 24 September 2001; received in revised form 13 February 2002; accepted 28 February 2002
Abstract
A standard part of any oceanic pressure gauge or current meter analysis is the separation of tidal from non-tidal
components of the signal. The tidal signal can either be discarded, or its characteristics described in some fashion useful
for further analysis. Although tidal signals can be removed by standard high or bandpass ltering techniques, their
relatively deterministic character and large amplitude make special techniques more effective. In classical harmonic
analysis, the tidal signal is modelled as the sum of a nite set of sinusoids at specic frequencies related to astronomical
parameters. A set of programs has been written in MATLAB to (a) perform classical harmonic analysis for periods of
about 1 year or shorter, (b) account for (some) unresolved constituents using nodal corrections, and (c) compute
condence intervals for the analyzed components. r 2002 Elsevier Science Ltd. All rights reserved.
Keywords: Tides; Condence interval; Oceanography
1. Introduction
As the earth rotates on its axis, spatially varying
gravitational forces from the moon and the sun act on
the ocean, generating a forced elevation and current
response primarily (but not solely) at diurnal and semidiurnal frequencies. Body forces act directly on deep
oceanic waters. Tidal effects in coastal regions are not
directly forced by these astronomical forces. Instead
they arise as a side-effect of deep oceanic variability,
propagating through shallower coastal waters as a wave
or a combination of waves. In a typical oceanic time
series, tidal variability is often the largest signal. Power
spectra for such time series are often characterized by
a broad hump with a low-frequency maximum and a
decline at higher frequencies. Superimposed are a
$
number of sharp tidal peaks near diurnal and semidiurnal frequencies, and sometimes a broader peak
associated with Coriolis or inertial effects. Dynamical
analysis requires the separation of the tidal signal from
sub or super-tidal variations, or in some cases separation
of tidal effects from inertial effects at a nearby
frequency. The tidal information is either discarded or
kept for further analysis.
Standard high/low/bandpass ltering techniques (e.g.,
Jackson 1986) can be used but in general these are
inefcient because fairly narrow lters with a great deal
of rejection are needed. Also, although these are useful
in analyzing non-tidal variability, they provide no
compression of the tidal information. Specialized
techniques have been devised to take advantage of the
deterministic nature of tidal processes. In classical
harmonic analysis, the tidal forcing is modelled as a set
of spectral lines, i.e., the sum of a nite set of sinusoids
at specic frequencies. These frequencies are specied by
various combinations of sums and differences of integer
multiples of 6 fundamental frequencies arising from
planetary motions (Godin, 1972). These fundamental
0098-3004/02/$ - see front matter r 2002 Elsevier Science Ltd. All rights reserved.
PII: S 0 0 9 8 - 3 0 0 4 ( 0 2 ) 0 0 0 1 3 - 4
930
2. Tidal potential
The effect of gravitational force vectors from the sun
and moon, F; can be written as the gradient of a scalar
potential V ; F rV : The magnitude of this potential
at the earths surface at any time obviously is dependent
on the relative positions of the earth, moon, and sun. In
Doodsons development (Doodson, 1954, described in
Godin, 1972) the potential is written as a function of
lunar time t (dened to begin at lunar midnight) and
other astronomical variables (which are also functions
of time):
s is the mean longitude of moon, h the mean longitude
of sun, p the longitude of perigee, N 0 the negative of
the longitude of the ascending node, and p0 is the
longitude of perihelion, where all terms are in units of
cycles. These variables can be evaluated for a given
Julian date using the function t astron which implements
formulas in Seidelmann (1992). Their effects are
combined with the Doodson number set for a particular
constituent fi0 ; j 0 ; k0 ; l 0 ; m0 ; n0 g into the astronomical
argument Va i0 t j 0 s k0 h l 0 p m0 N 0 n0 p0 : Sets
with a common i0 are called a species (thus the slow,
diurnal, and semidiurnal species for i0 0; 1; and 2;
respectively), and sets with common i0 j 0 k0 are called a
subgroup. The constituent frequency s is dened as s
2p dVa =dt: The tidal potential is then written in the form
"
3
X
X
Gi0 y
A0i0 j 0 k0 l 0 m0 n0 cos2pVa
V
i0 0
Gi00 y
j 0 k0 l 0 m0 n0
B0i0 j 0 k0 l 0 m0 n0
#
sin2pVa :
j 0 k0 l 0 m0 n0
For a given Doodson number set either A0 or B0 is nonzero, but not both. These constants are tabulated and
stored in data structures that can be loaded using
t getconsts. The geodetic functions Gi0 and Gi00 vary with
species i0 and latitude y; and also depend on such
931
3. Phase/amplitude estimates
The algorithm used here for making phase and
amplitude estimates is based on algorithms and FORTRAN code described by Godin (1972), Foreman
(1977), and Foreman (1978). However, unlike those
authors we use complex algebra directly rather than deal
with sine and cosine ts separately. This has the
advantage of unifying the treatment for scalar (e.g.,
pressure) and vector (e.g., horizontal currents) time
series which are represented as complex numbers u iv:
Note that the complex form for currents is based on a
physical model of a rotating current vector, and is only
valid for linear or nearly linear tidal waves. In some
cases it may be better to treat, e.g., along and acrosschannel currents as two separate scalar time series.
Consider a time series of observations yt; t
t1 ; t2 ; y; tM arranged in a vector, where the observation
times are regularly spaced at an interval Dt (default 1 h)
and M is an odd number (an endpoint is discarded if
required). The time axis is dened such that the origin
(or central time) is at tM1=2 : Some missing observations can be handled by using a missing data marker
in the input vector (by MATLAB convention this is
NaN, the IEEE arithmetic representation for Not-aNumber). This regular interval restriction does not arise
from the least-squares t itself but rather from the
automated constituent-selection algorithm and is also a
requirement when spectra are estimated in one of
the condence interval algorithms. This time series
may be composed of either real or complex numbers.
The time series is passed to the analysis program t tide
along with a variety of (mostly optional) parameters.
The tidal response is modelled as
X
xt b0 b1 t
ak eisk t ak eisk t ;
2
k1;y;N
932
lk jak j jak j;
yk
angak angak
mod 180;
2
gk vk angak yk :
9
10
4. Condence intervals
One drawback of classical harmonic analysis is that
the degree to which a given constituent represents true
tidal energy as opposed to the energy of a broad-band
non-tidal process is not determined. This is useful
information for two reasons: rst, it allows one to make
better estimates of the tidal behavior, and second, it can
allow one to quantitatively compare different analyses.
There are two steps to producing condence intervals.
First, we must form an estimate of the characteristics of
non-tidal or residual noise affecting the ak (or Ak ; Bk ).
Second, we must convert these estimates into condence
intervals for the standard parameters through a nonlinear mapping. We discuss the situation of real time
series rst.
4.1. Residual noise (real)
After the harmonic analysis for an N-point real time
series yt is performed, we examine the structure of
the residual series. In the simplest situation, the residuals
are statistically Gaussian and uncorrelated in time. If
this is the case then the total residual power PT s2x
P=Dt; where P is the two-sided spectral density. The
amplitude of the t to sine and cosine terms (A and B;
respectively) will be contaminated by errors arising from
unresolved noise components within a frequency interval of Df NDt1 around the line. Thus s2A s2B
PDf s2x =N: It is unlikely that a geophysical series will
be spectrally at, and a more sophisticated approach
used in t tide is to nd a local value of P suitable for
constituents in that neighborhood by making a spectral
estimate from the residual time series (i.e., after the
removal of all tted constituents) and averaging
the power over frequency bins in a window around the
frequency of any constituent, neglecting bins in which
tted constituents reside. Here we chose a sequence of
windows of width 0.4 cpd centered on 1; 2; 3; y cpd
(actually on multiples of the M2 frequency, see the code
for details). The value of P appropriate to, say, semidiurnal constituents would be estimated from the second
of these bins.
933
934
6
5
4
3
2
1
0
190
200
210
220
Yearday
230
240
250
210
220
Yearday
230
240
250
(A)
6
Elevation (m)
4
2
0
2
190
(B)
200
10
Amplitude (m)
10
10
10
(C)
360
0.4
270
180
90
0
0
(D)
0.2
frequency (cph)
0.2
frequency (cph)
0.4
Fig. 1. Tuktoyuktuk analysis example. (A) Raw time series. (B) Upper curve is residual time series after removal of tidal signal. Lower
curve is synthesized tidal series using signicant constituents. (C) Amplitude of all analyzed components with 95% signicance level.
Note frequency dependence. Signicant constituents are marked with solid circle. (D) Phase of signicant constituents with 95%
condence interval.
935
936
s2Bi
12
@Bi
become large. Some analytical simplication is possible
by assuming that all four variables are independent.
The bootstrap approach can also be applied to the
complex coefcients ak : One minor complication that
arises is that unless the noise is circular s2u s2v ; suv
0; the errors in ak and ak are correlated with each
other. The bootstrap process requires the generation of
correlated noise replicates.
5. Example
The analysis of an example data set provided in
Foreman (1977) is shown in Fig. 1 and Table 1. This
example is included in datale t example.mat. The
example data set consists of 66 days of hourly elevations
with a 3 day gap. A tidal variation is visible superimposed on subtidal variability. The time series can be
loaded and analyzed using the demonstration script
t demo. Code within this script illustrates how the
programs are called. In this example, the automated
constituent selection algorithm is used and it selects 35
constituents. In addition, one shallow water constituent
M10 is manually added and two other constituents
analyzed via inference. The P1 constituent is inferred
from K1 ; and K2 is inferred from S2 : Nodal corrections
are performed. A linear trend is not included in the
analysis. The coloured bootstrap analysis is used to
determine signicance and condence intervals. Table 1
gives the output of the program. In the rst column the
name of the constituent is given. Signicant constituents
(those with SNR in the last column > 1) are marked with
a *. The SNR is the squared ratio of amplitude (third
column) to the error in amplitude (fourth column). The
error factors (and hence SNR) will change slightly in
repeated analyses due to the stochastic nature of the
bootstrap procedure but amplitudes and phases themselves will be invariant. Frequencies (rst column) are
listed in cph and Greenwich phase/phase error (fth and
sixth columns) in degrees. Eleven constituents were
judged to be signicant (only 6 would be signicant at
6. Summary
Separation of tidal and non-tidal energy is an
important task in any analysis of oceanic time series.
Here, we discuss the theoretical foundation and implementation details of a MATLAB package for
classical harmonic analysis. The package can also
compute condence intervals for the tidal parameters
using one of three different sets of assumptions about
the structure of residual noise. An example is provided
to show typical results. The code is available at http://
www.ocgy.ubc.ca/~rich, or the IAMG Server.
Acknowledgements
Elements of this MATLAB toolbox for tidal harmonic analysis were developed over the last few years
as part of the authors research into tidal phenomena.
We want to rst acknowledge Mike Foremans major
contribution in providing the FORTRAN codes
and documentation to the community in 197778 that
served as our starting point. Rich Signell rst derived
the formulae for the linearized error analysis used here,
and Julio Candela and Jim Irish also provided useful
input. Support for this effort was provided by Natural
Sciences and Engineering Research Council of Canada
under grant OGPO194270 (RP) and the National
Science Foundation and Ofce of Naval Research (SL
and RB).
References
Doodson, A.T., 1954. Appendix to circular-letter 4-H. The
harmonic development of the tide-generating potential.
International Hydrographic Review 31, 3761.
Efron, B., Tibshirani, R.J., 1993. An Introduction to the
Bootstrap, Vol. 57. Monographs on Statistics and Applied
Probability. Chapman & Hall, New York, 436pp.
937
Godin, G., 1991. The analysis of tides and currents. In: Parker,
B.B (Ed.), Tidal Hydrodynamics. Wiley, New York,
pp. 675709.
Jackson, L.E., 1986. Digital Filters and Signal Processing.
Kluwer Academic Publishers, New York, 259pp.
Jay, D.A., Flinchem, E.P., 1999. A comparison of methods for
analysis of tidal records containing multi-scale non-tidal
background energy. Continental Shelf Research 19,
16951732.
Munk, W.H., Cartwright, D.E., 1966. Tidal spectroscopy and
predication. Philosophical Transactions of the Royal
Society of London, Series A 259, 533581.
Seidelmann, P.K. (Ed.), 1992. Explanatory Supplement to
the Astronomical Almanac. United States Naval Observatory, Mill Valley, Calif., University Science Books.
752pp.