Changeset 926 for CMIP6dreqbuild


Ignore:
Timestamp:
20/01/17 10:10:15 (3 years ago)
Author:
mjuckes
Message:

stripped sx203.py from sx202.py

Location:
CMIP6dreqbuild/trunk/srcMisc
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreqbuild/trunk/srcMisc/dreqSX.py

    r770 r926  
    22import shelve, string, collections 
    33from utils_wb import workbook, uniCleanFunc 
    4 import cmip5so 
    54from sets import Set 
    65 
     
    130129  ee_byvar[ ee_mip[k][15] ].append( k ) 
    131130 
     131doCmipVar = False 
     132if doCmipVar: 
     133 import cmip5so 
    132134## check cmip5 vs. standard output 
    133 s1 = Set() 
    134 cmip5ByVar = collections.defaultdict( list ) 
    135 for k in ee_miptables_vars_old.keys(): 
     135 s1 = Set() 
     136 cmip5ByVar = collections.defaultdict( list ) 
     137 for k in ee_miptables_vars_old.keys(): 
    136138  if k[:6] == 'CMIP5_': 
    137139    s2 = Set( ee_miptables_vars_old[k] ) 
     
    153155      print 'ERROR.010.0002: SO Variables not found in %s:: %s' % (kk,str(lnf)) 
    154156 
    155 for s in cmip5so.so.keys(): 
     157 for s in cmip5so.so.keys(): 
    156158  if not s in s1: 
    157159    print 'ERROR.010.0003: Table %s not in old mip tables' % s 
  • CMIP6dreqbuild/trunk/srcMisc/dreq_consol_expt.py

    r876 r926  
    8686    self.currentSo.write(i,j,value,cell_style) 
    8787 
    88   def write(self,file='output.xls'): 
     88  def write(self,file='CMIP6DataRequest_ConsolidatedExperiments.xls'): 
    8989    self.wb.save( file ) 
    9090 
     
    318318 
    319319mipTrans ={  } 
    320 diagMips = ['DynVar','SIMIP','CORDEX','AgMIP'] 
     320diagMips = ['DynVar','SIMIP','CORDEX','AgMIP', 'VIACSAB', 'CMIP','SolarMIP'] 
    321321k2 = cfg.ee.keys() 
    322322k2.sort() 
  • CMIP6dreqbuild/trunk/srcMisc/dreq_utils.py

    r876 r926  
    8282class prconsolexpt(object): 
    8383  def __init__(self): 
    84     import expts 
    8584    self.records = [] 
    8685    self.edict = {} 
    8786    self.info =['label','group','mip','description','modelClass','tier','nstart','starty','endy','yps','ensz','ntot','comment']  
    88     self.refexpt = expts.kt.expts 
    8987 
    9088  def parse(self,sh, extra=None): 
     
    9391        n = string.strip( str(r[0]) ) 
    9492        n2 = string.strip( str(r[4]) ) 
    95         if n2 in self.refexpt or n in ['0','0.0',0,0.0]: 
     93        if (extra != None and n2 in extra) or n in ['0','0.0',0,0.0]: 
    9694          print 'prconsolexpt: replace %s --> %s' % (n,n2) 
    9795          n = n2 
     96        elif extra != None and n not in extra: 
     97          print 'WARN.expt.00010: unrecognised expt name: %s (%s) ' % (n,n2) 
     98 
    9899        g = string.strip( r[1] ) 
    99100        mip = string.strip( r[3] ) 
     
    148149        ##ensz = int( r[12] ) 
    149150        ##ntot = int( r[13] ) 
     151 
     152 
    150153        self.edict[n] = (n,g,mip,desc,mcfg,tier,nstart,starty,endy,yps,ensz,ntot,comment) 
    151154        self.records.append( [n,g,mip,desc,mcfg,tier,nstart,starty,endy,yps,ensz,ntot,comment] ) 
  • CMIP6dreqbuild/trunk/srcMisc/sx202.py

    r876 r926  
    2828uidgen = collections.defaultdict( uid1 ) 
    2929 
    30 sh1 = shelve.open( '%s/cmip5Groups' % odir, 'n' ) 
     30if sx.doCmipVar: 
     31  sh1 = shelve.open( '%s/cmip5Groups' % odir, 'n' ) 
    3132## 
    3233## list of CMIP5 tables which have groups 
    3334## 
    34 cmip5GroupsIx = set() 
     35  cmip5GroupsIx = set() 
    3536## 
    3637## dictionary, specifying group for each variable in table 
    3738## 
    38 cmip5GroupsIVAR = collections.defaultdict( dict ) 
    39 for k in sx.cmip5so.sop.keys(): 
    40   sh1[k] = sx.cmip5so.sop[k][:] 
    41   cmip5GroupsIx.add( string.split( k, '_' )[0] ) 
    42   for v in sx.cmip5so.sop[k]: 
    43     cmip5GroupsIVAR[ string.split( k, '_' )[0] ][v] = k 
    44   if sx.cmip5so.omipInsert and k in sx.cmip5so.sxp: 
    45     for v in sx.cmip5so.sxp[k]: 
     39  cmip5GroupsIVAR = collections.defaultdict( dict ) 
     40  for k in sx.cmip5so.sop.keys(): 
     41    sh1[k] = sx.cmip5so.sop[k][:] 
     42    cmip5GroupsIx.add( string.split( k, '_' )[0] ) 
     43    for v in sx.cmip5so.sop[k]: 
    4644      cmip5GroupsIVAR[ string.split( k, '_' )[0] ][v] = k 
    47 sh1.close() 
     45    if sx.cmip5so.omipInsert and k in sx.cmip5so.sxp: 
     46      for v in sx.cmip5so.sxp[k]: 
     47        cmip5GroupsIVAR[ string.split( k, '_' )[0] ][v] = k 
     48  sh1.close() 
    4849#### 'uuid', 'mip', 'label','title','ref','refNote' 
    4950####  i, "CMIP6",  key, ...., "CMIP5", '' 
     
    403404print 'INFO 001 ##################',nnf, nnm 
    404405 
     406if sx.doCmipVar: 
    405407##sh = shelve.open( 'shelve_vars' ) 
    406 sh = shelve.open( '%s/cmipVars' % odir, 'n' ) 
    407 sh['__info__'] = { 'label':'cmipVars', 'title':'CMIP variables', 'prov':'sx.eenv and sx.eeold' } 
    408 sh['__cols__'] = ['label','title','sn','units','description','procnote','procComment','prov','priority0','realm0'] 
    409  
    410 ee = {} 
    411 for k in sx.eenv.keys(): 
    412   this = nt_vrecix._make( map( lambda x: sx.eenv[k][x], vrecix_new ) ) 
    413   ##sh[k] = { 'label':this.v, 'title':this.l, 'sn':this.s, 'units':this.u, 'description':this.c, 'procnote':'', 'procComment':'','prov':'CMIP6 endorsement' } 
    414   prov = 'CMIP6 endorsement [%s]' % sx.eenv[k][1] 
    415   sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',prov, sx.eenv[k][0], sx.eenv[k][8] ] 
    416   ee[this.u] = k 
    417   if this.u == 'atmos': 
    418      print 'ERROR: bad units',k, sx.eenv[k] 
    419 print '################################### var units #################' 
    420 print ee.keys() 
    421 print '##########################################################' 
    422  
    423 nk = 0 
    424 for k in ll_ov: 
    425   this = nt_vrecix._make( map( lambda x: sx.eeold[k][x], vrecix_old ) ) 
     408  sh = shelve.open( '%s/cmipVars' % odir, 'n' ) 
     409  sh['__info__'] = { 'label':'cmipVars', 'title':'CMIP variables', 'prov':'sx.eenv and sx.eeold' } 
     410  sh['__cols__'] = ['label','title','sn','units','description','procnote','procComment','prov','priority0','realm0'] 
     411 
     412  ee = {} 
     413  for k in sx.eenv.keys(): 
     414    this = nt_vrecix._make( map( lambda x: sx.eenv[k][x], vrecix_new ) ) 
     415    ##sh[k] = { 'label':this.v, 'title':this.l, 'sn':this.s, 'units':this.u, 'description':this.c, 'procnote':'', 'procComment':'','prov':'CMIP6 endorsement' } 
     416    prov = 'CMIP6 endorsement [%s]' % sx.eenv[k][1] 
     417    sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',prov, sx.eenv[k][0], sx.eenv[k][8] ] 
     418    ee[this.u] = k 
     419    if this.u == 'atmos': 
     420       print 'ERROR: bad units',k, sx.eenv[k] 
     421  print '################################### var units #################' 
     422  print ee.keys() 
     423  print '##########################################################' 
     424 
     425  nk = 0 
     426  for k in ll_ov: 
     427    this = nt_vrecix._make( map( lambda x: sx.eeold[k][x], vrecix_old ) ) 
    426428  ##sh[k] = { 'label':this.v, 'title':this.l, 'sn':this.s, 'units':this.u, 'description':this.c, 'procnote':'', 'procComment':'','prov':sx.eeold[k][6]} 
    427   if this.v in sx.cmip5ByVar.keys(): 
    428     s = set() 
    429     for t in sx.cmip5ByVar[this.v]: 
    430       s.add( sx.cmip5so.so[t].a[this.v][18] ) 
    431  
    432     s = list(s) 
    433     rlm0 = string.join( s ) 
    434   elif this.v in sx.eenvo: 
    435     rlm0 = sx.eenvo[this.v][0][8] 
    436     print 'INFO.llll: using eenvo .....',this.v 
    437   else: 
    438     rlm0 = '__na__' 
     429    if this.v in sx.cmip5ByVar.keys(): 
     430      s = set() 
     431      for t in sx.cmip5ByVar[this.v]: 
     432        s.add( sx.cmip5so.so[t].a[this.v][18] ) 
     433 
     434      s = list(s) 
     435      rlm0 = string.join( s ) 
     436    elif this.v in sx.eenvo: 
     437      rlm0 = sx.eenvo[this.v][0][8] 
     438      print 'INFO.llll: using eenvo .....',this.v 
     439    else: 
     440      rlm0 = '__na__' 
    439441       
    440   sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',sx.eeold[k][6], 101, rlm0 ] 
    441   nk += 1 
    442  
    443 print len( sx.eenv.keys() ) + len(ll_ov), len( sh.keys() ),  len( sx.eenv.keys() ) 
    444 sh.close() 
     442    sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',sx.eeold[k][6], 101, rlm0 ] 
     443    nk += 1 
     444 
     445  print len( sx.eenv.keys() ) + len(ll_ov), len( sh.keys() ),  len( sx.eenv.keys() ) 
     446  sh.close() 
    445447   
    446448### 
     
    842844 
    843845dorest = True 
     846doexpt = False 
    844847 
    845848class psort(object): 
     
    11781181 
    11791182 
     1183if doexpt: 
     1184 
    11801185 ##wb = utils_wb.workbook( 'CMIP6DataRequest_ConsolidatedExperiments_20151028.xls' ) 
    11811186 cvdir = '/data/work/tmp/git/CMIP6_CVs' 
    11821187 efn = 'CMIP6DataRequest_ConsolidatedExperiments_20160714.xls' 
    11831188 efn = 'CMIP6DataRequest_ConsolidatedExperiments_20161111.xls' 
     1189 efn = 'CMIP6DataRequest_ConsolidatedExperiments_20170117.xls' 
    11841190 wb = utils_wb.workbook( efn ) 
    11851191 sht = wb.book.sheet_by_name( 'Experiments' ) 
Note: See TracChangeset for help on using the changeset viewer.