CF-Checker command-line tool
The cfchecks tool is installed in the JASMIN Analysis Platform so it is available on ingest1, jasmin-sci*, cems-sci* and LOTUS.
You can run the checker as follows:
$ cfchecks <path-to-netcdf>
By default the script is configured to download recent versions of the CF standard name table and area types table from the CF site at PCMDI. These locations can be configured as other URLs or local files on the command-line or through environment variables. See setup.sh for details.
$ cfchecks --help cfchecker [-a|--area_types area_types.xml] [-s|--cf_standard_names standard_names.xml] [-u|--udunits udunits.dat] [-v|--version CFVersion] file1 [file2...] Description: The cfchecker checks NetCDF files for compliance to the CF standard. Options: -a or --area_types: the location of the CF area types table (xml) -s or --cf_standard_names: the location of the CF standard name table (xml) -u or --udunits: the location of the udunits.dat file -h or --help: Prints this help text. -v or --version: CF version to check against.
Installation Procedure
NOTE: The following procedure includes installation of dependencies. This is not needed when using on JASMIN systems.
Brief notes follow on how to install the cf-checker in its own directory. It is assumed that you have a suitable python interpreter (Python 2.5.1+) with virtualenv installed.
1. Create a virtualenv on top of Python 2.6+
$ cd /usr/local/cf-checker $ virtualenv --no-site-packages $PWD
Create $VIRTUALENV/setup.sh which activates the environment and sets other environment variables. (See bottom of this page for an example)
2. Install cdat_lite prerequisites
- HDF5
- Check the required version of HDF5 that is compatible with the NetCDF4 install you are preparing. Download that version of HDF5 (currently HDF5-1.8.8)
Configure to install into its own sub-directory
$ ./configure --prefix=$VIRTUALENV/hdf5-1.8.8 $ make $ make check $ make install
Note: checks take a long time
Link $VIRTUALENV/hdf5-1.8.8 to $VIRTUALENV/hdf5 Link $VIRTUALENV/hdf5/bin/* to $VIRTUALENV/bin
In setup.sh set LDFLAGS and CPPFLAGS to reflect the header and library locations of hdf5 (neede to compile netcdf4)
- NetCDF4
- Check you have curl headers TODO: check version
configure to install into its own sub-directory
$ ./configure --prefix=$VIRTUALENV/netcdf4-$VERSION --enable-netcdf4 --enable-dap $ make $ make check $ make install
- Numpy
-
$ . setup.sh $ pip install numpy
- cdat_lite
-
$ pip install cdat_lite
3. Install cfchecker prerequisites
- UDUNITS2
-
Download udunits2 from unidata
$ ./configure --prefix=/usr/local/cf-checker/udunits-$VERSION $ make $ make install
4. Install cfchecker
$ pip install cfchecker
Copy the following file to $VIRTUALENV/udunits/share/udunits/udunits2_local.xml
<?xml version="1.0" encoding="US-ASCII"?> <!-- Include patch for bit units and import the defaults. --> <unit-system> <import>udunits2.xml</import> <unit> <def>1</def> <aliases> <name> <singular>bit</singular> </name> </aliases> </unit> </unit-system>
Example setup script
This is the setup.py script on glacial. Fair has a slightly different script because it is installed into its own Python interpreter.
# # Please execute this script as "source setup.sh" # CFCHECKER_HOME=/usr/local/cf-checker # Source virtual environment source $CFCHECKER_HOME/bin/activate # Configure HDF5 location for compilation export LDFLAGS="-L$CFCHECKER_HOME/hdf5/lib" export CPPFLAGS="-I$CFCHECKER_HOME/hdf5/include" # Configure dynamic library locations export LD_LIBRARY_PATH=$CFCHECKER_HOME/lib/hdf5:$CFCHECKER_HOME/netcdf/lib:$CFCHECKER_HOME/udunits/lib # Configure cf-checker dependencies # By default the checker downloads standard names and area types from the web. export CF_STANDARD_NAMES='http://cf-pcmdi.llnl.gov/documents/cf-standard-names/standard-name-table/current/cf-stand\ ard-name-table.xml' export CF_AREA_TYPES='http://cf-pcmdi.llnl.gov/documents/cf-standard-names/area-type-table/current/area-type-table.\ xml' export UDUNITS=$CFCHECKER_HOME/udunits/share/udunits/udunits2_local.xml