It 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.
Here 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.