BAMOS
Sept 2017
Research Corner
with Damien Irving
31
A PyAOS masterclass
Immediately prior to the joint AMOS–ICSHMO in Sydney next
February, I’ll be running a one day Python masterclass. The
class will be targeted at people who are already using Python
in the atmosphere and ocean sciences (i.e. “PyAOS”). They don’t
necessarily need to be highly proficient in Python, but a strong
familiarity with the syntax and basic constructs such as loops,
lists and conditionals (i.e. if statements) is required.
In thinking about what topics to cover at the masterclass, I’ve
decided to focus on a suite of programming concepts and
best practices that aren’t so easy to glean from a quick Google
search. In other words, we aren’t going spend time learning the
specifics of how to create a beautiful plot using the iris library or
calculate a monthly anomaly timeseries using xarray (although
people will be exposed to some of this stuff along the way),
because those are things that people can easily look up for
themselves (e.g. here and here, in this case).
The basic rationale behind this decision is that the main
difference between being an “adequate” and “advanced” Python
programmer is not how familiar you are with the specifics of any
particular library. Instead, it is your ability to (a) write readable,
reusable and testable code, (b) construct workflows that are
reproducible, and (c) to understand the scope, strengths and
limitations of the scientific Python ecosystem. The latter is
important not only for picking the right library for the right job,
but also for understanding what is (and isn’t) possible in your
data analysis.
Here’s an overview what I’m thinking of teaching at the
moment, with links to the associated online content (comments
welcome). It’s basically a selection of short tutorials that I’ve
written for other audiences over the past few years and lessons
taken directly from Software Carpentry. I’m hoping the class will
be something of a two-way conversation between myself and
the attendees, as I certain ly don’t profess to know everything
there is to know in this area.
1. Managing your Python environment with Conda
2. Introduction to functions and modular code
3. Version control using Git
4. A practical data analysis example (which covers data
management, data provenance and writing Python scripts
that can be executed from the command line)
5. Debugging and profiling
6. Testing and defensive programming
7. Tour of the PyAOS software stack
If time permits (and it probably won’t) I’d like to finish with a
lesson on workflow management using Make.
As the AMOS–ICSHMO conference gets closer, I’ll be collating
the content above into a complete one-day course for
AOS scientists hosted by Data Carpentry. This is a sibling
organisation to Software Carpentry that focuses on discipline
specific lessons, and I’m hoping that by hosting the materials
with them, others can use the lessons and collaborate with me
on their development into the future.