Part 4: Python's snakey problems could stump Leonardo

by Jacqui Fenwick

Leonardo da Vinci once said 'Learning never exhausts the mind'.

Some 450 years later, rudimentary programming languages were born.

In 1991, around 500 years after da Vinci's insight, Python scripting was established.

In 2015, sitting at my desk in the Climate Change Research Centre, my mind is exhausted.

Times have changed, Mr da Vinci.

In the past week I have had two branches of focus.  The first was to modify an existing programming script so that, when executed, it would give me information about the Excess Heat Indices for every day of the year, rather than giving me a variety of annual (as opposed to daily) statistics. 

This sounds straightforward, to be fixed with a good old switcheroo from '1' to '365', yes? 

Not so. 

If an Index relies on the prior 30 days of data, the first year can't have 365 days. When summer runs between two years, the final year also won't have 365 of data either. And leap years? Yes, leap years. So that was a challenge, with days of brain pain, but, finally, Team Jacqui scored a goal and succeeded in getting a daily output.

As is the case in most fields of scientific research, it can take a lot of trial and error, perseverance, patience, documentation and a bit of luck, to finally reach the result you're looking for.  And when that happens, it's oh so satisfying!

My second branch of focus in the last week or so has been data output.  I wanted to know how many heatwaves have occurred per year for the last century, what their average magnitude is, how early in the summer the first heatwave arrives, and a handful of other heatwave stats. Then I wanted to change some of the parameters used to define those heatwaves (for instance, instead of looking at days with temperatures in the top 10%, why not the top 6%,8%, 12% or 14%?) and compare the results. 

To make things easier, to start with, I wanted to look at one single location. I chose Melbourne, because  I know that the data records are good for that area and the south east of Australia seems to be bombarded with heatwaves quite often these days. And off I went!  I have now generated my suite of heatwave statistics with 20 slightly different calculations – changing only one aspect of the calculations at a time. Making preliminary plots of the data, to get a feel for it. It's amazing to see how minor tweaks in one aspect of the calcs can have a huge impact on the outputs generated, whereas other tweaks have negligible impacts.

My task for the coming week will be to do the same for another few locations and Australia as a whole, and then start making some sense of the results.

UNSW logo ANU logo Monash logo UMelb logo UTAS logo