You are here

Week 2 - Debugging, segfaults, and progress

​This week, I spent most of my time with the python debugger, going line by line through my code to see why everything wasn’t working as it should. After some consideration, I decided to approach the data processing part in a different way. Turns out, the processing library I had been looking through already contained utilities to extract station data. However, I hit a brick wall when I started getting cryptic segfault errors. I spend the rest of the day Monday trying to get this code to work, but to no avail.

Tuesday, I looked through my code with Jesse and we finally figured out what was wrong. With everything working, I used the time series plot to plot the data I had extracted. Success! 

However, I still had a lot more work to do. The plot above shows a continuous time series over several days. What I wanted was a profile plot, broken up for every half hour. This meant that I had to write my own functions for creating such a plot. 

The next day, I read through the documentation for matplotlib, the python library that I was going to use to actually draw the plots. When I was familiar enough with the library interface, I started drafting some code for the velocity plots. Plotting the velocity curves for each time period wasn’t too hard; however, there was no method of filling the area between the curves. In that case, I used a trapezoidal approximation to fill the area, which worked out pretty well in the end. By the end of the week, I had finally reimplemented the velocity plots colored by salinity in Python.