Month: September 2014

Python, Matplotlib, and Surf Reports

waveplot-r6290.pyIt took me a long while to fall in love with Python (the language). It was mostly because the features I ended up liking were hidden behind the giant flaw in the foreground: mandatory matching white space. That means that, unlike in most other programming languages, Python decides that two lines belong together if they are preceded by exactly the same white space. If the white space doesn’t match, Python complains.

I won’t go into details here. Suffice to say that I ended up loving what lies beyond that fatal flaw. The Python developers created an environment where things are easy, and expected. Python tries to do what’s intuitive most of the time, and that makes it so much easier to work with.

So I decided to use it instead of my old staple, Tcl. Tcl was really marvelous in certain aspects, but it had gotten little love lately. Tk, its GUI, was once the gold standard of graphical user interface scripting, but it looks dated and weird now. So I started porting all my old scripts from Tcl to Python, to see how much time it would take and if they’d get longer or shorter.

What do you know, programming was a breeze. Python has libraries for pretty much anything you could wish, sometimes it’s a bewildering amount of choices. So all my scripts ended up being significantly shorter, faster, and easier to read.

Once I was done with my scripts, I started looking for a new challenge. I came up with the idea of taking the NOAA chart for the Torrey Pines buoy and making it look better and more informative.

plot wave.phpHere is the original chart. Notice how wave heights are simply plotted without averaging out anything. That’s very confusing and doesn’t give a good picture of the current waves – especially because the data is accurate only to 10 cm and the jump from one level to the next is quite high.

So I thought I could do better. I decided I would create a graph with configurable memory that would average waves out, so that I’d get a smoother picture of what’s happening. To do so, I’d have to figure out how to get the data, and what kind of data visualization was offered in the Pythonic world.


Glassy at the Secret Spot

What do you know, we found a new secret spot. It’s not really secret, it’s just that it’s not widely considered a good surf spot, but it really is. I am not going to tell you where it is, and I am not going to post any pictures, but believe me, it’s sweet.

It was Saturday morning, a week ago. The remainder of the hurricane swell was still grazing our coast, and my buddies and I decided to go to the secret spot. As we walked down to the beach, we could see the gentle waves rolling in at an angle, creating long lefts that looked simply too much fun to let go.

Paddling in was amazing. The water is still so warm, you almost feel like in Hawai`i. I somewhere heard that it’s about 7 degrees warmer than normal for this time of the year. You won’t hear any complaints from surfers, especially because it is seemingly too hot for stingrays (haven’t seen one in months).

The lineup was unusually crowded. Not as crowded as at the more famous spots nearby, but still too crowded for us. After all, we were used to sitting in the water by ourselves, only occasionally joined by a dolphin or a wayward human wader.