A plug for Python in our curriculum

Some of my colleagues and students  are already all-too-familiar with my conviction that Python is rapidly supplanting MatLab, IDL, and similar proprietary languages as the “go-to” language for routine analysis in the atmospheric sciences.  Here, I argue that I have good company in that belief.   See, for example, this announcement from the previous AMS annual meeting in Austin. The AMS has not only featured a full weekend of Python short courses for each of the past several annual meetings, but there is also a Symposium on Advances in Modeling and Analysis Using Python, the 4th of which will be held at the upcoming meeting on Saturday, Feb. 1.  Browsing the symposium program gives just a hint of the many ways in which Python is being embraced as an easy-to-learn yet highly flexible, powerful, and well-supported programmingenvironment for research in our field. NCAR has also made a major commitment to supporting Python with its PyNGL package (see also the 2005 announcement).

A case can be made — and I will undoubtedly continue to try to make it in the coming months, especially as we continue our strategic planning — that we should begin systematically folding scientific Python into those  undergraduate and graduate courses that provide reasonable opportunities for programming experience. I do so already in both ATM OCN 330 (Atmospheric Physics I) and ATM OCN 640  (Radiation), despite being a relative newcomer to the language myself, but I think the benefits could be multiplied by repeating the students’ exposure to it through later courses as well.

My experience to date with Python in the classroom has been very positive.  Syntactically, Python is far cleaner and more intuitive than most languages.  For novice programmers, object-oriented programming (OOP) is arguably easier to grasp in Python than in either Java or C++.  Once installed on our lab computers, there is no need to manage (or pay for) a license; moreover, a student can easily install it for free on their own laptop or office computer, whether Windows, Linux, or Mac OS X.  And there is easy-to-use and highly flexible graphics support via MatPlotLib. 

Students moving on to “serious” research will find that there’s relatively little that MatLab or IDL can do that Python (and its freely available scientific and mathematical libraries) can’t, whereas the reverse is not true. This is not to discount the continued importance of Fortran or C for numerically intensive applications, like NWP models, but even here, there is a natural marriage between Python (as the front-end) and either Fortran or C (as the close-to-the-metal computational engine), using f2py or Cython. To my knowledge, at least, it’s very difficult to do something similar in MatLab or IDL. For those who have the patience for a lengthier (and more technical), discourse on the merits of Python vs., say, MatLab for scientific analysis, here’s one more link.

To summarize my view:  Python  can serve both as novice-friendly introduction to scientific programming in the classroom and a powerful foundation for serious scientific programming in support of research.  If our department were to coalesce around Python as “the” preferred programming environment for most routine computing tasks, we could graduate students with a very solid and marketable foundation in the language and in scientific programming.   We would also create a critical mass of Python users who can support each other with tasks ranging from simple homework assignments to advanced data analysis and plotting tasks.

Comments are closed.