readmm5v3



  1. What is this module for?
  2. Download
  3. Installation
  4. Manual


1. What is this module for?

readmm5v3 is a Python (http://www.python.org) module to access the files generated by the MM5 Modelling System. These files are FORTRAN binary unformatted files with a big header in each file and a sub-header at the beginnning of each data record in the file. The format is known as mm5v3 and is described here.

The module provides an easy access from Python to the header information and the data contained in these files. It also provides three executables to obtain information on a mm5v3 file (they are Python example scripts on the use of this module):

The module is developed by the Climate Variability Group at the University of the Basque Country.

2. Download

The latest version of the module is available here along with previous versions:

[03 Sep 2007] readmm5v3-1.1.4.tar.gz
[18 Oct 2005] readmm5v3-1.1.3.tar.gz
[08 Sep 2005] readmm5v3-1.1.2.tar.gz
[14 Jun 2005] readmm5v3-1.1.1.tar.gz
[09 Feb 2005] readmm5v3-1.1.tar.gz
[19 Jun 2004] readmm5v3-1.0.tar.gz

3. Installation

Supported platforms:

Developers have tested this software on Linux (SuSE, RedHat and Debian versions) and Mac OS X (10.3.5) operating systems (big and little endian machines!!). The installation should be straightforward in any machine supporting python with distutils included, as the code is pure python (no C involved, by now). As of version 1.1.4, it should also work under Windows (thanks to K. Gebhart).

After downloading, unpack the file and enter the unpacked directory:

shell$ gunzip readmm5v3-x.x.tar.gz
shell$ tar xvf readmm5v3-x.x.tar
shell$ cd readmm5v3-x.x

The module is distributed with distutils, so it is automatically build and installed with the command:

shell$ python setup.py install

By default the module is installed into your Python distribution directories. If you prefer another location for the module (or if you are not root in the machine where you are installing the module) type:

shell$ python setup.py install --home=/your/path

and it will, then, be installed in /your/path/lib/python. Don't forget to add this path to the PYTHONPATH environment variable.

4. Manual

The syntax of the module emulates the access to NetCDF files from the module Scientific Python . There are two main constructors for the access to a single file and to multiple files.

>>> mmf = MM5V3("MMOUT_DOMAIN1")
>>> mmfmult = MM5V3Iterator(["MMOUT_DOMAIN1", "MMOUT_DOMAIN1_01", "MMOUT_DOMAIN1_02"])

At this stage the files are indexed (this can take a while if the files are large) for later random access to any time record of any variable in the file.

After one of these objects is created, the access to both single- and multiple-file objects is the same. To extract one variable (e.g. convective rainfall) and get its basic information:

>>> rc = mmf.variables["RAIN CON"]
>>> len(rc)
49
>>> rc.shape
[49, 34, 24]
>>> rc.units
cm
>>> rc.long_name
ACCUMULATED CONVECTIVE PRECIPITATION
>>> rc.staggering
C

And to access the data and date of a concrete record (e.g. the 7th):

>>> rc[7]
-- a 34x24 data array here --
>>> rc.date(7)
(2004, 6, 19, 7, 0, 0, 0)




Contact the
webmaster