Now that I am back from the ACO cruise, I am back to the office and back to my neglected friend, Matlab. I am making my brain and fingers work in different ways. There will be less pondering on the hydrodynamics of ADCP hard hats and visualization of physical things and more pondering on the algebra of matrices and visualization of columns of numbers. I will coax my fingers out of trying to lash computers to desks and books to bookshelves in favor of tapping away Matlab commands until the error responses disappear. The adjustment has already begun and successes in creating multicolored graphs have given me energy to pick up where I left off – that is, if I can find where I left off.
Looking at my notes from a month earlier, Matlab is again a language foreign to me. It took me the better part of an hour to even decipher what my task had been: plot depth data from the CTD against wire out data from the Caley crane to determine their synchrony. The CTD will give the more accurate data set, so this is mainly to test the accuracy of the Caley. Once I determined my task, it seemed simple. Almost immediately it proved much harder when the two data sets had different frequencies – one at 2 Hz, one at 1 Hz. I needed to assign time to the CTD data set to match that of the Caley crane. Last month, I tried to stuff them into the same graph on different axes and approximately line them up. Lining them up properly proved futile to so I moved on to assigning each CTD data point a year, month, day, hour, minute and second. Year, month and day were easy – it all happened on April 12, 2011. Seconds were less cooperative because the data frequency was 2 Hz. Joseph helped me ask Matlab to take each row and assign it a seconds value equal to the row number multiplied by ½ – since each row is a step of half a second. With a long wait – Matlab had to calculate this for over 13000 rows – I had a column of cumulative seconds.
Just when I was about to bang my head against my computer to figure out how to assign hours and minutes to the CTD data, Craig and his magic fingers arrived. He informed me of a clever Matlab function called “datenum” that assigns a serial number to a date in decimals of a day. Given the datenum of the start of the cast, in this case 01:16:29 April 12, 2011 is 734,605.05, I could add the seconds to it as a fraction of a day – 1 second equals 1/86400 of a day. Matlab made converting the Caley data to this form easy as well, so shortly I had two synchronized data sets. Plotting this showed an expected and somewhat boring result: the depth profile lines matched up.
Plotting wire speed – the variable that is most concerning for the safety of the equipment during a cast – would be more exciting. The Caley crane supplies a column of wire speed pre-calculated so only the CTD data needed attention. With a simple rate = distance/time calculation, the two data sets were ready to be plotted. To be able to reference at what depth the wire speeds occurred, I added a depth profile to the chart in the same timescale. Though this meant battling with the double axes that had been so troublesome a month before, I ended triumphantly with a graph in three colors, two axes, and one timescale. The battles ahead will be the fancy stuff: labeling axes and giving titles.