If you haven’t already guessed, I am a real math and science geek (and rapidly becoming a computer programming geek as well). So, when I got my first taste of quantitative climate analysis from Dana’s articles over at Skeptical Science, I was really interested. It will be a while before my education takes me in that direction, and I’m starting to think I’m not that patient. I would like to learn some relevant physics and programming ahead of time.
Here is my list of plans and resources, roughly in order of priority:
- Learn Fortran. The majority of code in climate models is written in Fortran, and this probably isn’t going to change any time soon. I have begun studying an online Fortran 77 tutorial, and am finding that learning a second programming language is far easier than the first (Java, in my case). The major concepts are virtually identical – it’s all a case of syntax.
- Read and do problems from some relevant chapters in my physics textbook that we will not be covering in the course: fluid dynamics and thermodynamics.
- Follow through, in detail, a derivation of a zero-dimensional energy balance model for the Earth that was kindly sent to me by a reader.
- Read David Archer’s textbook, Global Warming: Understanding the Forecast. I attempted to read it a year or two ago, but I hadn’t done very much physics yet and consequently became kind of lost (“Electrons are waves?!” the younger Kate said incredulously). Dr. Archer has also posted accompanying video lectures from the University of Chicago course the book is based on, which will help.
- Try to find a copy of Ray Pierrehumbert’s new book, Principles of Planetary Climate. From what I have heard, this will involve learning some Python.
- I have several textbooks on loan or second hand, two regarding climate physics, and one about general atmospheric dynamics.
That will probably keep me busy for some time, but I would appreciate recommendations for additions/changes!
If you haven’t already seen it, I strongly recommend Spencer Weart’s Discovery of Global Warming:
One of my favourite books ever – I wrote a review here. -Kate
Thanks Kate! Glad to know I inspired a great young mind :-)
Sorry I can’t be very helpful with specific suggestions though. My self-taught climate science mostly just comes from reading various peer-reviewed papers, and blogs of course. I always find the IPCC report a great resource when I want to learn more about a specific subject. It’s always got a useful discussion and relevant references for further reading.
Never really touched Fortran, although having said that, I may have written a few lines many years ago, using punch cards at university!
Most languages these days are a derivative of ‘C’ which was used with Unix.
The annoying thing is usually the slight differences. They can hinder you for a bit until you get used to them. But really the basic constructs are the same in all programming languages, if statements, while and for loops, switch or case statements etc.
C is the subject of a course I am planning to take next year. Sounds like it will come in handy! Thanks for the suggestions. -Kate
Just a suggestion to add to your education, you might try reading in paleoclimatology and Earth history. Bradley is a good start in the former and any book entitled Historical Geology will do.
Best of luck. You have an exciting future ahead of you.
Cheers for posting on your autodidactic work, it’s really good to see how you’ve been going about it and what you’ve found useful. I’m a non-climate-science bod (doing a PhD in abstract spatial economic modelling, all Java) with a terrible climate blog habit, and I’m very interested in what’s sensible/feasible for non-climate-scientists to attempt to learn about the details.
I’m imagining this red line: the more anyone learns, the further the line gets pushed over obfuscatory climate nonsense, and the more the learner is able to see through it themselves without having to take it on trust – which essentially comes down to deciding who you believe. For example, all the recent articles (here’s the latest at Skeptical Science) about the PDO. Despite Spencer having a book he can beat people over the head with, it’s actually some relatively simple ideas that kill it: an oscillation can’t be a trend. And there’s some relatively simple maths that can be used to show that (I think!)
Sounds like a plan. I think the best way to learn a language is to start doing some hands-on coding — so you should try getting hold of an existing Fortran compiler to try things out (if you haven’t already).
Working on that…it looks like there are compilers on campus I will be able to use. It would be ideal if I could find a free compiler to install at home (either Windows or Linux versions are fine) but I haven’t had much luck. Does anyone know of something? -Kate
There’s a reason the GPL is so awesome… ;)
GFortran is the only one I’ve had experience with (although not as much as I’d like; I didn’t really like Fortran and was learning it around the same time I switched from physics to psychology). I’m not sure if it’ll work with 77. I know there are other open-source compilers out there for it too.
Other possibilities that are free and available to everyone include Python (a very fun language to learn, but it conforms to different standards and modes of thinking than others; the Clear Climate Code project uses it) and R (actually a joint statistical analysis package and programming language; you’ve probably seem things produced by it without even knowing it. I believe Tamino’s analyses are done with it). I’ve been dabbling with Python for a few years on and off, and have only recently begun to learn R, and it feels like a void in my life is now filled.
I also suggest C or C++, but not so much as its own language. It’s everywhere, and has had so much influence on other languages that if you learn it, it’ll be easy to shift around. (Well, more so in how you think about programming than the actual syntax, depending on the language. But still.)
Matlab. Or rather, octave or scilab, which are free. Matlab is used a lot for rapid prototyping and quick analyses.
You could also have a look at R, a language for statistics buffs.
Thanks, Martin – I have heard that these languages are used a lot by scientists. I will add them to my list. -Kate
Depending on where your interests lie or where you want to focus your efforts, these books may or may not find a place on your shelf.
Paleoclimatology: Reconstructing the Quaternary by Dr. Bradley is good if your interest lies towards understanding the methods used to reconstruct past climate. It is a textbook, probably accessible to first year university students, some slow going in spots. I’ve only done the first five chapters (too many books and papers, not enough time). Find the second edition though–he has included new chapters on methods that weren’t available when he wrote the first edition. The science has really jumped forward.
You are the second person to recommend this book – sounds like I will definitely have to find a copy! Thanks, Ken. -Kate
I have found it useful in understanding the various hockey stick papers, and you can probably pick up the main ideas quickly.
A book aimed at an educated* lay audience is Nature’s Clocks by MacDougall. It looks at how isotopes are used to age various things. It is more geologically related but some of the principles overlap with Dr. Bradley’s book. I read that book first and found it helpful when I started the paleoclimatology book.
*by educated I mean someone who has read science books before and knows how to slow down and work their way through some of the more difficult concepts.
Wow, Kate, you really are getting into computer programming big time! Way before you were born I was using Fortran IV and Fortran Five and Fortran 66 and Fortran 77, and I toyed with Fortran 90 and 95 before migrating to ANSI C. Now here’s a proposal: I’ll give you some pointers on Fortran if you’ll help me figure out Objective-C; I’m trying to develop applications using XCode to run on a Macintosh. ;)
On another note you may want to use the free code Elmer to help with your fluid flow and thermal dynamics problems. Check this out.
Roger: back in the day, I found the Apple documentation really useful: Objective C Introduction, and the Cocoa Tutorial.
Admittedly, I already knew C inside and out (and about 10 other languages too!).
By the way Kate, if you want to know when mankind first started destroying the world, get of copy of Topsoil and Civilization by Tom Dale and Vernon Gill Carter.
Ah yes I forgot: go Linux / free software / LaTeX whole hog. Don’t bother with perverting an office automation system for science use… ;-)
As an appetizer, Fortran g77 comes standard with Ubuntu. Like thousands more apps, just a few clicks away in the package manager. You’ll get hooked…
F77 is not a bad tool, though very limited. Later versions of Fortran, though much used in the climate sciences, are probably best avoided altogether if you can manage it, and certainly in the early phases.
At the risk of starting a language flamewar, Fortran versions after F77 are inelegant. They try to solve too many problems at once. Like Microsoft operating systems, they sacrifice clarity and modularity for backward compatibility.
Maybe by the time you need to get into a serious modeling effort there will be something in a less compromised language.
The way in which Ray uses Python is very easy to pick up. As you may know I am a Python partisan. I think Python builds the capacity for abstraction, which really is a key to science. (Modern Fortran builds up the capacity for pain tolerance, which I suppose has some advantages as well.)
good luck with the fortran! i had to deal with it back at uni (for particle physics rather than climatology, but i imagine the code there is just as ugly!), and i’ve still got the scars to prove it :-D
as for a compiler, most Linux systems should have one available. gcc (the standard compiler on most distributions) includes gfortran, which is fortran 95 compliant.
if you really need a fortran 77 compiler (for historical reasons, the different versions of the fortran standard have got some huge differences), there are g77, which is no longer actively developed, and may no longer be widely packaged, and f2c which translates the code to C and compiles that.
if you’ve got any questions, drop me an email and i’ll be glad to help :-)
Fortran for Linux (or OS X, I would think) shouldn’t be a problem as there’s a GNU Fortran compiler. On Ubuntu the appropriate command and package name is gfortran. There’s also a fort77 command to convert Fortran 77 to C/C++ and compile that.
I haven’t actually installed these: just looked at them in the package manager. gfortran supports Fortran 95 so I guess it’ll also do the previous versions.
I have to admit that it’s been a while since I wrote much Fortran. 1982 I think it was.
Further to my previous comment, just tried on Ubuntu:
sudo apt-get install gfortran
Created, in a text editor, a file called test.for:
10 format(“Hello world”)
Compiled with the command:
Ran with the command:
and it printed the traditional greeting (well, it did after a couple of iterations to guess the device number for standard output (first guess was 1, then tried 5 (a number dredged from my rather distant memories of the language) which said open for read (stdin I assume) so tried 6 which worked)).
> so tried 6 which worked
only because you didn’t have a line printer connected
/me ducks and runs
Seriously, this goes back to Fortran IV on IBM punch cards…
Dan Olner. If you want the really good maths and trend calculations on Dr Spencer’s little opus, have a look at this, and the previous post, on Not Spaghetti.
I would suggest learning R and learning some GIS software such as Arcmap and PCI Geomatica. The ability to visually display things in maps is very important in the field. I would also consider reading ruddimann’s text earth’s climate past and present and maybe benn and evans glaciers and glaciation. The warming papers by Pierre is a great idea too. Learning Matlab is also something that would be useful but it is pricey (so is arcmap and PCI geomatica). May I suggest you read every single tamino post over the history of his blog and try to understand as much as possible
Beyond that I suggest you keep your mind open and keep an eye on skeptic websites such as climate audit because you have to be able to beat them at their own game.
Okay, I have a working compiler (gfortran), and am happy to be getting some use out of my family’s old desktop that won’t run anything but Ubuntu. After an hour or so of failing to get Photran, an Eclipse add-on, to work, I discovered that gedit colour codes text as well, which was the only reason I wanted Eclipse. Then I was finally able to compile and run Hello World, and now I feel quite proud.
Ed Davies – thank you so much for posting your command lines, file extension, etc – I would have been lost otherwise! I am more or less new to Ubuntu, and completely new to Fortran, and the gfortran docs sort of assume that the reader is fluent in both.
I have found a tutorial for Fortran 90-95, which I am going to switch to before I get too far into 77. It looks like 90 is used more in the models: in my vague memory of this post of Steve Easterbrook’s, I thought it was the other way around, for some reason.
Thanks to everyone for all your help!
gedit? You sure? I’m a vim guy, and suggest you give it a try. Takes a little getting used to, but once you’re hooked… it’s the UNIX way. And of course it does syntax colouring.
Eh, purists will tell you to try emacs… just so you’re warned ;-)
I haven’t heard of vim – will take a look. -Kate
+1 for vim. the learning curve can be a bit painful, but the speed boost you’ll get once you’ve got even half proficient is more than worth it.
vimtutor is your friend: http://vim.wikia.com/wiki/Tutorial#Vim_tutor
One model description that might be of interest: http://www.atmos-chem-phys-discuss.net/8/6153/2008/acpd-8-6153-2008.pdf
maths there look like something even I would have grasped (partly) during the studies. Maybe I will read this through, when time allows.
I am a veteran Fortran programmer, but so far I fail to master Fortran 90 or newer standards. I refrain from commenting on them.
Our climate model is written in Fortran 90, but most of its codes are still written with the syntax of Fortran 77. Only such parts that support parallel processing use newer features. This is just an example and I am not sure about the situation of other models.
But anyway, there are many textbooks of Fortran 77 (most of which are likely to out of print but perhaps still available in university libraries) but much fewer ones for the newer standards.
Thanks, Kooti. I will take a look at both versions. -Kate
If you want to learn Fortran, I recommend you to follow the 77 standard. But I think it is better to include one feature of the 90 standard.
That is the “DO … END DO” structure for making loops. This structure is supported by GNU’s g77 compiler. GNU now develops gfortran instead of g77, but it seems upward compatible. I have been using gfortran as if it is g77 without a trouble so far.
“DO … END DO” structure with the loop count specified:
DO k = 1, 10
Within the 77 standard, we had to write like this:
DO 100 k = 1, 10
“DO … END DO” structure with the condition to loop specified (where “condition” is a logical formula, which may be a variable declared as LOGICAL):
DO WHILE( condition )
Within the 77 standard, we had to write like this:
900 IF(.NOT. (condition)) GO TO 990
GO TO 900
As you know if you hang about on our blogs too much, we hold that if you’re going to be a scientist, you’re going to be a programmer. So learn to be a good programmer.
I recommend “The Practice of Programming” by Kernighan and Pike. Simplicity, Clarity, Generality.
And of course, yay Python!
I’m a fan of learning physics through computation, so I second others’ advice to get into programming early. It’s good to be a polyglot. Learn Fortran 90 for hardcore numerics, Matlab for rapid prototyping of numerical code, Python for general purpose scripting, NCL or Ferret for climate data extraction and processing, and R for statistics. Fortunately all are free, except Matlab (but Octave can get you somewhat far, and you can alternatively try the NumPy system for Python). Many of these mathematical languages are wrapped together in the Sage mathematical programming system. You may eventually pick up some C++ as well …
The best way to learn languages is to set yourself little projects that are suited to each language. In Fortran, Matlab, or NumPy write a 0D energy balance model, a 1D diffusive ocean model, or a 1D radiative-convective model. (Or write the same model in several languages, for comparison.) Use NCL to download some climate model output and process it (compute zonal averages, plot meridional sections, etc.) Use R to compute trends or estimate model parameters. And so on.
…and get familiar with GMT (Generic Mapping Tools) for geographical plotting, which is pretty much a programming language of its own. Comes standard with Ubuntu (and running it on anything but Unix is a pain, as it’s built on shell scripts all the way).
ArcGIS and/or ERDAS IMAGINE in conjunction with R…don’t neglect spatial analysis!
As for graphical output, I used to be a user of NCAR Graphics (the ancestor of NCL, just a collection of Fortran subroutines then), but now I mainly use GMT (mentioned by Martin Vermeer above), which was developed by solid-earth geophysicists. Its original website is http://gmt.soest.hawaii.edu .
To utilize GMT we need some programming of Unix (or GNU) shell scripts, which, in my experience, requires considerable trial and error rather than systematic computer science practice.
GMT is good for 2-dimensional geographical data. NCL seems to be better in handling 3- and 4- dimensional atmospheric data, and R seems to be better (more systematic) for non-geographic data, though I am entrenched in GMT in all cases myself.
The shell scripts to use GMT sometimes call the programming language Awk, which has evolved together with the Unix operating system. Mastering Awk is a helpful thing, not only with GMT but also in various needs of converting available data to match requirements of available software. (If you master Python or Ruby, you may think replacing Awk with either of them, though.)
If you want to have a go at a relatively simple climate model, you can try the Portable University Model of the Atmosphere (PUMA) http://www.mi.uni-hamburg.de/Downloads-an.245.0.html?&L=3
It’s targeted at students and (for your standard research software package) relatively easy to get up and running.
All written in Fortran90 with an emphasis on being easy to understand and modify.
To throw some more software into the mix: if you start to use Python, matplotlib/scipy/numpy is getting much traction in the scientific community.
Once you start running models you will have to deal with how to access their output data, sometimes in different formats. CDAT (the Climate Data Analysis Tools) might come in handy, at the very least check out their CDMS subsystem which gives you a unified interface to different file formats.
Article written for astronomers but actually applicable to most scientists, I would think.