An Introduction to Tidal Harmonic Analysis

You’re lying on the beach. You’re eyes are closed and the sun is warm. All is well. The oceans however, grow louder and louder, when suddenly a surge of water advances, and drenches you and all your belongings!

What may seem to be the ocean’s way at getting back at the humans who pollute its waters, is actually just the periodic ebb and flow of the ocean known as the tides.

In many aspects of oceanography, it is useful to separate data series such as temperature, velocity, pressure, etc… in terms of tidal and non-tidal components. For example, in my work for EUREKA, I am trying to evaluate changes in pressure (and relatedly sea level height) measured via a sensor placed on the ocean floor. I need to be able to discern changes in sea level height on the order of + 5 cm. This became a difficult proposition when I realized the sea level is constantly fluxuating on the order + 2 m multiple times a day!

If you are interested in the physical mechanisms that underlie the tides, I highly recommend the video below. For this post however, I will be focusing on the techniques oceanographers use to reduce tidal components of their data.

The Building Blocks:

Let’s acquaint ourselves with what a typical pressure signal looks like over a month long period. The blue line represents the pressure signal (measured in decibels) and the red line represents the average value of the signal over the month long period. The periodic nature of the graph easily implies a strong tidal component, although other periodic trends exist like wind forcing of the water due to a sea breeze, but no other periodic trends occur at the scale of tides in terms of consistency.

Graph 1

Our goal is to attempt to identify the tidal signal, and since it is periodic, it is a good idea to review our sines and cosines as they are useful in modeling periodic graphs.

Here is a simple sine function: y = sin(x) from 0 to 6 pi.

Graph 2

This graph is clearly periodic, but yet it doesn’t quite represent our pressure data. We can do better though! If we add some other periodic functions we will really start to see some resemblance between our pressure signal and the simple graph I created below.

Here y = sin(x) + cos(x) + sin(2x) + cos(2x) from 0 to 30 pi.

Graph 3

We can continue this process of adding up various sines and cosines until it resembles our pressure signal. In fact, mathematicians in the 18th and 19th century deduced that all periodic functions can be represented as the summation of sines and cosines.

Here is a link to a wonderful animation showing how even a couple sines and cosines can add up to look like a saw tooth!

http://bl.ocks.org/jinroh/7524988

Armed with the knowledge that any periodic function can be modeled as the summation of sines and cosines, we can in fact look at our pressure signal and determine what frequencies are present and the relative impact they have on the overall signal! Let’s not forget how powerful this tool is. Richard Feynman remarked, “It is easy to make a cake from a recipe; but can we write down the recipe if we are given the cake?” Joseph Fourier and his colleagues showed that we can have our cake, and determine its components too!

 

Breaking down the Tides, Constituent by Constituent:

If the moon orbited around the Earth in a perfect circle in the plane of the Earth’s equator and the sun were not present (A lot of assumptions!), a typical graph of a tidal signal may look like this:

Graph 4

The insight to be gained from looking at this graph is that the dynamics of our orbits with astronomical bodies influence the tides in a regular manner (i.e. at specific frequency). These specific frequencies are each given names. In the example above, it is called the M2 frequency. In the case where we now consider both the Moon and the Sun’s effects (S2) on our tides, our tidal graph may look like this:

Graph 5

Note the longer term periodic trend of the graph of about 2 weeks which corresponds with the alignment and mal-alignment of the sun and moon.

The M2, S2 and other frequencies are called constituents. They are further specified by the sum of various frequencies arising from planetary motion such as the rotation rate of the earth, the orbit of the moon around the earth and the earth around the sun, and periodicities in the location of lunar perigee, lunar orbital tilt, and the location of perihelion. (See References & Resources for additional info).

When analyzing the tidal components of our signal, anywhere from 5 – 60 constituents must be taken into account depending on the accuracy needed and the length of the raw data used. Once these tidal constituents are determined by methods of spectral analysis (See References & Resources), they are removed from the pressure signal, and a “de-tided” signal remains. This is called the harmonic method of tide analysis and was developed by Lord Kelvin and Sir George Darwin beginning in 1867. We can now evaluate the variations in pressure we care about with great precision!

