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 Both sides next revision
other:python:jyp_steps [2016/01/21 17:10]
jypeter numpy, scipy...
other:python:jyp_steps [2016/01/22 11:40]
jypeter added cdms2/netcdf4
Line 11: Line 11:
 ==== 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?
Line 29: Line 29:
     - 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 94:
 ===== 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