Python and its appication to atmospheric sciences

By the time, more students and researcher are migrating to Python.  This article, Why Python Is the Next Wave in Earth Sciences Computing, gives you some idea about the reseaons. After I joinded research department at Egyptian Meteorological Authority, I used to use Fortran for calculation and for plotting I used to use both GnuPlot and open GrADS. After than I begin to learn NCL as I found my self wanna to open a varity of NetCDF files and also to make sophsitcaed graphs, NCL was excellent in that. After that, during my master, I begin to use MatLab, becasue of the interactive command window, I found my self able to do a lot of analysis much faster than writing compelete script in NCL, Thus Matlab safe a lot of time.  Usually, after doing some calculation, I need to make some figures, thus I write my calulated data back into a NetCDF file that I draw using NCL. Matlab is not so good in making basemaps like NCL, I found some difficulties in drawing some types of contours. I think that  Matlab plots is not pretty like NCL. Using both NCL and MatLab is efficent, but it is time consuming. NCL is full of resource that make you control in every detail regrading to your plots. Doing calculation using NCL is time consuming as NCL is basically a compiled language. Thus, I used to do calculation in MatLab and plot the contours in NCL. So, what next?, I found that Python could be used instead of both NCL and Matlab. Python has many package that could replace MatLab like Numpy, SciPy, Matplotlib,..etc. Also in the  same time, Basemap packages in Python is much easier than those in MatLab, we can even import NCL itself in Python by importing PyNIO and PyNGL packages. Thousands of packages could be imported to be used in Python. Usually, you will find more that one package that can make the same function.

To master Python for atmospheric science application, three milestones have to be passed:

  1. Learning the basica of Python itself. I think that this website is perfect for mastering the essential of Python. You can start with learning the essential of Python (variables, loop, function, ...) on the this tab .
  2. Learning the basical of doing  calculation in Python, on the same website you can move to the fifth tab which show the essentials of the Numerical Python.
  3. The last step is to master some real applications like opening NetCDF, Girb files, doing some regressions and correlations, FFT, etc. I used IPython Notebooks to illustrate such Analysis, actually, IPython Notebook is amazing in doing that. 

   Atmospheric Sciences application using Python

  1. Opening NetCDF and Grib files and plotting contour map overlaid on on basemap.  [olr_monthly_hovmoller1.py] [OLR DATA]
  2. Calculating anomalies by regressing data on the first few harmonics.
  3. Mastering regression, I used the ideas found in chapter 7 from Statitical Methods in the Atmospheric Science (third edition) by Wilks.
       then I show example on regressin SST over precipitation over eastern Africa.
  1. Mastering Emperical Orthogonal Function.
  2. FFT