The final product of de-tiding a pressure signal is shown below at Point Purisima (PUR). Note how small the variations in pressure are in the de-tided signal vs the raw pressure.

Graph 6

Graph 7

 

References & Resources

The Feynman Lectures on Physics: Volume 1 http://www.feynmanlectures.caltech.edu/I_50.html

What Physics Teachers Get Wrong about Tides!             PBS Digital Studios https://www.youtube.com/watch?v=pwChk4S99i4

Fourier Series Wikipedia https://en.wikipedia.org/wiki/Fourier_series

Harmonic Analysis and Prediction of Tides Stony Brook University http://www.math.stonybrook.edu/~tony/tides/harmonic.html

Classical tidal harmonic analysis including error estimates in MATLAB using T_TIDE (Pawloicz et. Al) 

Note: I use T_TIDE to de-tide my data.

http://www.omg.unb.ca/Oceano/fundy_tides/T_Tide_CompAndGeo.pdf

 

© 2016 JUSTIN SU. ALL RIGHTS RESERVED.

A Home Away from Home

When a power outage occurs in Isla Vista and the library closes at 2 AM, there is only one option left for me – the lab. That actually happened. I did not sleep there, of course, though I desperately needed power, warmth, and speakers that can blast me awake. Interestingly enough, I was not alone. One of the graduate students working in my lab was also there. It simply felt like home, where that oh dark hundred became one of the most productive I have been in all summer.

© 2016 JUSTIN SU. ALL RIGHTS RESERVED.

This world also contains a direct view to the ocean and the freshman dorms!

Working in Dr. Zach Ma’s lab opened a new world for me, one that I would not have expected to be in a year ago. A world that contains one of the purest, sterile water on campus, countless bags of pipette tips, and some laboratory equipment that cost more than most luxury cars. Though a chemistry major, I have always found the field of biology intriguing, and joining a cell biology lab before even taking general biology is quite a challenge and a reward. Learning biochemical techniques and operating laboratory equipment these past months were all fascinating fun, yet the reiterated realization of the difference between doing and thinking was a defining moment of this summer. Acknowledging the fact of doing from memorizing was extremely difficult until problems began to arise sporadically. Every experiment has their own situations. Doing based on understanding the scientific concepts and their rationales adapts to those situations, and would have optimized the ideal circumstances for each experiment I ran. Boy, would that help me in organic chemistry.

© 2016 JUSTIN SU. ALL RIGHTS RESERVED.

A year ago, I did not know that it was possible for a freshman to get involved in research, especially cutting-edge research. Though in research, one thing to hone in on is resiliency. No matter if your hypothesis was horrendously wrong, you go back to the drawing board and patiently and logically crank it out. As a part of a research group, I have a family that is willing to come to my aid and motivate me. I can even go to other families around campus and find ways to collaborate, whether they be ideas or equipment. Simply put, we are a family, and this is my home, where I will be making life-defining memories (and scientific discoveries, hopefully) for the years to come.

A Resource for Fellow Undergrads: Advice About Data in Professional Talks

You’ll be surprised how important this is. Remember how you learned to use Excel in junior high (or maybe earlier)? It was probably for a science project. Well, don’t worry, because as a researcher, you’ll never have to make another Excel graph in your life!

…because we use things like Origin and Igor instead.

…which are complex enough to have their own programming languages.


Why? Well, once you pull super-cool results from your research (which I’m starting to now, by the way, and it’s awesome), you’re presented with a problem: people don’t have much time, and you have a lot of information. Often tens of thousands of data points, from different tests and techniques over months of narrowly-focused work, with layers of data analysis in between, that you somehow have to compile in a way that these busy, tired people will understand.

And they don’t want to deal with lazily-made graphs.

If you think I’m making a mountain out of a mole hill, think again – it’s this kind of stuff that makes papers take years to publish. But that’s why it’s good to get a handle on it now, when you’re just starting out your career!


It’s easy to get mired in the details of each individual graphing software. You can probably use any, as long as it offers enough flexibility, so instead I’ll keep my advice general. The predominant choice here is Igor, which is the source of the plots in the “good” column. The “bad” is a combination of MATLAB and Excel.

