source: CCCC/trunk/ceda_cc/c4.py @ 212

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CCCC/trunk/ceda_cc/c4.py@212
Revision 212, 21.3 KB checked in by mjuckes, 6 years ago (diff)

undated comp_mpi

Line 
1
2import sys
3
4## callout to summary.py: if this option is selected, imports of libraries are not needed.
5if __name__ == '__main__' and sys.argv[1] == '--sum':
6      import summary
7      summary.main()
8      raise SystemExit(0)
9
10# Standard library imports
11import os, string, time, logging, sys, glob, pkgutil
12import shutil
13## pkgutil is used in file_utils
14# Third party imports
15
16## Local imports with 3rd party dependencies
17#### netcdf --- currently only support for cmds2 -- re-arranged to facilitate support for alternative modules
18
19import file_utils
20
21from file_utils import fileMetadata, ncLib
22
23# Local imports
24import utils_c4 as utils
25import config_c4 as config
26
27reload( utils )
28
29from xceptions import baseException
30
31from fcc_utils2 import tupsort
32
33
34#driving_model_ensemble_member = <CMIP5Ensemble_member>
35#rcm_version_id = <RCMVersionID>                     
36
37class dummy(object):
38   pass
39
40pathTmplDict = { 'CORDEX':'%(project)s/%(product)s/%(domain)s/%(institute)s/%(driving_model)s/%(experiment)s/%(ensemble)s/%(model)s/%(model_version)s/%(frequency)s/%(variable)s/files/%%(version)s/',   \
41                 'SPECS':'%(project)s/%(product)s/%(institute)s/%(model)s/%(experiment)s/%(start_date)s/%(frequency)s/%(realm)s/%(table)s/%(variable)s/%(ensemble)s/files/%%(version)s/', \
42                 'CMIP5':'%(project)s/%(product)s/%(institute)s/%(model)s/%(experiment)s/%(frequency)s/%(realm)s/%(table)s/%(ensemble)s/files/%%(version)s/%(variable)s/', \
43                 '__def__':'%(project)s/%(product)s/%(institute)s/%(model)s/%(experiment)s/%(frequency)s/%(realm)s/%(variable)s/%(ensemble)s/files/%%(version)s/', \
44               }
45
46## Core DRS: list of vocab names
47## Path template: -- current version puts upper case in "project"
48## Dataset template: 
49
50class recorder(object):
51
52  def __init__(self,project,fileName,type='map',dummy=False):
53    self.dummy = dummy
54    self.file = fileName
55    self.type = type
56    self.pathTmpl = '%(project)s/%(product)s/%(domain)s/%(institute)s/%(driving_model)s/%(experiment)s/%(ensemble)s/%(model)s/%(model_version)s/%(frequency)s/%(variable)s/files/%%(version)s/'
57    self.pathTmpl = pathTmplDict.get(project,pathTmplDict['__def__'])
58    self.records = {}
59    self.tidtupl = []
60
61  def open(self):
62    if self.type == 'map':
63      self.fh = open( self.file, 'a' )
64    else:
65      self.sh = shelve.open( self.file )
66
67  def close(self):
68    if self.type == 'map':
69      self.fh.close()
70    else:
71      self.sh.close()
72
73  def add(self,fpath,drs,safe=True):
74    assert self.type == 'map','Can only do map files at present'
75    assert type(drs) == type( {} ), '2nd user argument to method add should be a dictionary [%s]' % type(drs)
76    tpath = self.pathTmpl % drs
77    if not self.dummy:
78      assert os.path.isfile( fpath ), 'File %s not found' % fpath
79      fdate = time.ctime(os.path.getmtime(fpath))
80      sz = os.stat(fpath).st_size
81    else:
82      fdate = "na"
83      sz = 0
84    record = '%s | OK | %s | modTime = %s | target = %s ' % (fpath,sz,fdate,tpath)
85    fn = string.split( fpath, '/' )[-1]
86    for k in ['creation_date','tracking_id']:
87      if k in drs.keys():
88        record += ' | %s = %s' % (k,drs[k])
89        if k == 'tracking_id':
90          self.tidtupl.append( (fn,drs[k]) )
91
92    self.records[fn] = record
93 
94  def modify(self,fn,msg):
95    assert fn in self.records.keys(),'Attempt to modify non-existent record %s, %s' % [fn,str(self.records.keys()[0:10])]
96    if string.find( self.records[fn], '| OK |') == -1:
97      ##print 'File %s already flagged with errors' % fn
98      return
99    s = string.replace( self.records[fn], '| OK |', '| %s |' % msg )
100    ##print '--> ',s
101    self.records[fn] = s
102
103  def checktids(self):
104## sort by tracking id
105    if len( self.tidtupl ) == 1:
106      return
107    self.tidtupl.sort( cmp=tupsort(k=1).cmp )
108    nd = 0
109    fnl = []
110    for k in range(len(self.tidtupl)-1):
111      if self.tidtupl[k][1] == self.tidtupl[k+1][1]:
112        print 'Duplicate tracking_id: %s, %s:: %s' % (self.tidtupl[k][0],self.tidtupl[k+1][0],self.tidtupl[k][1])
113        nd += 1
114        if len(fnl) == 0 or fnl[-1] != self.tidtupl[k][0]:
115          fnl.append( self.tidtupl[k][0])
116        fnl.append( self.tidtupl[k+1][0])
117    if nd == 0:
118      print 'No duplicate tracking ids found in %s files' % len(self.tidtupl)
119    else:
120      print '%s duplicate tracking ids' % nd
121      for f in fnl:
122        self.modify( f, 'ERROR: duplicate tid' )
123
124  def dumpAll(self,safe=True):
125    keys = self.records.keys()
126    keys.sort()
127    for k in keys:
128      self.dump( self.records[k], safe=safe )
129
130  def dump( self, record, safe=True ):
131    if safe:
132      self.open()
133    self.fh.write( record + '\n' )
134    if safe:
135      self.close()
136
137  def addErr(self,fpath,reason,safe=True):
138    record = '%s | %s' % (fpath, reason)
139    fn = string.split( fpath, '/' )[-1]
140    self.records[fn] = record
141
142class checker(object):
143  def __init__(self, pcfg, cls,reader,abortMessageCount=-1):
144    self.info = dummy()
145    self.info.pcfg = pcfg
146    self.info.abortMessageCount = abortMessageCount
147    self.calendar = 'None'
148    self.ncReader = reader
149    self.cfn = utils.checkFileName( parent=self.info,cls=cls)
150    self.cga = utils.checkGlobalAttributes( parent=self.info,cls=cls)
151    self.cgd = utils.checkStandardDims( parent=self.info,cls=cls)
152    self.cgg = utils.checkGrids( parent=self.info,cls=cls)
153    self.cls = cls
154
155    # Define vocabs based on project
156    ##self.vocabs = getVocabs(pcgf)
157    self.vocabs = pcfg.vocabs
158
159  def checkFile(self,fpath,log=None,attributeMappings=[]):
160    self.calendar = 'None'
161    self.info.log = log
162
163    fn = string.split( fpath, '/' )[-1]
164
165    if attributeMappings != []:
166      self.ncReader.loadNc( fpath )
167      self.ncReader.applyMap( attributeMappings, self.cfn.globalAttributesInFn, log=log )
168      ncRed = True
169      thisFn = self.ncReader.fn
170    else:
171      ncRed = False
172      thisFn = fn
173
174    self.cfn.check( thisFn )
175    if not self.cfn.completed:
176      self.completed = False
177      return
178    if not self.info.pcfg.project[:2] == '__':
179      if not os.path.isfile( fpath ):
180        print 'File %s not found [2]' % fpath
181        self.completed = False
182        return
183
184    if not ncRed:
185      ##print fpath
186      self.ncReader.loadNc( fpath )
187    self.ga = self.ncReader.ga
188    self.va = self.ncReader.va
189    self.da = self.ncReader.da
190
191    if self.cfn.freq != None:
192      vGroup = self.cfn.freq
193    else:
194      vGroup = self.info.pcfg.mipVocabVgmap.get(self.cfn.group,self.cfn.group)
195    self.cga.check( self.ga, self.va, self.cfn.var, vGroup, self.vocabs, self.cfn.fnParts )
196    if not self.cga.completed:
197      self.completed = False
198      return
199
200    ##self.cgd.plevRequired = config.plevRequired
201    ##self.cgd.plevValues = config.plevValues
202    ##self.cgd.heightRequired = config.heightRequired
203    ##self.cgd.heightValues = config.heightValues
204    ##self.cgd.heightRange = config.heightRange
205    self.cgd.check( self.cfn.var, self.cfn.freq, self.da, self.va, self.cga.isInstantaneous )
206    self.calendar = self.cgd.calendar
207    if not self.cgd.completed:
208      self.completed = False
209      return
210
211    if self.info.pcfg.doCheckGrids:
212      ##self.cgg.rotatedPoleGrids = config.rotatedPoleGrids
213      ##self.cgg.interpolatedGrids = config.interpolatedGrids
214      self.cgg.check( self.cfn.var, self.cfn.domain, self.da, self.va )
215   
216      if not self.cgg.completed:
217        self.completed = False
218        return
219    self.completed = True
220    self.drs = self.cga.getDrs()
221    self.drs['project'] = self.info.pcfg.project
222    self.errorCount = self.cfn.errorCount + self.cga.errorCount + self.cgd.errorCount + self.cgg.errorCount
223
224class c4_init(object):
225
226  def __init__(self,args=None):
227    self.logByFile = True
228    self.policyFileLogfileMode = 'w'
229    self.policyBatchLogfileMode = 'np'
230    if args==None:
231       args = sys.argv[1:]
232    nn = 0
233
234    self.attributeMappingFile = None
235    self.recordFile = 'Rec.txt'
236    self.logDir = 'logs_02'
237    self.errs = []
238   
239    # Set default project to "CORDEX"
240    self.project = "CORDEX"
241    self.holdExceptions = False
242    forceLogOrg = None
243    argsIn = args[:]
244
245    # The --copy-config option must be the first argument if it is present.
246    if args[0] == '--copy-config':
247       if len(args) < 2:
248         self.commandHints( argsIn )
249       args.pop(0)
250       dest_dir = args.pop(0)
251       config.copy_config(dest_dir)
252       print 'Configuration directory copied to %s.  Set CC_CONFIG_DIR to use this configuration.' % dest_dir
253       print
254       raise SystemExit(0)
255    elif args[0] == '-h':
256       print 'Help command not implemented yet'
257       raise SystemExit(0)
258
259    self.summarymode = args[0] == '--sum'
260    if self.summarymode:
261      return
262
263    self.forceNetcdfLib = None
264    fltype = None
265    argu = []
266    while len(args) > 0:
267      next = args.pop(0)
268      if next == '-f':
269        flist = [args.pop(0),]
270        self.logByFile = False
271        fltype = '-f'
272        self.source = flist[0]
273      elif next == '--log':
274        x = args.pop(0)
275        assert x in ['single','multi','s','m'], 'unrecognised logging option (--log): %s' % (x)
276        if x in ['multi','m']:
277           forceLogOrg = 'multi'
278        elif x in ['single','s']:
279           forceLogOrg = 'single'
280      elif next == '--force-ncq':
281        self.forceNetcdfLib = 'ncq3'
282      elif next == '--force-cdms2':
283        self.forceNetcdfLib = 'cdms2'
284      elif next == '--force-pync4':
285        self.forceNetcdfLib = 'netCDF4'
286      elif next == '--force-scientific':
287        self.forceNetcdfLib = 'Scientific'
288      elif next == '--flfmode':
289        lfmk = args.pop(0)
290        assert lfmk in ['a','n','np','w','wo'], 'Unrecognised file logfile mode (--flfmode): %s' % lfmk
291        self.policyFileLogfileMode = lfmk
292      elif next == '--blfmode':
293        lfmk = args.pop(0)
294        assert lfmk in ['a','n','np','w','wo'], 'Unrecognised batch logfile mode (--blfmode): %s' % lfmk
295        self.policyBatchLogfileMode = lfmk
296      elif next == '-d':
297        fdir = args.pop(0)
298        flist = glob.glob( '%s/*.nc' % fdir  )
299        self.source = '%s/*.nc' % fdir
300      elif next == '-D':
301        flist  = []
302        fdir = args.pop(0)
303        for root, dirs, files in os.walk( fdir, followlinks=True ):
304          for f in files:
305            fpath = '%s/%s' % (root,f)
306            if (os.path.isfile( fpath ) or os.path.islink( fpath )) and f[-3:] == '.nc':
307              flist.append( fpath )
308        self.source = '%s/.....' % fdir
309      elif next == '-R':
310        self.recordFile = args.pop(0)
311      elif next == '--ld':
312        self.logDir = args.pop(0)
313      elif next in ['--catchAllExceptions','--cae']:
314        self.holdExceptions = True
315      elif next == '--aMap':
316        self.attributeMappingFile = args.pop(0)
317        assert os.path.isfile( self.attributeMappingFile ), 'The token "--aMap" should be followed by the path or name of a file'
318      elif next == "-p":
319        self.project = args.pop(0)
320      else:
321       print 'Unused argument: %s' % next
322       argu.append( next )
323       nn+=1
324    if nn != 0:
325      print 'Unused arguments: ', argu
326      self.commandHints( argsIn )
327
328    if self.project == 'CMIP5' and fltype != '-f':
329      fl0 = []
330      for f in flist:
331        if string.find( f, '/latest/' ) != -1:
332          fl0.append(f)
333      flist = fl0
334
335    if forceLogOrg != None:
336      if forceLogOrg == 'single':
337        self.logByFile = False
338      else:
339        self.logByFile = True
340
341    if self.project[:2] == '__':
342       flist = []
343       ss = 'abcdefgijk'
344       ss = 'abcdefgijklmnopqrstuvwxyz'
345       ss = 'abc'
346       for i in range(10):
347         v = 'v%s' % i
348         for a in ss:
349           for b in ss:
350             flist.append( '%s_day_%s_%s_1900-1909.nc' % (v,a,b) )
351    flist.sort()
352    fnl = []
353    for f in flist:
354      fn = string.split(f, '/')[-1]
355      fnl.append(fn)
356    nd = 0
357    dupl = []
358    for k in range(len(fnl)-1):
359      if fnl[k] == fnl[k-1]:
360        nd += 1
361        dupl.append( fnl[k] )
362    self.dupDict = {}
363    for f in dupl:
364      self.dupDict[f] = 0
365    if nd != 0:
366      self.errs.append( 'Duplicate file names encountered: %s' % nd )
367      self.errs.append( dupl )
368    self.flist = flist
369    self.fnl = fnl
370    if not os.path.isdir(   self.logDir ):
371       os.mkdir(   self.logDir )
372
373    tstring1 = '%4.4i%2.2i%2.2i_%2.2i%2.2i%2.2i' % time.gmtime()[0:6]
374    self.batchLogfile = '%s/qcBatchLog_%s.txt' % (  self.logDir,tstring1)
375## default appending to myapp.log; mode='w' forces a new file (deleting old contents).
376    self.logger = logging.getLogger('c4logger')
377    if self.policyBatchLogfileMode in ['n','np']:
378        assert not os.path.isfile( self.batchLogfile ), '%s exists and policy set to new file' % self.batchLogfile
379    m = self.policyBatchLogfileMode[0]
380    if m == 'n':
381      m = 'w'
382    if m == 'a':
383      self.hdlr = logging.FileHandler(self.batchLogfile)
384    else:
385      self.hdlr = logging.FileHandler(self.batchLogfile,mode=m)
386    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
387    self.hdlr.setFormatter(formatter)
388    self.logger.setLevel(logging.INFO)
389    self.logger.addHandler(self.hdlr)
390
391    self.attributeMappings = []
392    self.attributeMappingsLog = None
393    if self.attributeMappingFile != None:
394      for l in open( self.attributeMappingFile ).readlines():
395        if l[0] != '#':
396          bb = string.split( string.strip(l), '|' ) 
397          assert len(bb) ==2, "Error in experimental module attributeMapping -- configuration line not scanned [%s]" % str(l)
398          bits = string.split( bb[0], ';' )
399          cl = []
400          for b in bits:
401            cl.append( string.split(b, '=' ) )
402          self.attributeMappings.append( ('am001',cl, string.split(bb[1],'=') ) )
403      self.attributeMappingsLog = open( 'attributeMappingsLog.txt', 'w' )
404
405  def commandHints(self, args):
406    if args[0] in ['-h','--sum']:
407      print 'Arguments look OK'
408    elif args[0] == '--copy-config':
409      print 'Usage [configuration copy]: ceda_cc --copy-config <target directory path>'
410    else:
411      if not( '-f' in args or '-d' in args or '-D' in args):
412        print 'No file or target directory specified'
413        print """USAGE:
414ceda_cc -p <project> [-f <NetCDF file>|-d <directory containing files>|-D <root of directory tree>] [other options]
415
416With the "-D" option, all files in the directory tree beneath the given diretory will be checked. With the "-d" option, only files in the given directory will be checked.
417"""
418    raise SystemExit(0)
419   
420
421  def getFileLog( self, fn, flf=None ):
422    if flf == None:
423      tstring2 = '%4.4i%2.2i%2.2i' % time.gmtime()[0:3]
424      if fn in self.dupDict.keys():
425        tag = '__%2.2i' % self.dupDict[fn]
426        self.dupDict[fn] += 1
427      else:
428        tag = ''
429      self.fileLogfile = '%s/%s%s__qclog_%s.txt' % (self.logDir,fn[:-3],tag,tstring2)
430      if self.policyFileLogfileMode in ['n','np']:
431        assert not os.path.isfile( self.fileLogfile ), '%s exists and policy set to new file' % self.fileLogfile
432      m = self.policyFileLogfileMode[0]
433      if m == 'n':
434        m = 'w'
435    else:
436      m = 'a'
437      self.fileLogfile = flf
438
439    self.fLogger = logging.getLogger('fileLog_%s_%s' % (fn,m))
440    if m == 'a':
441      self.fHdlr = logging.FileHandler(self.fileLogfile)
442    else:
443      self.fHdlr = logging.FileHandler(self.fileLogfile,mode=m)
444    fileFormatter = logging.Formatter('%(message)s')
445    self.fHdlr.setFormatter(fileFormatter)
446    self.fLogger.addHandler(self.fHdlr)
447    self.fLogger.setLevel(logging.INFO)
448    return self.fLogger
449
450  def closeFileLog(self):
451    self.fLogger.removeHandler(self.fHdlr)
452    self.fHdlr.close()
453    if self.policyFileLogfileMode in ['wo','np']:
454      os.popen( 'chmod %s %s;' % (444, self.fileLogfile) )
455
456  def closeBatchLog(self):
457    self.logger.removeHandler(self.hdlr)
458    self.hdlr.close()
459    if self.policyBatchLogfileMode in ['wo','np']:
460      os.popen( 'chmod %s %s;' % (444, self.batchLogfile) )
461
462
463class main(object):
464
465  def __init__(self,args=None,abortMessageCount=-1,printInfo=False,monitorFileHandles = False):
466    logDict = {}
467    ecount = 0
468    c4i = c4_init(args=args)
469     
470    isDummy  = c4i.project[:2] == '__'
471    if (ncLib == None) and (not isDummy):
472       raise baseException( 'Cannot proceed with non-dummy [%s] project without a netcdf API' % (c4i.project) )
473    pcfg = config.projectConfig( c4i.project )
474    ncReader = fileMetadata(dummy=isDummy, attributeMappingsLog=c4i.attributeMappingsLog,forceLib=c4i.forceNetcdfLib)
475    self.cc = checker(pcfg, c4i.project, ncReader,abortMessageCount=abortMessageCount)
476    rec = recorder( c4i.project, c4i.recordFile, dummy=isDummy )
477    if monitorFileHandles:
478      self.monitor = utils.sysMonitor()
479    else:
480      self.monitor = None
481
482    cal = None
483    c4i.logger.info( 'Starting batch -- number of file: %s' % (len(c4i.flist)) )
484    c4i.logger.info( 'Source: %s' % c4i.source )
485    if len( c4i.errs ) > 0:
486      for i in range(0,len( c4i.errs ), 2 ):
487        c4i.logger.info( c4i.errs[i] )
488 
489    self.cc.info.amapListDraft = []
490    cbv = utils.checkByVar( parent=self.cc.info,cls=c4i.project,monitor=self.monitor)
491    cbv.impt( c4i.flist )
492    if printInfo:
493      print cbv.info
494
495    fileLogOpen = False
496    self.resList =  []
497    stdoutsum = 2000
498    npass = 0
499    kf = 0
500    for f in c4i.flist:
501      kf += 1
502      rv = False
503      ec = None
504      if monitorFileHandles:
505        nofhStart = self.monitor.get_open_fds()
506      fn = string.split(f,'/')[-1]
507      c4i.logger.info( 'Starting: %s' % fn )
508      try:
509  ### need to have a unique name, otherwise get mixing of logs despite close statement below.
510  ### if duplicate file names are present, this will be recorded in the main log, tag appended to file level log name (not yet tested).
511        if c4i.logByFile:
512          fLogger = c4i.getFileLog( fn )
513          logDict[fn] = c4i.fileLogfile
514          c4i.logger.info( 'Log file: %s' % c4i.fileLogfile )
515          fileLogOpen = True
516        else:
517          fLogger = c4i.logger
518 
519        fLogger.info( 'Starting file %s' % fn )
520## default appending to myapp.log; mode='w' forces a new file (deleting old contents).
521        self.cc.checkFile( f, log=fLogger,attributeMappings=c4i.attributeMappings )
522
523        if self.cc.completed:
524          if cal not in (None, 'None') and self.cc.cgd.varGroup != "fx":
525            if cal != self.cc.calendar:
526              cal_change_err_msg = 'Error: change in calendar attribute %s --> %s' % (cal, self.cc.calendar)
527              c4i.logger.info(cal_change_err_msg)
528              fLogger.info(cal_change_err_msg)
529              self.cc.errorCount += 1
530
531          cal = self.cc.calendar
532          ec = self.cc.errorCount
533        rv =  ec == 0
534        if rv:
535          npass += 1
536        self.resList.append( (rv,ec) )
537
538        if c4i.logByFile:
539          if self.cc.completed:
540            fLogger.info( 'Done -- error count %s' % self.cc.errorCount )
541          else:
542            fLogger.info( 'Done -- checks not completed' )
543          c4i.closeFileLog( )
544          fileLogOpen = False
545
546        if self.cc.completed:
547          c4i.logger.info( 'Done -- error count %s' % self.cc.errorCount ) 
548          ecount += self.cc.errorCount
549          if self.cc.errorCount == 0:
550            rec.add( f, self.cc.drs )
551          else:
552            rec.addErr( f, 'ERRORS FOUND | errorCount = %s' % self.cc.errorCount )
553        else:
554          ecount += 20
555          c4i.logger.info( 'Done -- testing aborted because of severity of errors' )
556          rec.addErr( f, 'ERRORS FOUND AND CHECKS ABORTED' )
557      except:
558        c4i.logger.error("Exception has occured" ,exc_info=1)
559        if fileLogOpen:
560          fLogger.error("C4.100.001: [exception]: FAILED:: Exception has occured" ,exc_info=1)
561          c4i.closeFileLog( )
562          fileLogOpen = False
563        rec.addErr( f, 'ERROR: Exception' )
564        if not c4i.holdExceptions:
565          raise
566      if stdoutsum > 0 and kf%stdoutsum == 0:
567         print '%s files checked; %s passed this round' % (kf,npass)
568      if monitorFileHandles:
569        nofhEnd = self.monitor.get_open_fds()
570        if nofhEnd > nofhStart:
571           print 'Open file handles: %s --- %s' % (nofhStart, nofhEnd)
572 
573    self.cc.info.log = c4i.logger
574   
575    if c4i.project not in ['SPECS','CCMI','CMIP5']:
576       cbv.c4i = c4i
577       cbv.setLogDict( logDict )
578       cbv.check( recorder=rec, calendar=self.cc.calendar)
579       try:
580         ecount += cbv.errorCount
581       except:
582         ecount = None
583    ncReader.close()
584    if type( self.cc.info.amapListDraft ) == type( [] ) and len(  self.cc.info.amapListDraft ) > 0:
585      ll =  self.cc.info.amapListDraft
586      ll.sort()
587      oo = open( 'amapDraft.txt', 'w' )
588      oo.write( ll[0] + '\n' )
589      for i in range( 1,len(ll) ):
590        if ll[i] != ll[i-1]:
591          oo.write( ll[i] + '\n' )
592      oo.close()
593    if c4i.project in ['SPECS','CCMI','CMIP5']:
594      rec.checktids()
595    rec.dumpAll()
596    if printInfo:
597      print 'Error count %s' % ecount
598    ##c4i.hdlr.close()
599    c4i.closeBatchLog()
600    self.ok = all( map( lambda x: x[0], self.resList ) )
601
602
603   
604
605
606def main_entry():
607   """
608   Wrapper around main() for use with setuptools.
609
610   """
611   main(printInfo=True)
612
613if __name__ == '__main__':
614  if sys.argv[1] == '--sum':
615      import summary
616      summary.main()
617      raise SystemExit(0)
618  main_entry()
619
620
621##else:
622  ##f1 = '/data/u10/cordex/AFR-44/SMHI/ECMWF-ERAINT/evaluation/SMHI-RCA4/v1/day/clh/clh_AFR-44_ECMWF-ERAINT_evaluation_r1i1p1_SMHI-RCA4_v1_day_19810101-19851231.nc'
623  ##f2 = '/data/u10/cordex/AFR-44/SMHI/ECMWF-ERAINT/evaluation/SMHI-RCA4/v1/sem/tas/tas_AFR-44_ECMWF-ERAINT_evaluation_r1i1p1_SMHI-RCA4_v1_sem_200012-201011.nc'
624  ##f3 = '/data/u10/cordex/AFR-44i/SMHI/ECMWF-ERAINT/evaluation/SMHI-RCA4/v1/mon/tas/tas_AFR-44i_ECMWF-ERAINT_evaluation_r1i1p1_SMHI-RCA4_v1_mon_199101-200012.nc'
625  ##cc.checkFile( f3 )
Note: See TracBrowser for help on using the repository browser.