GithubHelp home page GithubHelp logo

cf-checker's Introduction

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

Installation

To install from PyPI:

pip install cfchecker

Alternatively, to install from source:

  1. Download the cfchecker package from cfchecker releases

  2. Unpack the library:

     tar -zxf cfchecker-${version}.tar.gz
    
     cd cfchecker-${version}
    
  3. 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:

  1. CF_STANDARD_NAMES or (CL option -s) : The path or URL to the CF standard names table
  2. CF_AREA_TYPES or (CL option -a) : The path or URL to the CF area types table
  3. CF_REGION_NAMES or (CL option -r): The path or URL to the CF region names table

Wrapper script

A wrapper to cfchecks, called cf-checker, is provided in the src/ directory, which will maintain local copies of the standard names table and the area types table, and will refresh these local copies only if the age of the file (based on its modification time) is more than a specified maximum, defaulting to 1 day. This allows for running the checker repeatedly without refetching the tables on each invocation, while still keeping them reasonably up to date.

For a usage message, type cf-checker -h

Note that the wrapper defaults to storing the downloaded files in /var/spool/cf-checker, so if the script is used unmodified then this directory should be created or else an alternative value should be passed as a command line option (-d). Ensure either that all users have write permission to the directory used, or else that a user that does have write permission runs a cron job to refresh the tables. For the latter purpose, it is permissible to run the wrapper without specifying any data files to check, in which it will do no more than update the tables; this is still conditional on age, so for this purpose it is recommended to run the wrapper with a maximum age of zero (-t 0), and to run the cron job at intervals not exceeding the default maximum age.

The wrapper is maintained by CEDA and not by NCAS CMS.

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

cf-checker's People

Contributors

agstephens avatar alaniwi avatar giumas avatar rosalynhatcher avatar stephenpascoe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.