PyDom: A Python Package for Physical  Diagnostics of Ocean Models Outputs

Introduction

This package contains a collection of utilities to help and implement high end physical diagnostics of ocean model outputs. These tools have been developped during the DRAKKAR project. They are designed for use with outputs of the NEMO modelling framework. The current version is an alpha-release (0.1.3).

Although we've used these routines in our own research, we cannot guarantee that they will work for your purposes. More disclaimers and other fine print is below.


Package Description

General

The utility classes and functions described in this package define a working environment which simplifies the implementation of high end physical diagnostics of model outputs. It is sought to be complementary to CPU intensive post-processing tools developped by J.M. Molines (CDFTOOLS). The most important purpose of this package is to provide utilities to work on a regional extraction of a model grid with all the functions and operators needed to perform  the required diagnostic. Of course, the tools can also be applied to the full model grid.

PyDom utilities include the following modules :
  • gridutils.py : provides class/functions related to a regional grid extraction including array of coordinates and masks.
  • timeutils.py : implements various time filtering methods, computes power spectra and continuous wavelet transform.  
  • isotools.py : provides tools to design diagnostics along isolines, on/across isosurfaces.
  • ncio.py : wraps your favorite netcdf I/O package. 
  • pvutils.py : provides class/functions to analyse various potential vorticities and the associated fluxes. 
  • eos.py : provides utilities related to the equation of state of sea-water. 
  • plotutils.py : provides various 2D-plotting routines. 
  • diagtrend.py : implements Bindoff and McDougall (1994)'s decomposition of temperature/salinity variations.  
  • scriptutils.py : implements classes/functions needed to implement intensive production scripts.   
  • miscutils.py : is where we put all the remaining tools...
Several other modules are currently under development/validation stage. For more information, contact Julien Le Sommer at his email address to get access to  PyDom wiki

Importing the Package

The package can be globally imported with the following command:

from PyDom import *

alternately, to import a specific module (ex: the gridutils module), type:

import PyDom.gridutils

[Back up top to the Introduction.]

Supplementary data files

In order to use the package with model outputs from a given model configuration, the user should provide files which describe the grid. More precisely for a configuration CONFIG, the user should provide the following files : CONFIG_mesh_zgr.nc, CONFIG_mesh_hgr.nc and CONFIG_example_gridT.nc. Actually, The required files depend on the configuration. For more details, type :

import PyDom.__defgrids__
PyDom.__defgrids__._list_all_ext_files()

For testing purpose, supplementary data files for the standard ORCA2 NEMO configuration are made available here.

[Back up top to the Introduction.]


Help, Examples, and FAQ

The present version being an alpha release, we strongly encourage any potential user to contact Julien Le Sommer at his email address for more details and example scripts. Additionnally, the Python interactive help method would provide some basic information on the available modules:
  • help(PyDom): Help for the whole package.
  • help(PyDom.M): Details of each module "M", where "M" is the module's name.

[Back up top to the Introduction.]


Downloading and Installing the Package

Platforms

This package has only been tested on a GNU/Linux system, though it should work on any Unix platform that runs Python with Numpy and Scipy.

Dependencies

Python: PyDom is being developped for python (v2.4). The package has been tested on and works with python v2.4 and should probably work with python v2.5 and python 2.6.

Ipython : For interactive applications, we recommend to use PyDom jointly with Ipython.

Full functionality of PyDom requires the following packages and modules to be installed on your system and findable via your sys.path:

  • numpy: multi-dimensional array manipulation. (v1.0.1 or higher)
  • scipy: high level science and engineering module (v0.5.2 or higher)
  • pynetcdf: netcdf interface module (standalone implementation of Scientific.IO.NetCDF)(v0.7)
  • matplotlib: plotting library with the basemap projection toolkit (v0.87.7 or higher)
  • pyclimate: climate variability analysis toolbox (v1.2.1)

Note that the core utilities of PyDom only require numpy and pynetcdf. The package PyDom itself is written entirely in the Python language.

Downloading and Installing

First, get the following file:

Expansion of the tar file will create the directory PyDom-x.x.x. This directory contains the source code, a copy of the license, and example scripts.

To unzip and expand the tar file, execute at the command line:

gunzip PyDom-0.x.x.tar.gz
tar xvf PyDom-0.x.x.tar

There are a few ways you can install the package. For all these methods, first go into the PyDom-0.1.1 directory:

  • Best way: Type:

    python setup.py install

    This will install the package PyDom in the default site-packages directory in your default Python. You'll probably need administrator privileges, however, in order to do this install.
  • Next best way: Type:

    python setup.py install --home=~

    This will install the package PyDom in the directory ~/lib/python/PyDom (where ~ means your home directory). However, you'll need to make sure ~/lib/python is on your path.
  • Alternately, you can just make a directory PyDom anywhere you want and just copy the contents of ./lib into that directory. There is no compiled code in this package, so the import PyDom command only looks for a directory named PyDom on your Python path and executes the __init__.py file in it. Of course, you'll have to make sure the directory PyDom is in your path.

You can append entries to your path by:

import sys
sys.path.append('newpath')

Where 'newpath' is the full path of the location you're appending to your Python path. Thus, if the directory PyDom is in a directory /path/to/PyDom/, 'newpath' is '/path/to/PyDom'.

That's it!

[Back up top to the Introduction.]

Copyright and Licensing

Software License

Unless otherwise stated the Python routines described on this page or which reference this page are copyright © 2007, 2008 by Julien Le Sommer and constitute a library that is covered under the GNU Lesser General Public License (LGPL):

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

You can contact Julien Le Sommer at his email address or at the Laboratoire des Ecoulements Geophysiques et Industriels, BP53, 38041 Grenoble, Cedex 9, France.

A copy of the GNU LGPL can be found here. Please note that the LGPL disclaimers of warranty supercede and replace any implied or explicit warranties or claims found in the text of the routine source code.

[Back up top to the Introduction.]

Valid HTML 4.01!Valid CSS!Updated: 10 December, 2008 by Julien Le Sommer<email address>.