User Tools

Site Tools


other:python:jyp_steps

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
other:python:jyp_steps [2016/01/21 17:10]
jypeter numpy, scipy...
other:python:jyp_steps [2016/01/22 13:59]
jypeter Started adding JYP's tutorial
Line 4: Line 4:
  
 This page tries to list some //python for the scientist// related resources, in a suggested reading order. **Do not print anything** (or at least not everything),​ but it's a good idea to download all the //pdf// files in the same place, so that you can easily open and search the documents This page tries to list some //python for the scientist// related resources, in a suggested reading order. **Do not print anything** (or at least not everything),​ but it's a good idea to download all the //pdf// files in the same place, so that you can easily open and search the documents
 +
 +===== JYP's introduction to python =====
 +
 +You can start using python by reading the {{:​other:​python:​python_intro_ipsl_oct2013_v2.pdf|Bien démarrer avec python}} tutorial that was used during an IPSL python class:
 +  * This tutorial is in French (my apologies
  
 ===== The official python documentation ===== ===== The official python documentation =====
Line 11: Line 16:
 ==== Python 2.7 ==== ==== Python 2.7 ====
  
-[[https://​docs.python.org/​2.7/​|html]] - [[https://​docs.python.org/​2.7/​download.html|pdf]]+[[https://​docs.python.org/​2.7/​|html]] - [[https://​docs.python.org/​2.7/​download.html|pdf ​(in a zip file)]]
  
 ==== Python 3 ==== ==== Python 3 ====
  
-[[https://​docs.python.org/​3/​|html]] - [[https://​docs.python.org/​3/​download.html|pdf]]+[[https://​docs.python.org/​3/​|html]] - [[https://​docs.python.org/​3/​download.html|pdf ​(in a zip file)]]
  
  
 ===== Numpy and Scipy ===== ===== Numpy and Scipy =====
  
-Summary: Python provides //ordered// objects (e.g. lists, strings, ...) and some math operators, but you can't do real heavy computation with these. **Numpy** makes it possible to work with data arrays and using array syntax and masks (instead of explicit nested loops and tests) and the apropriate numpy functions will allow you to get performance similar to what you would get with a compiled program! **Scipy** adds more scientific functions+Summary: Python provides //ordered// objects (e.g. lists, strings, basic arrays, ...) and some math operators, but you can't do real heavy computation with these. **Numpy** makes it possible to work with multi-dimensional ​data arraysand using array syntax and masks (instead of explicit nested loops and tests) and the apropriate numpy functions will allow you to get performance similar to what you would get with a compiled program! **Scipy** adds more scientific functions
  
 How to get started? How to get started?
-  - always remember that indices start at ''​0''​ and that the last element of an array is at index ''​-1''​! ​Learn about indexing and slicing by manipulating ​a string ​(try '''​This document by JY is awesome!'​[::​-1]''​)+  - always remember that indices start at ''​0''​ and that the last element of an array is at index ''​-1''​!\\ First learn about //indexing// and //slicing// by manipulating ​strings ​(try '''​This document by JY is awesome!'​[::​-1]'' ​and '''​This document by JY is awesome!'​[slice(None,​ None, -1)]''​) 8-)
   - read the [[https://​docs.scipy.org/​doc/​numpy-dev/​user/​quickstart.html|Quickstart tutorial]]   - read the [[https://​docs.scipy.org/​doc/​numpy-dev/​user/​quickstart.html|Quickstart tutorial]]
   - have a quick look at the full documentation to know where things are   - have a quick look at the full documentation to know where things are
Line 29: Line 34:
     - Numpy Reference Guide     - Numpy Reference Guide
     - Scipy Reference Guide     - Scipy Reference Guide
 +
 +===== cdms2 and netcdf4 =====
 +
 +There is a good chance that your input array data will come from a file in the [[http://​www.unidata.ucar.edu/​software/​netcdf/​|NetCDF]] format. Depending on which [[other:​python:​starting#​some_python_distributions|python distribution]] you are using, you can use the //cdms2// or or //netCDF4// modules to read the data.
 +
 +Note: the NetCDF file format is self-documented,​ and the metadata of climate date files often follows the [[http://​cfconventions.org/​|CF (Climate and Forecast) Metadata Conventions]]
 +
 +==== cdms2 ====
 +
 +Summary: cdms2 can read/write netCDF files (and read //grads// dat+ctl files) and provides a higher level interface than netCDF4. Unfortunately,​ cdms2 is only available in the UV-CDAT distribution,​ and distributions where somebody has installed some version of //​cdat-lite//​. When you can use cdms2, you also have access to //cdtime//, that is very useful for handling time axis data.
 +
 +How to get started:
 +  - read [[http://​www.lsce.ipsl.fr/​Phocea/​file.php?​class=page&​file=5/​pythonCDAT_jyp_2sur2_070306.pdf|JYP'​s cdms tutorial]], starting at page 54
 +    - the tutorial is in French (soooorry!)
 +    - you have to replace //cdms// with **cdms2**, and //MV// with **MV2** (sooorry about that, the tutorial was written when CDAT was based on Numeric instead of numpy to handle array data)
 +  - read the [[http://​uv-cdat.llnl.gov/​documentation/​cdms/​cdms.html|official cdms documentation]]
 +  - ask questions and get answers on the [[http://​uvcdat.askbot.com/​questions/​|UV-CDAT askbot]]
 +
 +
 +==== netCDF4 ====
 +
 +Summary: netCDF4 can read/write netCDF files and is available in most python distributions
 +
 +Where: [[http://​unidata.github.io/​netcdf4-python/​]]
 +
  
 ===== Matplotlib ===== ===== Matplotlib =====
Line 69: Line 99:
 ===== Quick Reference ===== ===== Quick Reference =====
  
-  * The nice Python 2.7 Quick Reference: [[http://​rgruet.free.fr/​PQR27/​PQR2.7_printing_a4.pdf|pdf]] - [[http://​rgruet.free.fr/​PQR27/​PQR2.7.html|html]]+  * The nice and convenient ​Python 2.7 Quick Reference: [[http://​rgruet.free.fr/​PQR27/​PQR2.7_printing_a4.pdf|pdf]] - [[http://​rgruet.free.fr/​PQR27/​PQR2.7.html|html]]
  
 ===== Some good coding tips ===== ===== Some good coding tips =====
other/python/jyp_steps.txt · Last modified: 2024/03/07 10:15 by jypeter