Examples

A Tour Of Climaf is a progressive and but quite comprehensive tour, which is here presented as an html page , but which can also be run as an IPython notebook (see sidenote); the nootebook content is currently behind the status of CliMAF

For running CliMAF, or running one of the Python scripts example described below, you will use a Python shell, after telling Python where the CliMAF code is:

$ export PYTHONPATH=$PYTHONPATH:<climaf_dir>
$ python
>>> from climaf.api import *
>>> ....

A number of examples show in directory <climaf_dir>/examples and are also dowloadable using the links below; you will copy and paste the code lines to the Python shell using your favorite method. Each code line is documented by a comment which tries to bring all necessary information for letting your CliMAF expertise grow steadily.

Some of the examples can be run anywhere, as they use the data sample installed with CliMAF :

  • plotmap.py : basic and advanced map plotting (using ncview and ncl)
  • plot_xsection.py: plotting a pressure-lat or pressure-lon cross section
  • basic_oce.py : acces ocean data on ORCA grid in CMIP5_DRS data, and perfome some basic operations (works at CNRM and on Ciclad)
  • export.py : various ways to ‘export’ results out of CliMAF
  • derived.py : how to define a new geophysical variable and use it in CliMAF
  • increm.py : compute any derived variable incrementally (i.e. using new inputs as they become available)
  • latlonbox.py : define a dataset on a lat-lon box; also extract a box out of a dataset
  • regrid.py : regrid some data or object to a named grid or to the grid of another object/data
  • ann_cycle.py : compute an annual cycle, using CDO
  • macro.py : define a macro in-a-while, use it, save it, ….
  • ensemble.py : how to create ensembles and compute with it
  • index_html.py: create an html index including multiple tables of links to figures, possibly with thumbnails.

Others show how to acces some known data sets on CNRM or IPSL file system :

  • data_cmip6drs.py : access data which are organized using the CMIP5 Data Reference Syntax
  • data_cmip5drs.py : access data which are organized using the CMIP5 Data Reference Syntax
  • data_generic.py : using the ‘generic’ type of organization on various examples :
    • OCMIP5 data on Ciclad
    • Obs4MIPS data at CNRM
    • CAMI Obs data at CNRM
    • example data as included in CliMAF package
  • data_em.py : access CNRM-CM data organized ‘a la EM’
  • seaice.py : access and plot ORCA1-grid sea-ice data, with control on levels and projection
  • data_obs : access observation data sets as handled at CNRM by VDR

If you have Cdftools 3.0 installed (in a flavor with some bugfixes, and with CMIP variable names in modcdfnames.F90 when applicable) , you may use it through CliMAF :