TIME SERIES DATA ANALYSIS IN OCEANOGRAPHY Chunyan Li is a course instructor with years of experience in teaching physical oceanography, estuarine dynamics, weather analysis, calculus, and time series analysis. This book is for students and researchers interested in oceanography and other subjects in the Earth sciences who are looking for complete coverage of the theory and practice of time series data analysis using MATLAB. This textbook provides an introduction to the topic’s core theory with examples and exercises, many drawn directly from the author’s own teaching and research experiences. The book discusses many concepts, including time; distance on Earth; wind, current, and wave data formats; finding a subset of moving platform-based data along planned or random transects; error propagation; Taylor series expansion for error estimates; the least squares method; base functions and linear independence of base functions; tidal harmonic analysis; Fourier series and the generalized Fourier transform; discrete Fourier transform and fast Fourier transform; power spectrum, cospectrum, and coherence; convolution and digital filteringtechniques;samplingtheorems;finitesamplingeffects,windowfunctions, andreductionofsidelobeeffects;rotaryspectrumanalysisforvelocityvectortime series; short-term Fourier transform; wavelet analysis; and EOF analysis. chunyan li is a professor in the Department of Oceanography and Coastal Sciences, College of the Coast and Environment at Louisiana State University. HeisDirectoroftheWave–Current–SurgeInformationSystem(WAVCIS),partof the Gulf Coastal Ocean Observing System (GCOOS), which collects real-time meteorological and oceanographic data. Li’s research focuses on coastal physical oceanography, estuarine dynamics, ocean observations, atmospheric–oceanic observing systems, storm surge, and severe weather-induced ocean response. He haspublished120peer-reviewedpapers,manyofwhichhaveinvolvedoceantime seriesanalysisandassociatedtheoriesanddynamicalprocessesinestuariesandthe coastal ocean. TIME SERIES DATA ANALYSIS IN OCEANOGRAPHY Applications Using MATLAB CHUNYAN LI LouisianaStateUniversity UniversityPrintingHouse,CambridgeCB28BS,UnitedKingdom OneLibertyPlaza,20thFloor,NewYork,NY10006,USA 477WilliamstownRoad,PortMelbourne,VIC3207,Australia 314–321,3rdFloor,Plot3,SplendorForum,JasolaDistrictCentre,NewDelhi–110025,India 103PenangRoad,#05–06/07,VisioncrestCommercial,Singapore238467 CambridgeUniversityPressispartoftheUniversityofCambridge. ItfurtherstheUniversity’smissionbydisseminatingknowledgeinthepursuitof education,learning,andresearchatthehighestinternationallevelsofexcellence. www.cambridge.org Informationonthistitle:www.cambridge.org/9781108474276 DOI:10.1017/9781108697101 ©ChunyanLi2022 Thispublicationisincopyright.Subjecttostatutoryexception andtotheprovisionsofrelevantcollectivelicensingagreements, noreproductionofanypartmaytakeplacewithoutthewritten permissionofCambridgeUniversityPress. Firstpublished2022 AcataloguerecordforthispublicationisavailablefromtheBritishLibrary. LibraryofCongressCataloging-in-PublicationData Names:Li,Chunyan(Oceanographer),author. Title:Timeseriesdataanalysisinoceanography:applicationsusingMATLAB/ChunyanLi. Description:Cambridge,UnitedKingdom;NewYork,NY:CambridgeUniversityPress,2022.|Includes bibliographicalreferencesandindex. Identifiers:LCCN2021037860(print)|LCCN2021037861(ebook)|ISBN9781108474276(hardback)| ISBN9781108697101(epub) Subjects:LCSH:Oceanography–Statisticalmethods.|Time-seriesanalysis.|MATLAB|BISAC:SCIENCE/ EarthSciences/Oceanography Classification:LCCGC10.4.S7L52022(print)|LCCGC10.4.S7(ebook)|DDC551.46072/7–dc23 LCrecordavailableathttps://lccn.loc.gov/2021037860 LCebookrecordavailableathttps://lccn.loc.gov/2021037861 ISBN978-1-108-47427-6Hardback CambridgeUniversityPresshasnoresponsibilityforthepersistenceoraccuracy ofURLsforexternalorthird-partyinternetwebsitesreferredtointhispublication anddoesnotguaranteethatanycontentonsuchwebsitesis,orwillremain, accurateorappropriate. Contents Preface page xiii Acknowledgments xv 1 Introduction 1 About Chapter 1 1 1.1 Some Definitions and Concepts 1 1.2 Background Knowledge 6 1.3 About Wind, Current, and Wave Directions in 2-D 10 Review Questions for Chapter 1 17 Exercises for Chapter 1 18 2 Introduction to MATLAB 19 About Chapter 2 19 2.1 MATLAB: A Matrix Lab 19 2.2 More on MATLAB 21 2.3 Programming Efficiency 26 2.4 MATLAB Built-In Functions and Constants 27 2.5 Examples of Working with Spatial Data 36 2.6 Selection of Data from Moving Platforms 43 Review Questions for Chapter 2 49 Exercises for Chapter 2 49 3 Time and MATLAB Functions for Time 53 About Chapter 3 53 3.1 Time Is of the Essence 53 3.2 MATLAB Functions for Time Strings, Time Vectors, or Time Conversion 54 3.3 Caution on Using Local Time 57 v vi Table of Contents 3.4 Solar Time, Mean Solar Time, and Greenwich Mean Time (GMT) 59 3.5 Stellar or Sidereal Time 61 3.6 The Difference between Stellar and Solar Times 61 3.7 Coordinated Universal Time (UTC) 62 3.8 The Angular Speed of the Earth’s Rotation 63 3.9 Julian Day Number 63 3.10 Julian Century 66 3.11 Time and Longitude 66 3.12 GPS Data 67 3.13 Interpolation 70 3.14 Elapsed Time Computation 73 Selected MATLAB Commands in This Chapter 75 Review Questions for Chapter 3 76 Exercises for Chapter 3 76 4 Deterministic and Random Functions 78 About Chapter 4 78 4.1 Deterministic Functions 78 4.2 Random Process and Ergodic Process 80 4.3 Covariance Functions and Correlation Function 85 Review Questions for Chapter 4 89 Exercises for Chapter 4 89 5 Error and Variability Propagation 90 About Chapter 5 90 5.1 Source of Error 90 5.2 An Example of Overflow Error for a Large Value 93 5.3 An Example of Overflow Error 94 5.4 Absolute and Relative Errors 95 5.5 Relative Errors of Subtraction and Addition 95 5.6 Relative Errors of Multiplication and Division 98 5.7 Variability Propagation 99 5.8 Examples 100 5.9 Note on Relative Error 105 Review Questions for Chapter 5 106 Exercises for Chapter 5 107 6 Taylor Series Expansion and Application in Error Estimate 110 About Chapter 6 110 6.1 Taylor Series Expansion 110 Table of Contents vii 6.2 The Essence of Taylor Series Expansion 114 6.3 Some Examples 114 6.4 Some Examples of Taylor Series Expansion 116 6.5 An Example Using Taylor Series Expansion for Error Estimate 117 6.6 Taylor Series Expansion for Two Variables 120 6.7 Taylor Series Expansion for Multiple Variables 122 6.8 An Example of Taylor Series Expansion for an Array of Functions with Multiple Variables 124 Review Questions for Chapter 6 128 Exercises for Chapter 6 128 7 Spherical Trigonometry and Distance Computation 130 About Chapter 7 130 7.1 Need for Spherical Trigonometry 130 7.2 A Few Definitions 131 7.3 The Measure of “Distance” in Spherical Trigonometry 133 7.4 Laws in Spherical Trigonometry 136 7.5 Calculation When the Angle Is Small 139 Review Questions for Chapter 7 141 Exercises for Chapter 7 141 8 A System of Linear Equations and Least Squares Method 143 About Chapter 8 143 8.1 Linear Equations and Matrix Operation 143 8.2 A MATLAB Example to Solve an Equation 148 8.3 Inverse Matrix 149 8.4 A Different Approach of MATLAB 150 8.5 A Concept of Rank for Matrix 152 8.6 A General Discussion on the Solution of Linear Equations 153 8.7 Examples of Least Squares Method 157 8.8 Coefficient of Determination of Linear Models 163 Review Questions for Chapter 8 163 Exercises for Chapter 8 164 9 Base Functions and Linear Independence 165 About Chapter 9 165 9.1 Base Functions 165 9.2 Linear Dependence and Linear Independence 166 9.3 An Example of Simple Tide 168 9.4 Examples of Improper Base Functions 172 viii Table of Contents 9.5 More Discussion 173 Review Questions for Chapter 9 176 Exercises for Chapter 9 177 10 Generic Least Squares Method and Orthogonal Functions 178 About Chapter 10 178 10.1 Inner (Dot) Product 178 10.2 Generic Least Squares Method 181 10.3 Generic Least Squares Method 182 10.4 Geometric Meaning of Least Squares Method 186 Review Questions for Chapter 10 189 Exercises for Chapter 10 189 11 Harmonic Analysis of Tide 190 About Chapter 11 190 11.1 About Tides 190 11.2 Harmonic Analysis of Tides 194 11.3 Appendix: Tide-Generating Force 199 Review Questions for Chapter 11 205 Exercises for Chapter 11 205 12 Fourier Series 207 About Chapter 12 207 12.1 Linear Combination of Sinusoidal Functions 207 12.2 Least Squares Method for Continuous Functions 210 12.3 The Convergence of Fourier Series 218 12.4 Some Comments on Fourier Series 220 12.5 Examples of Fourier Series and Gibbs Effect 221 12.6 Additional Properties of Fourier Series 226 Review Questions for Chapter 12 228 Exercises for Chapter 12 228 13 Fourier Transform 230 About Chapter 13 230 13.1 Periodic Function and Discrete Spectrum 230 13.2 From Fourier Series to Fourier Transform 232 13.3 Power Distribution in Frequency Domain 237 13.4 Recap: From Least Squares Method to Fourier Transform 239 Review Questions for Chapter 13 240 Exercises for Chapter 13 240 Table of Contents ix 14 Discrete Fourier Transform and Fast Fourier Transform 242 About Chapter 14 242 14.1 The Discrete Fourier Transform 242 14.2 The Fast Fourier Transform 247 Review Questions for Chapter 14 264 Exercises for Chapter 14 264 15 Properties of Fourier Transform 267 About Chapter 15 267 15.1 Additive Property 267 15.2 Symmetric Properties 268 15.3 Similarity Property 269 15.4 Time Delay Property 271 15.5 Frequency Delay Property 271 15.6 Time Derivative Property 272 15.7 Frequency Derivative Property 272 15.8 Time Integration Property 273 15.9 Frequency Integration Property 274 15.10 Time Convolution Property 274 15.11 Frequency Convolution Property 275 15.12 Complex Conjugate Property 276 15.13 Integral Form of Parseval Formula 277 Review Questions for Chapter 15 277 Exercises for Chapter 15 277 16 More Discussion on the Harmonic Analysis and Fourier Analysis 279 About Chapter 16 279 16.1 Comparison between Harmonic and Fourier Analysis 279 16.2 Examples 283 16.3 Summary 304 Review Questions for Chapter 16 306 Exercises for Chapter 16 306 17 Effect of Finite Sampling 308 About Chapter 17 308 17.1 The Effect of Truncation 308 17.2 The Effect of Discrete Sampling 323 17.3 Discussion on Aliasing 328 18 Power Spectrum, Cospectrum, and Coherence 331 About Chapter 18 331