Python is becoming a major tool for processing ICAS data. In Oct 2017 there are currently 2 versions in wide use; version 2 and version 3 and some derivatives of those. Current formal advice is to learn Python3 and only to learn 2.7 if you have to, as it will be frozen in 2019. However, we understand that there is a lot of legacy 2.7 code around and the next couple of years one should endeavour to recode in 3.6++ or at least test that it works with Pyton3.
Here are some sources of Python information:
Python Org 2 https://docs.python.org/2.7/
Python Org 3 https://docs.python.org/3.6/
For plotting guidance we expect ICAS users to use primarily a Unix environment (In SEE it is CentOS 6 or CentOS 7). Use the “modules” to get the right environment:
Python2 : module load python ; module load python-libs
Python3 : module load python3 ; module load python-libs
The modules should take care of which python is being used.
A Leeds specific web site was set up to help beginners in several programming disciplines (Fortran, R, Python etc) see http://www.programmingforresearchers.leeds.ac.uk/
This has a great taster/starter python tutorial (2.7) with a focus on environment type application. http://www.programmingforresearchers.leeds.ac.uk/courses/python/
ARC training courses
ARC is the Advance Research Computing service at Leeds. They provide more than just the HPC service and support. These training courses are quite well thought out through dialogue with research groups at Leeds. See what is on offer at
Central IT services
Additional local computing topics are available from Central IT. Following the links through it.leeds.ac.uk one can find the following page (caution: it could have moved by the time you read this)
MatPlotLib and PyPlot
Look at MatPlotLib for tutorials in plotting. They have provided many examples and it is often straight-forward to adapt to your own needs.
See: http://matplotlib.org/ and http://matplotlib.org/api/pyplot_summary.html
Then the gallery of examples is a reasonable collection: http://matplotlib.org/gallery/index.html
Met Office Python library for Meteorology and Climatology
A library has been created (IRIS http://scitools.org.uk/iris/) that is used alongside matlotlib to work with met office data sets. The data is abstracted into “cubes” and the tools provide methods of interacting with these data objects.
Another manner in which to use Python is through an Integrated Development Environment such as Anaconda. Again this has the two flavours and you will need to choose between anaconda2 and anaconda3 from : https://www.anaconda.com/download. I use this on Windows systems and it provides “spyder” which allows you to directly edit a python script and then run it. The output is displayed in an “IPython” console alongside the editor. The matplotlib graphics appears there too.
IPython and Jupyter Notebooks
During your familiarisation/learning process you might encounter references to Jupyter Notebooks http://jupyter.org/. The files have an extension “.pynb” and contain “MarkDown” decorations. If you receive one of those and need to use it directly as a python script then convert it with
ipython nbconvert --to script filename.ipynb
which will generate a file with the same stem but only a “py” extension and the content will be runnable. The above mentioned Anaconda provides a Jupyter server too so you can launch notebooks for your own use. Personally (MarkR) I struggled with notebooks due to their sequential and subsequent non-linear and their multi-program nature. They consist of user defined Cells that can be categorised as code or text (MarkDown) and any of the Cells can be processed with SHIFT-ENTER. They are great for teaching as you can proceed through a lesson a cell at a time. but the are tricky to take away and use individual without some additional editing to separate out. CEMAC are using Notebooks along with the Microsoft(TM) cloud service notebooks.azure.com to teach python to first year undergraduates. There is a University of Leeds agreement in place to use Azure and you can use your UoLeeds credentials to log in.
If you find that you are still struggling please raise a ticket with CEMAC. From the menu bar choose resources -> “support tickets” OR Contact Us -> “Ask for support”.
The CEMAC team