1. Michael Decker
  2. CFchecker



CFchecker - a CF-1.x compliance checker


The CFchecker aims to provide as-complete-as-possible support for compliance checking of the NetCDF Climate and Forecast (CF) Metadata Conventions. It is implemented as a pure Python library and commandline utility that can be used either stand-alone or as part of other (Python) software. While it should theoretically be possible to run it on any platform that is supported by Python, the primary target platform so far is Linux. This is due to 3rd party libraries that might not be supported on all platforms.

CFchecker is modular in the sense that every section of the official compliance document is implemented as an independent test. This allows the user to choose which tests to run at run-time.

The main repository can be found at https://repositories.iek.fz-juelich.de/hg/CFchecker/ and is mirrored at https://bitbucket.org/mde_/cfchecker. Additional resources (including a bugtracker) can be found at https://redmine.iek.fz-juelich.de/projects/cfchecker.

Installation and tests


  • At present, the package only runs under Linux. However, this is exclusively due to its dependencies, namely UDUnits (see below).

  • This software has been developed using python 2.7.x but should run from version 2.6 up. (NOT tested with version 3.x!)

  • python numpy package version 1.6 or newer.

  • python netCDF4 package at version 0.9.7 or newer, tested with version 1.0.2. This package requires the netCDF, HDF5 and zlib libraries which are usually available from distribution repositories.

  • cfunits package version 0.9.7 or newer, tested with version 0.9.7. This package requires the UNIDATA's Udunits-2 package which is the underlying library which provides support for units of physical quantities (and their conversion). This library might be available from distribution repositories - depending on your distribution. UDUnits is currently only supported on POSIX systems (not Windows).

  • lxml version 2.3 up. Tested with 2.3.4 and 3.2.1. This package provides an interface to libxml2 and libxslt and is used to access CF standard name and area type tables.

  • nose This package is optional and only needed if you want to run the included test cases.


  1. Download the CFchecker package from the CFchecker downloads section

  2. Unpack it with (changing the version number as appropriate):

    tar xvjf CFchecker-<version>.tar.bz2
  3. Within the newly created directory CFchecker run one of the following:

    • To install the package to the system default location:

      python setup.py install
    • To install the package to a local default user location:

      python setup.py install --user

Other install options are available via

        python setup.py install --help


All test related code is in the test directory. To run all test cases simply run the following command from the CFchecker package directory (You need to have nose installed, of course):

nosetests [-v]

To run tests only for a specific CF version use:

nosetests [-v] test/cf_<version>.py

If you downloaded a versioned tar file (and not the dev version from the repository) then all tests should succeed without any failures or errors.

Command line utilities


The cfchecker command invokes the CFchecker functionality from the command line. It supports checks of single files as well as batch checks of multiple files and/or directory structures.

The executable will be installed to $PREFIX/bin/cfchecker. Make sure to either include this location in your path or to call the cfchecker executable with its full path. Example: If you're using the (Linux) default PREFIX (/usr/local) then the executable should end up in /usr/local/bin/cfchecker.

Various options can be set at execution time to influence level of information displayed to the user as well as CF versions to check against and which compliance tests to run:

  • quiet: no output to stdout, only report results using return codes

  • status-only: only report the overall status for each checked file

  • summary: only print a global summary of all checked files

  • tests-to-run: only run specific tests instead of all tests

  • convention: override autodetection and check against a specific conventions version

More information about the various commandline options can be viewed by calling

cfchecker --help

Python Interface

The principal high-level interface can be accessed via the CFchecker.checkfile method:

>>> import CFchecker
>>> CFchecker.checkfile(...)


>>> help(CFchecker)

for more information about call parameters, etc.

Code license and copyright

GPL v2.0 License

Copyright (c) 2009-2016 by Michael Decker <m.decker AT fz-juelich.de>

All rights reserved, see LICENSE for details.

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

This program 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 General Public License for more details.

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