The Tide

Something that was unexpectedly difficult for me was calculating the state of the tide as a percentage so I decided to post what I came up with in-case someone needs it.

It takes one of the day’s high tide times and the time you wish to know the percentage of, both in hours.

public function get_level($high, $time){
    return cos(pi()/6.2103 * ($time - $high)) * 50 + 50;
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.