source: CCCC/trunk/README.txt @ 137

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CCCC/trunk/README.txt@137
Revision 137, 3.4 KB checked in by mjuckes, 7 years ago (diff)

improved python API and logfile control

Line 
1USAGE
2-----
3
4From the command line:
5----------------------
6
7Required arguments:
8
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.
12
13Optional arguments:
14
15  --ld <log file directory>  ## directory to take log files;
16  -R <record file name> ## file name for file to take one record per file checked;
17  --cae                 ## "catch all errors": will trap exceptions and record
18                             in  log files, and then continue. Default is to
19                            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.
45
46OUTPUT
47------
48
49Single log (default for single file): 
50  -- log of errors found and checks passed
51  -- "Rec.txt" -- single record summarising results. If no errors are found, the archive directory path for the file will be in this record.
52
53Multi-log (default for multiple files):
54  -- separate log of errors for each file;
55  -- summary log, 3 records per file;
56  -- "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.
64
65Vocabulary lists GCMModelName.txt and RCMModelName.txt are held on the DMI CORDEX site:
66
67  http://cordex.dmi.dk/joomla/images/CORDEX/GCMModelName.txt
68  http://cordex.dmi.dk/joomla/images/CORDEX/RCMModelName.txt
69
70To update the CMOR tables use:
71"git clone git://uv-cdat.llnl.gov/gitweb/cordex-cmor-tables.git"
72
73EXCEPTIONS
74----------
75The exception handling is designed to ensure that problems analysing one file do not prevent testing of other files.
76Traceback information is written to log file.
77
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
82----------
Note: See TracBrowser for help on using the repository browser.