This wisdom comes from the EUREKA program, and my research mentor.

Disclaimer: none of the “good” column graphs have titles. This is only because I like to interchange titles based on what I use the graphs for, without having to edit the graph image over and over. Always, always include a title.

Bad

M - Three times more filtering

You’ll probably see a lot of this. This is fresh out of MATLAB, and yes, something I actually sent my mentor at some point. It looks great at the time, since you’re buried in your process and don’t take a step back to look at it! But in reality,

  • The lines are too thin
  • The labels are tiny
  • Most of the labels are unnecessary, at least for a presentation
  • Two graphs are overplotted for no particular reason
  • It’s not cropped, and the axis range is poorly selected to include extraneous regions (including regions in which my filtering technique had some unprofessional hiccups!)
  • Image quality is low
  • Almost everything is whitespace or noise (extra “ink on the page” that doesn’t contribute to meaning) – which is a guaranteed way to make your graph confusing

But lastly, and most importantly, the purpose of the graph is not clear. Unless you need it to portray something, why would you show it?

Better (but not perfect)
MagneticTransition-2

This is the same analysis, but a version of it which could conceivably be used for professional work. It’s not quite what you would use for a paper (which is more formal), but it’s pretty decent for a presentation. And certainly it’s leagues ahead of the other one. The reasons why turn out to be good general tips:

  • Thicker lines
  • Bigger labels
  • Only the important and necessary things are labelled
  • Nicer colors* (this happens to coincide with color coding elsewhere in the presentation, which is another good strategy)
  • Overplotting can be fine, but if data sets cross each other, it can get confusing
  • The most important point on the graph is clearly identified
  • High image quality – never screenshot; any good graphics program will have ways to export high-resolution figures

*  Never use red and green to distinguish between different data sets on the same graph. Red-green colorblindness is surprisingly common!

** Only important in a presentation – complicated graphs are often the only way to go, in papers.

 Bad

BadCVsDopantFit

Ah, the other ancient enemy of clear presentation: the default graphs from Excel. This is something I had for personal use, to organize the outputs of my data analysis. Don’t assume that you can just put it in your slides like this!

  • Even if you’re going to explain what it means, there should minimally be some clues which are written
  • Both in the graph area and in the legend, there is duplicate data! That becomes noise to people who are trying to read your graph – or, in this case, it could make people think “Wow, that’s a really good fit!” when in fact the red points are what’s supposed to correspond to the trend line
  • Don’t use “e” or “E” for scientific notation. Write out *10^x, if you need to. Whatever takes up the fewest characters is usually the best choice, so in this case, it would be better to just use decimals!
  • There are some extra pieces which are legacies from analysis work, some points which are unverified, etc. – you will be expected to explain every single item on your graphs, and that can take time away from the good science!
  • More of the same stylistic issues as before
Better (but not perfect)
Graph0

So again, this is meant for a slide presentation. Readability and simplicity are key, as before. Here are some more things to point out:

  • Color choice is key. Notice that the red here is neither a primary color nor a default color – going slightly towards pastel from the brightest colors available to you often works well. (It comes across more clearly if you have a graph with many different colors, and makes you look like quite the professional.)
  • Credit is given to prior work – that fit line was obtained by a former group member, and previously published. If you don’t attribute work to those who did it, the assumption will be that you did – which can constitute plagiarism, with quite serious ramifications if it makes its way into a publication. Be overcautious!
  • Be creative with your axis labels. That doesn’t mean making them polka-dotted. That means choosing the format that works best for the graph you’re working with. You’ll notice that the x-axis variable is dimensionless. But I still had to convey what it meant! So rather than putting the units in parentheses, I included the chemical formula. I stopped short of explicitly pointing out the x in the formula because it’s expected that people will digest your graphs to some degree, and at some point more text just becomes noise.

I’ll leave you with a thinking point: How to deal with data that isn’t what you expected. Sometimes there are just deadlines, and you don’t have time to conduct the tests you would have to in order to correct your mistakes. What can you do? Be honest. Still choose the most effective way to present the data, even if it’s presenting your mistakes, or things you’re still seeking to understand. Most of your work is complicated. People won’t blame you for setbacks. But, as you’ll see time and time again, they’ll nail you for hiding them.

