Changeset 254 for CCCC


Ignore:
Timestamp:
12/11/14 13:37:35 (6 years ago)
Author:
mjuckes
Message:

recording python netcdf library and version (if known) in log file

Location:
CCCC/trunk/ceda_cc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CCCC/trunk/ceda_cc/c4.py

    r253 r254  
    473473    ecount = 0 
    474474    c4i = c4_init(args=args) 
     475    c4i.logger.info( 'Starting batch -- number of file: %s' % (len(c4i.flist)) ) 
     476    c4i.logger.info( 'Source: %s' % c4i.source ) 
    475477       
    476478    isDummy  = c4i.project[:2] == '__' 
     
    480482    assert pcfg.projectV.v == -1, 'Cannot handle anything other than latest version at present' 
    481483    ncReader = fileMetadata(dummy=isDummy, attributeMappingsLog=c4i.attributeMappingsLog,forceLib=c4i.forceNetcdfLib) 
     484    c4i.logger.info( 'Python netcdf: %s' % ncReader.ncLib ) 
    482485    self.cc = checker(pcfg, c4i.project, ncReader,abortMessageCount=abortMessageCount, experimental=c4i.experimental) 
    483486    rec = recorder( c4i.project, c4i.recordFile, dummy=isDummy ) 
     
    493496 
    494497    cal = None 
    495     c4i.logger.info( 'Starting batch -- number of file: %s' % (len(c4i.flist)) ) 
    496     c4i.logger.info( 'Source: %s' % c4i.source ) 
    497498    if len( c4i.errs ) > 0: 
    498499      for i in range(0,len( c4i.errs ), 2 ): 
  • CCCC/trunk/ceda_cc/file_utils.py

    r253 r254  
    5454  def __init__(self,dummy=False,attributeMappingsLog=None,forceLib=None): 
    5555      
    56      self.dummy = dummy 
    57      self.atMapLog = attributeMappingsLog 
    58      self.forceLib = forceLib 
    59      if self.atMapLog == None: 
     56    self.dummy = dummy 
     57    self.atMapLog = attributeMappingsLog 
     58    self.forceLib = forceLib 
     59    self.ncLib = ncLib 
     60    if self.atMapLog == None: 
    6061       self.atMapLog = open( 'cccc_atMapLog.txt', 'a' ) 
     62 
     63    if self.forceLib == 'ncq3': 
     64      import ncq3 
     65      print 'Using ncq3' 
     66      self.ncq3 = ncq3 
     67      self.ncLib = 'ncq3' 
     68    elif self.forceLib == 'cdms2': 
     69      import cdms2 
     70      print 'Using using cdms2' 
     71      self.cdms2 = cdms2 
     72      self.ncLib = 'cdms2' 
     73    elif self.forceLib == 'netCDF4': 
     74      import netCDF4 
     75      self.netCDF4 = netCDF4 
     76      self.ncLib = 'netCDF4 [%s]' % netCDF4.__version__ 
     77    elif self.forceLib == 'Scientific': 
     78      import Scientific 
     79      print 'Using scientific python' 
     80      from Scientific.IO import NetCDF as ncdf 
     81      self.ncdf = ncdf 
     82      self.ncLib = 'Scientific [%s]' % Scientific.__version__ 
     83    else: 
     84      self.ncLib = ncLib 
    6185 
    6286  def close(self): 
     
    7397      self.makeDummyFileImage() 
    7498      return 
    75     if self.forceLib == 'ncq3': 
    76       import ncq3 
    77       print 'Using ncq3' 
    78       self.ncq3 = ncq3 
    79       self.loadNc__ncq(fpath) 
    80     elif self.forceLib == 'cdms2': 
    81       import cdms2 
    82       print 'Using using cdms2' 
    83       self.cdms2 = cdms2 
    84       self.loadNc__Cdms(fpath) 
    85     elif self.forceLib == 'netCDF4': 
    86       import netCDF4 
    87       print 'Using netCDF4' 
    88       self.netCDF4 = netCDF4 
    89       self.loadNc__Netcdf4(fpath) 
    90     elif self.forceLib == 'Scientific': 
    91       import Scientific 
    92       print 'Using scientific python' 
    93       from Scientific.IO import NetCDF as ncdf 
    94       self.ncdf = ncdf 
    95       self.loadNc__Scientific(fpath) 
    96     elif ncLib == 'cdms2': 
     99    elif self.ncLib == 'cdms2': 
    97100      import cdms2 
    98101      self.cdms2 = cdms2 
    99102      self.loadNc__Cdms(fpath) 
    100     elif ncLib == 'netCDF4': 
     103    elif self.ncLib == 'netCDF4': 
    101104      import netCDF4 
    102105      self.netCDF4 = netCDF4 
    103106      self.loadNc__Netcdf4(fpath) 
    104     elif ncLib == 'Scientific': 
     107    elif self.ncLib == 'Scientific': 
    105108      from Scientific.IO import NetCDF as ncdf 
    106109      self.ncdf = ncdf 
Note: See TracChangeset for help on using the changeset viewer.