A python module for comparing one or more NetCDF files against a known NetCDF template. Results are printed to STDOUT and errors (i.e.: missing dimensions, variables, global and variable attributes) are printed to STDERR.
The comparison is very simple. The template file is read and then compared to the structure of each of the files specified on the command line. The following items are checked:
- Inclusion of proper dimension variables
- Inclusion of global attributes
- Inclusion of proper variables
- Datatypes of included variables
- Attributes of included variables
Data integrity is NOT checked.
###Required Non-Core Python modules:###
The following modules are required and not typically installed with standard python distributions and can be installed using pip:
>> pip install netcdf4
The Anaconda and Enthought Python Distribution python distributions come with these modules installed.
###Usage###
> nc_validate -h
for usage.
The module may be executed from the command line. If run this way, the specified files are compared to the template file contained in:
./templates/IOOS_Glider_NetCDF_v2.0.nc
If you would like to change the file against which the specified files are compared, you can do one of the following:
- Use the -t or --template option and specify the location of the template file.
Run the script like this:
> nc_validate.py --template PATH_TO_TEMPLATE FILE1[, FILE2, ...]
- Put the file somewhere and specify it's location in the default_nc_template variable (line #9).
Then run the script like this:
> nc_validate.py FILE1[, FILE2, ...]