Yes, that data is going in the opposite direction of the sensibly-expected trend, and is horrendously scattered. Such is life!

Can you see the setback?

Stronger Together

IMG_2770

My mentor, Devyn Orr, and me at Tejon Ranch

One of the first things you learn when conducting field research is that almost nothing ever goes according to plan.   Whether it’s the field truck having engine issues, forgetting the food you packed for a three day camping trip, or the sun setting long before your “to-do” list is finished,  something is bound to go awry.  But all of these seemingly overwhelming issues become a lot less daunting when you aren’t the only one dealing with them.  Throughout these past couple of weeks, I’ve begun to understand what it takes to be a field biologist and how the people who are on your team with you make all the difference.

When it comes down to it, field research is all about teamwork.  Recently, we have been capturing Western Fence Lizards to scan for ticks.  We soon discovered that working in pairs was the most efficient method to catch them.  Bella, one of my fellow researchers, and I often scour plots for Western Fence Lizards, hollering when we’ve found one so we can set up an ambush.  If you’ve ever caught a Western Fence Lizard you know that they can be wicked fast but with the help of a grass noose, you can catch them if you’re smart about it.  Working in pairs is often the most efficient method for other tasks as well, such as conducting a bird survey or setting up cafeteria trials.  Though building the small mammal exclosures is technically my project, everyone pitches in to help dig the foot deep trenches and assemble the exclosures.  No one’s work in the field is truly independent and could not be accomplished without the help of many others.

I know my experience at Tejon Ranch would be radically different if not for my fellow researchers and my mentor. When you wake up at 5:45 AM after having spent the night in a tent there’s no better way to be greeted than by a beautiful sunrise and the smiles of your fellow happy campers.  And when the closest research plots are a solid 20 minutes drive from camp, there’s no better way to make time fly than shamelessly singing along to Fleetwood Mac.   Being together in the field means being there for each other, whether it’s helping each other identify species or sharing food or laughing about #fieldwork problems.  Conducting field research this summer has taught me about so much more than science and has shown me the value of surrounding yourself with smart, friendly ecologists.

Hit Me With Your Best Shot

Research isn’t like school. Having the opportunity to do research as an undergraduate is exciting and terrifying. I knew that it’d be difficult and that I would learn a lot, but I didn’t fully understand that I would be treated like an adult. I have always been a good student: reading assigned material, completing worksheets given to me and asking the teacher a lot of questions when I was confused. Research isn’t like that. For my first task there was no assigned reading, no worksheets and no teacher to guide me every time I didn’t understand. It was my responsibility to go online and find tutorials, practice, make mistakes, and only ask my mentor a few questions because he has his own assignments. Don’t be afraid to ask questions, they are there to help you but you have to understand that part of learning is to struggle on your own.

Failure is good, no really. My first assignment in lab was to learn how to use a new circuit-design software and then teach others in the lab how to use it. Two other people in the lab are familiar with the program but my main source for learning came from finding videos and tutorials online. When I learned that I had to present, I became nervous and scared that I would let my lab down and fail. After more and more struggling and messing up designs I finally started to understand. Even some help that I received was not as useful as failing on my own. Always ask for help when you need it, but understand that you learn a lot from failure.

Standing for hours in Best Buy is less fun than it sounds. I lost the charger to my laptop during the move into my apartment the day before my internship started. All nearby electronics stores were sold out of the model that I needed so I had to wait for a few days while the new charger was shipped over. With no other options, I would stand in Best Buy a for a few hours to use the showcase charger that they had for their display model. Make sure to pack things, especially important items, like a laptop charger!

Hit me with your best shot. The main purpose of research, and EUREKA, is for you to learn. Though sometimes your work and presentations will be criticized, it is important to make the distinction that it is not personal. Your main objective as a researcher, especially if this is your first time working in a lab, is to learn. Learning requires failure and criticism. Labs do not just take on any students and programs like EUREKA are even more selective. You were chosen because you have potential. So when you walk into lab with no clue what you’re doing, take a deep breath, mess up, fail, but try until you understand it. You got this.