Changeset 65


Ignore:
Timestamp:
03/10/13 10:07:03 (7 years ago)
Author:
mjuckes
Message:

cleaned up mipVocab to support SPECS extension

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CCCC/trunk/utils_c4.py

    r61 r65  
    546546class mipVocab: 
    547547 
    548   def __init__(self): 
     548  def __init__(self,project='CORDEX'): 
     549     assert project in ['CORDEX','SPECS'],'Project %s not recognised' % project 
     550     if project == 'CORDEX': 
     551       dir = 'cordex_vocabs/mip/' 
     552       tl = ['fx','sem','mon','day','6h','3h'] 
     553       vgmap = {'6h':'6hr','3h':'3hr'} 
     554       fnpat = 'CORDEX_%s' 
    549555     ms = mipTableScan() 
    550      dir = 'cordex_vocabs/mip/' 
    551556     self.varInfo = {} 
    552557     self.varcons = {} 
    553      for f in ['fx','sem','mon','day','6h','3h']: 
    554         vg = f 
    555         if f in ['6h','3h']: 
    556           vg += 'r' 
     558     for f in tl: 
     559        vg = vgmap.get( f, f ) 
    557560        self.varcons[vg] = {} 
    558         fn = 'CORDEX_%s' % f 
     561        fn = fnpat % f 
    559562        ll = open( '%s%s' % (dir,fn) ).readlines() 
    560563        ee = ms.scan_table(ll,None,asDict=True) 
Note: See TracChangeset for help on using the changeset viewer.