Going down the rabbit hole – Tides

It started with nothing… A number of years ago I had built a twitter bot that each morning published a summary of the daly weather with tidal information. Data was pulled from a Weather Underground API with some tweaks to their tide information so it matched our current tide patterns. Every morning around 6am, a little program running on a Raspberry Pi would pull the data from weather underground and then send out the tweet. 

A couple of months ago, this stopped working. 

IBM purchased Weather Underground, and shut down the service the provided the data.

No problem I thought – this time I will go to the source and instead of using a private company, I’ll get the data from the government. Plan is to start with tides, as this is less readily on the multitude of iPhone weather apps I have.

Initially I had a few ideas:

  1. Pull from API: looks messy. 
  2. NOAA publish forecasts info for the next 3 years. Use this

Then I thought… hang on… I can take [2] and generate a formula for the tides. If not by myself, surely I could write sorting in R or python to do the same. Time for a little research… Without trying to actually do this, it appears the problem is more difficult than I initially thought.

Because of the numerous uncertain and, in some cases, completely unknown factors of local control mentioned above, it is not feasible to predict tides purely from a knowledge of the positions and movements of the moon and sun obtained from astronomical tables. A partially empirical approach based upon actual observations of tides in many areas over an extended period of time is necessary. To achieve maximum accuracy in prediction, a series of tidal observations at one location ranging over at least a full 18.6-year tidal cycle is required. Within this period, all significant astronomical modifications of tides will occur.

https://tidesandcurrents.noaa.gov/restles6.html

That seems like more work than I want to do, so I’ll just download the tables for the next three years and update them as and when needed.

But then I go interested in why. Turns are two main drivers of tides – gravity of sun and moon. While we think the moon rotates around the earth, it actually rotates around the Barycenter of the earth-moon system which happens to be about 25% inside the earth’s crust.

Two bodies with a major difference in mass orbiting a common barycenter internal to one body 

The relationship between the earth and moon is considered a two-body problem. If you show in the sun, it becomes a three-body problem, and no closed form solution exists for this.

Following this further into orbital mechanics, stable and unstable Lagrangian Points and a whole lot more.

Back to the original problem – getting my twitter bot up and running. Nothing more done yet other than downloading the next three years tide data. I do intend to get this fixed relatively soon, and also try get an instagram bot up and running with the same data using archived local pics similar to what Warren Ellis has been doing.  

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>