#acl AdminGroup:read,write,delete,revert EditorGroup:read,write PythonGroup:read,write All:read #format wiki #language en #pragma section-numbers off = Python at KlimaCampus = This page shall be a central help for ZMAW/KlimaCampus users of Python. Contact AlexLoew or LarsKaleschke for permission to edit this page. Please help to fill this page with useful information about Python for climate research and data analysis. <> == Why python rocks! == * [[http://journals.ametsoc.org/doi/full/10.1175/BAMS-D-12-00148.1|Why Python Is the Next Wave in Earth Sciences Computing]] * [[http://www.stat.washington.edu/~hoytak/blog/whypython.html | 10 reasons python rocks for research]] * [[http://www.theregister.co.uk/2012/06/18/scripting_languages_in_the_enterprise/ | Python wraps its coils around the enterprise ]] * [[http://clearclimatecode.org/ | Clear climate code ]] * [[https://ams.confex.com/ams/95Annual/webprogram/5PYTHON.html|Fifth Symposium on Advances in Modeling and Analysis Using Python]] == ZMAW Settings == SNOW, SQUALL: {{{ module load python }}} = Getting started ... = ==== ZMAW internal ressources ==== * [[/PythonLES | MPI-M, Land department python seminar series, 2012]] by Alex Loew and Julia Pongratz * [[http://wiki.zmaw.de/lehre/OpenSource2010|Open Source Scripting for Geo-Scientific Data Processing and Analysis]] by LarsKaleschke '''KlimaCampus Lecture''' * [[http://emolch.org/pythonbootcamp.html | Sebastian Heimann's MPI-M lecture (scroll to the bottom of the webpage)]] ==== External ressources / tutorials ==== * [[http://wiki.python.de/ | Python Wiki (in German only)]] * [[ https://github.com/downloads/diveintomark/diveintopython3/dive-into-python3.pdf | Dive into Python 3]] * [[http://www.greenteapress.com/thinkpython/thinkpython.pdf | Think Python - How to think like a computer scientist]] * [[http://scipy-lectures.github.com/_downloads/PythonScientific-simple.pdf | Python Scientific Lecture Notes]] * [[http://greenteapress.com/pythonhydro/pythonhydro.pdf | Python in Hydrology]] = Documentation and further information = * http://www.python.org/doc/ Standard documentation * [[http://www.cfa.harvard.edu/~jbattat/computer/python/science/idl-numpy.html|NumPy for IDL users]] * [[http://www.scipy.org/NumPy_for_Matlab_Users|NumPy for Matlab users]] * [[http://www.tau.ac.il/~kineret/amit/scipy_tutorial/|SciPy tutorial]] * [[http://software-carpentry.org/|Software Carpentry]] * [[http://marakana.com/s/post/1133/advanced_matplotlib_tutorial_with_library_author_john_hunter#c132880|Advanced matplotlib tutorial with library author John Hunter, 2012 PyData Workshop]] * [[http://marakana.com/s/post/1090/2012_pydata_workshop|More video tutorials from the PyData Workshop]] = How to edit python code? = In November 2013, we asked people on our python-friends@lists.zmaw.de mailing list, which editor/IDE is preferred for python hacking. Below is a summary of the anwers: == python specific editors == * ipython notebook == IDE's == * pycharm * eclipse == advanced generic text editors == * geany * vim (plugins: pyflakes, jedi-vim) * emacs (python-mode.el, auto-complete, yasnippet) * sublime 2 * spyder == Generic text editors == * nedit * gedit * kate * snipmate * easymotion * nerdtree = Modules for Scientific Computing and Visualization = A good summary webpage how to use geospatial data (e.g. netCDF, GRIB) with python is given [[http://www.esr.org/~chjiang/python.html | here]]. == SciPy/NumPy == * http://www.scipy.org/ === pylab === * [[http://matplotlib.sourceforge.net/|Matplotlib/pylab]] Plotting functions with a high degree of Matlab compatibility * [[http://matplotlib.sourceforge.net/basemap/doc/html/]] Matplotlib Basemap Import the Basemap module {{{ from mpl_toolkits.basemap import Basemap }}} == GDAL == * [[http://www.gdal.org/|GDAL - Geospatial Data Abstraction Library]] for various satellite data formats * [[http://wiki.zmaw.de/ifm/gdal|ZMAW GDAL]] == PyNGL PyNio == * [[http://www.pyngl.ucar.edu/|PyNGL/PyNIO]] Python interface to [[http://www.ncl.ucar.edu/ | NCAR Command Language]] * Scientific visualization and data formats (netCDF, HDF, GRIB etc.) == Python Interface to GrADS == * http://opengrads.org/wiki/index.php?title=Python_Interface_to_GrADS == RPy == * [[http://rpy.sourceforge.net/| RPy (R from Python)]] Statistical computing and graphics == F2PY: Fortran to Python interface generator == Calling Fortran code from python is easy! [[/F2PY|Fortran to Python]] = Topical Modules = * [[http://www.imr.no/~bjorn/python/seawater/index.html|Seawater]] is a package for computing properties of seawater (UNESCO 1981 and UNESCO 1983). * [[https://launchpad.net/escript-finley/|Escript/Finley: Fast Finite Elements for Partial Differential Equations]] * [[http://lgge.osug.fr/~picard/dmrtml/|The Dense Media Radiative Transfer - Multi Layers model (DMRTML or DMRT-ML).]] comes with a Python interface More topical software can be found at http://scipy.org/Topical_Software = Python and Climate = * [[http://maths.ucd.ie/~rca/climt/|CliMT: An object-oriented Climate Modeling and diagnostics Toolkit]] * [[http://www2-pcmdi.llnl.gov/cdat|Climate Data Analysis Tools (CDAT)]] * [[http://code.google.com/p/pyccsm/|pyccsm A Python version of the CCSM coupler]] = Python and Weather Satellite Data = * [[http://www.pytroll.org/|PyTROLL project]] = IPython Notebooks = A [[http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html|notebook]] is a combination of two things: 1. An interactive session connected to an IPython kernel, controlled by a web application that can send input to the console and display many types of output (text, graphics, mathematics and more). 2. A document that can save the inputs and outputs of the session as well as additional text that accompanies the code but is not meant for execution. In this way, notebook files serve as a complete computational record of a session including explanatory text and mathematics, code and resulting figures. {{{ module load python/2.7-ve2 ipython notebook --pylab inline }}} = Download (try this at home) = A basic system for scientific computing consists of Python, ipython, numpy/scipy, pylab, and an editor of your choice * [[http://python.org/download/|Python interpreter]] * [[http://ipython.scipy.org/moin/Download|IPython shell]] * [[http://www.scipy.org/Download| SciPy]] * [[http://matplotlib.sourceforge.net/|Matplotlib/pylab]] * [[http://www.crimsoneditor.com/| Editor]] (a nice editor for Windows user, if you don't like to install xemacs) The [[http://www.pythonxy.com/foreword.php|python(x,y)]] distribution contains all that above. or try [[http://www.sagemath.org/|Sage (Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab)]]. = Literature = * [[http://dx.doi.org/10.1007/978-1-4842-0055-1|Python Algorithms : Mastering Basic Algorithms in the Python Language / by Magnus Lie Hetland]] (Volltextzugang Campus) * [[http://dx.doi.org/10.1007/978-1-4842-0052-0|Beginning Python Visualization : Crafting Visual Transformation Scripts / by Shai Vaingast]] (Volltextzugang Campus) * [[http://dx.doi.org/10.1007/978-3-319-01342-8|Python for Signal Processing : Featuring IPython Notebooks / by José Unpingco]] (nur lokal im BIS-ZMAW) * [[http://sub-hh.ciando.com/book/?bok_id=484601|Programmieren lernen mit Python / Allen B. Downey. Dt. Übers. und Bearb. von Stefan Fröhlich]] (Volltextzugang Campus) * [[http://site.ebrary.com/lib/subhamburg/Doc?id=10744808|Introduction to computation and programming using Python / John V. Guttag]] (Volltextzugang Campus) * [[http://proquest.safaribooksonline.com/9781449323592|Python for data analysis : [agile tools for real-world data] / Wes McKinney]] (nur lokal im ZMAW) * Python Scripting for Computational Science, Hans Petter Langtangen, Springer (available in the ZMAW library) * [[http://link.springer.com/book/10.1007/978-3-642-54959-5|A Primer on Scientific Programming with Python / by Hans Petter Langtangen]] (Volltextzugang Campus) * Matplotlib for Python Developers - Build remarkable publication quality plots the easy way, Sandro Tosi, Packt Publishing, Birmingham - Mumbai, 2009 * [[http://geosci.uchicago.edu/~rtp1/ClimateBook/ClimateBook.html|Principles of Planetary Climate (RAYMOND T. PIERREHUMBERT)]] includes a large collection of Python examples * Learning IPython for interactive computing and data visualization : learn IPython for interactive Python programming, high-performance numerical computing, and data visualization / Cyrille Rossant. - Birmingham [u.a.] : Packt Publ., 2013 * A hands-on introduction to using Python in the atmospheric and oceanic sciences / Johnny Wei-Bing Lin. - 2012 http://www.johnny-lin.com/pyintro/