Ignore:
Timestamp:
10/09/15 11:10:54 (5 years ago)
Author:
mjuckes
Message:

misc

File:
1 edited

Legend:

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

    r376 r382  
    55from sets import Set 
    66 
    7 vdate = "20150827" 
     7vdate = "20150907" 
    88 
    9 sh = shelve.open( 'dreq_consol_tables_shelve_v%s' % vdate, 'r' ) 
     9shvg = shelve.open( 'dreq_consol_tables_shelve_v%s' % vdate, 'r' ) 
    1010shnv = shelve.open( 'dreq_consol_tables_nv_shelve_v%s' % vdate, 'r' ) 
    1111## from vlsc5b --- includes new names from OMIP 
    1212shold = shelve.open( 'dreq_consol_tables_old_shelve_v20150713', 'r' ) 
    13 shlist = [sh,shnv,shold] 
     13shlist = [shvg,shnv,shold] 
    1414 
    1515##MIP columns: recordid, ['comment', 'deflate_level', 'shuffle', 'ok_max_mean_abs', 'flag_meanings', 'type', 'ok_min_mean_abs', 'standard_name', 'deflate', 'long_name', 'valid_min', 'cell_methods', 'flag_values', 'cell_measures', 'out_name', 'modeling_realm', 'units', '#cell_methods', 'valid_max', 'positive'] , var, mip table, dims 
     
    4545## dictionary to carry short names of old variables. 
    4646eeold = {} 
    47 ###for ee,shv in [(ee0,sh),(eenv,shnv),(eeold,shold)]: 
    48 for ee,shv in [(ee0,sh),(eenv,shnv)]: 
     47###for ee,shv in [(ee0,shvg),(eenv,shnv),(eeold,shold)]: 
     48for ee,shv in [(ee0,shvg),(eenv,shnv)]: 
    4949  for k in shv.keys(): 
    5050    ee[k] = shv[k] 
     
    5353eeoldl = collections.defaultdict( list ) 
    5454if rmod == 'xls': 
    55   for ee,fn in [(ee_xref,'vlsc5_xref_v20150826.xls'),(ee_mip,'vlsc5_mip_v20150826.xls'),(eeold,'vlsc5b_v20150826.xls')]: 
     55  for ee,fn in [(ee_xref,'vlsc5_xref_v%s.xls' % vdate),(ee_mip,'vlsc5_mip_v%s.xls' % vdate),(eeold,'vlsc5b_v%s.xls' % vdate)]: 
    5656    wb = workbook( fn ) 
    5757    sh = wb.book.sheet_by_name( 'Sheet1' ) 
     
    6060      ee[r[0]] = r 
    6161else: 
    62   for ee,fn,sep,xxx in [(ee_xref,'vlsc5_xref_v20150826.csv',',',False),(ee_mip,'vlsc5_mip_v20150826.csv', '\t',False),(eeoldl,'vlsc5b_v20150826.csv', '\t',True)]: 
     62  for ee,fn,sep,xxx,nrmin in [(ee_xref,'vlsc5_xref_v%s.csv' % vdate,',',False,5),(ee_mip,'vlsc5_mip_v%s.csv' % vdate, '\t',False,24),(eeoldl,'vlsc5b_v%s.csv' % vdate, '\t',True,9)]: 
    6363    for i in open(fn).readlines(): 
    6464      r = map( lambda x: string.strip(str(uniCleanFunc(x))), string.split( string.strip(i), sep ) ) 
    65       while len(r) < 9: 
     65      while len(r) < nrmin: 
    6666        r.append( '' ) 
    6767      if xxx: 
     
    7070        ee[r[0]] = r 
    7171 
     72for k in ee_mip.keys(): 
     73 if len( ee_mip[k][:] ) != 24: 
     74   print 'ERROR.015.0003: Bad record length %s: %s' % (k,ee_mip[k]) 
    7275 
    7376for h in eeoldl.keys(): 
Note: See TracChangeset for help on using the changeset viewer.