Changeset 137 for CCCC/trunk/README.txt


Ignore:
Timestamp:
18/03/14 13:55:52 (7 years ago)
Author:
mjuckes
Message:

improved python API and logfile control

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CCCC/trunk/README.txt

    r134 r137  
    22----- 
    33 
     4From the command line: 
     5---------------------- 
     6 
    47Required arguments: 
    58 
    6 python c4.py -D <directory>  ## check all files in directory tree 
    7 python c4.py -d <directory>  ## check all files in directory 
    8 python c4.py -f <file>       ## check a single file. 
     9python c4.py -p <project> -D <directory>  ## check all files in directory tree, for project in SPECS, CORDEX, CCMI. 
     10python c4.py -p <project> -d <directory>  ## check all files in directory 
     11python c4.py -p <project> -f <file>       ## check a single file. 
    912 
    1013Optional arguments: 
     
    1518                             in  log files, and then continue. Default is to 
    1619                            stop after unrecognised exceptions. 
     20  --log <single|multi>  ## Set log file management option -- see "Single log" and "Multi-log" below. 
     21  --blfmode <mode>      # set mode for batch log file -- see log file modes 
     22  --flfmode <mode>      # set mode for file-level log file -- see log file modes 
     23 
     24 
     25Called from python: 
     26------------------ 
     27The code can also be called from a python script: 
     28 
     29import c4 
     30m = c4.main( args=argList )     # argList is a python list of command line arguments 
     31if not m.ok: 
     32  print 'check failed' 
     33else: 
     34  print 'success' 
     35  print 'DRS dictionary:', m.cc.drs    # print drs of last file checked -- not useful in multiple file mode. 
     36 
     37e.g. 
     38m = c4.main( args=[ '-p', 'CORDEX', '-f', dataFilePath, '--ld', logFileDirectory] ) 
     39## run checks on a single file located at dataFilePath, and write logs to logFileDirectory 
     40 
     41DEPENDENCIES 
     42------------ 
     43 
     44The library uses the cmds2 module to read NetCDF files. 
    1745 
    1846OUTPUT 
    1947------ 
    2048 
    21 For single file 
     49Single log (default for single file) 
    2250  -- log of errors found and checks passed 
    2351  -- "Rec.txt" -- single record summarising results. If no errors are found, the archive directory path for the file will be in this record. 
    2452 
    25 For multiple files: 
     53Multi-log (default for multiple files): 
    2654  -- separate log of errors for each file; 
    2755  -- summary log, 3 records per file; 
    2856  -- "Rec.txt" -- single record for each file, as above 
     57 
     58Log file modes. 
     59Valid modes are: 'a': append 
     60                 'n', 'np': new file, 'np': protect after closing (mode = 444) 
     61                 'w', 'wo': write (overwrite if present), 'wo': protect after closing (mode = 444) 
     62 
     63Note that the log files generated in multi-log mode will re-use file names. If running with --flfmode set to 'n','np' or 'wo' it will be necessary to change or clear the target directory. The names of batch log files include the time, to the nearest second, when the process is started, so will not generally suffer from re-use. 
    2964 
    3065Vocabulary lists GCMModelName.txt and RCMModelName.txt are held on the DMI CORDEX site: 
     
    3671"git clone git://uv-cdat.llnl.gov/gitweb/cordex-cmor-tables.git" 
    3772 
    38 Exceptions 
     73EXCEPTIONS 
    3974---------- 
    4075The exception handling is designed to ensure that problems analysing one file do not prevent testing of other files. 
    4176Traceback information is written to log file. 
    4277 
     78BUGS 
     79---- 
     80The cmds2 library generates a data array for dimensions if there is none present in the file. Tests applied to this library generated array will generate mis-leading error messages. Within cmds2 there is no clear method of distinguishing between library generates arrays and those which exist in the data file. The solution may be to move to using the NetCDF4 module instead. 
     81 
    4382---------- 
Note: See TracChangeset for help on using the changeset viewer.