Awesome
CF Checker
The CF Checker is a utility that checks the contents of a NetCDF file complies with the Climate and Forecasts (CF) Metadata Convention.
Dependencies
-
netcdf4-python at version 1.2.5 or newer. This package requires netCDF, HDF5 and zlib libraries.
-
cfunits-python package version 3.0.0 or newer
-
numpy version 1.15 or newer
Installation
To install from PyPI:
pip install cfchecker
To install from Conda-forge:
conda create -n cfchecker -c conda-forge cfchecker # create new env OR
conda install cfchecker -c conda-forge # install on existing env
Alternatively, to install from source:
-
Download the cfchecker package from cfchecker releases
-
Unpack the library:
tar -zxf cfchecker-${version}.tar.gz cd cfchecker-${version}
-
Install the package:
-
To install to a central location:
python setup.py install
-
To install to a non standard location:
python setup.py install --prefix=<directory>
If directory you are installing into is not on PYTHONPATH you will need to add it.
-
Running the CF Checker
cfchecks [-a <area-types.xml>] [-r <regions.xml>] [-s <std_names.xml>] [-v <CFVersion>] [-x] [-t <cache_time_days>] file1 [file2...]
For further details and for other available command line options please see the help by running cfchecks -h
Environment Variables
The following parameters can be set on the command-line or through environment variables:
CF_STANDARD_NAMES
or (CL option-s
) : The path or URL to the CF standard names tableCF_AREA_TYPES
or (CL option-a
) : The path or URL to the CF area types tableCF_REGION_NAMES
or (CL option-r
): The path or URL to the CF region names table
Running the Test script
In the release tarball there is a test_files
directory containing a test.sh
script which runs a series of test files through the CF Checker and confirms the checker is working as expected. It is a very elementary system, which will be rewritten soon. Before running it you will need to edit the location of the cfchecks script in the tests.sh
file:
cfchecker="<location of cfchecks>"
Then just run the tests.sh
script:
./tests.sh