Hacker News new | past | comments | ask | show | jobs | submit login
Rust and Raspberry Pi Tide Clock (thefuntastic.com)
98 points by zdw on Oct 7, 2020 | hide | past | favorite | 14 comments



My first mobile app was a 2012 “Beach Weather app” called SafeSands (no longer available for... many reasons) that I made as a project in college. I grabbed weather data from iGoogle’s private API (which they turned off 4 months later) and tidal data from NOAA’s legit public API.

One issue I ran into was the irregularities described in this article. The other was that the tidal data available through NOAA’s API was from NOAA tidal stations which were (at the time) kind of sparsely placed. I ended up fielding a lot of support email due to what I’ve come to call “the Florida problem”:

As TFA notes, the Gulf of Mexico has weird tides. Also, most of Florida is a long thin peninsula. So let’s say (I forget the real locations) that NOAA has one tidal station in St. Augustine (northern FL on the Atlantic side) and one in Sarasota (mid-to-southern FL on the Gulf of Mexico side). You’re using my app in Ft. Lauderdale (southern FL on the Atlantic side). The St. Augustine location probably better reflects the tides you’ll be seeing, but the Sarasota station is closer, so the app would pull tides from there.

Solving this problem well would probably require establishing “coast domains” based on where each station is accurate (which strikes me as a nontrivial task) and you’d also need to solve for degenerate cases like if someone uses the app from somewhat inland (if they’re planning a trip to a beach a few hours away for instance).

My guess is that in the intervening 8 years someone has taken the Dark Sky approach of aggregating tidal data, figuring these things out, and selling access to an API. And that person deserves whatever money they’re making.


The author of XTide, which is mentioned in the article, touches on the topic of hydrographic data collection and publishing in the XTide FAQ:

https://flaterco.com/xtide/faq.html#60


I would think people would want to set their location, like we do for weather. Where I am might not be where I care about the current conditions, especially if I'm planning a trip.

That still leaves you the problem of the place you're interested in being halfway between two sensors that disagree about tide times. I'd think you'd have a similar problem in Puget Sound (long, narrow, oriented north-south), unless there are more sensor locations (which I bet there are).


Parent comment isn't talking about splitting the distance between two sensors, it's about the sensors being on opposite coasts.

Sarasota is on the western part of the FL Peninsula (on the Gulf of Mexico), St. Augustine is on the eastern part of the FL Peninsula.

Ft. Lauderdale is on the eastern coast of the peninsula but it's way closer to Sarasota than it is to St. Augustine so you'd be getting tide info for the completely wrong coast, not just the wrong part of your own coast.


You graph the closest station location against the circumference around the coast not distance over land.


In the scenario I outlined there, you might still get the wrong result because the Sarasota station might be closer by coastal distance too (we’re gonna gloss over the fact that coasts technically have infinite length).

The kicker here is that tides don’t necessarily transition smoothly as you walk the coastline, they can have sharp discontinuities, and so you need to manually figure out where those are and put “search barriers” on them.


> coasts technically have infinite length

Gloss indeed, I think you'd be find just doing the straight line distance between stations. Possibly radius' if it's a long way. We just need the relative distance to/from places not that actual surface area.

If that's not good enough it'd be time to skip re-inventing the wheel and use the secondary port calculation.


> In extreme places, like the Gulf of Mexico, this can be enough to reduce the regular cycle from four tides a day to just two.

i live on the coast of the Baltic sea. no tides at all. never actually understood what the fuss is about until I've been to a hotel by the ocean.


Your story seems cool, can you elaborate? I'm familiar with there being 1 or 2 tides a day, but 4?


The Isle of Wight in the UK has a quirky ‘4 tides’ a day - sort of https://www.quora.com/Why-does-Southampton-i-e-the-coast-of-...


Regarding GP’s quote, I think it depends on how you count tides. Generally high tide + low tide is considered 2 tides. So if you have high tide at 1AM, low tide at 7AM, high tide at 1PM, low tide at 7PM, that’s 4 tides.


Given the presence of Rust, I was hoping for actually calculating the tides based on the rotation of the Earth, orbit of the Moon, etc. But reading the article and comments, I realize how much more complicated that process would be than "just" modeling orbital mechanics, gravity, and fluid dynamics.

Cool DIY project nonetheless. Makes me want to dust off one of the Pis I have sitting around. I've never used the GPIO for anything, and it sounds like I'm missing out.


Great project! Tangentially, tides is one of those topics that many people have misguided notions about (only two tides, tidal bulge, effect on sun on tides, etc.). An excellent answer is provided in this Physics SE answer: https://physics.stackexchange.com/questions/121830/does-eart...


Waste of Pi. Probably. I learned on Haida Gwaii that Canada Government knows nothing of tides. Best predictor you make yourself, you observe the local High Tide and then make SIN-curve with six hours and 12.5 minutes cycle. You combine this with local sun SIN-curve, and when those oppose you have a MASSIVE tide and when they meet you have a HORROR tide. This is important because the bloody rainforest grows to the edge of the beach and little bit over. At HORROR tide you must camp in the forest with snakes, bears and snails.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: