Changeset 547


Ignore:
Timestamp:
09/01/16 07:55:30 (3 years ago)
Author:
mjuckes
Message:

updates to xlst etc

Location:
CMIP6dreqbuild/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreqbuild/trunk/docs/vocabFrameworkSchema.xsd

    r508 r547  
    3232  <xs:attribute name="superclass" type="xs:string"/> 
    3333  <xs:attribute name="usage" type="xs:string"/> 
     34  <xs:attribute name="required" type="xs:string"/> 
    3435</xs:complexType> 
    3536 
     
    4647  <xs:attribute name="labUnique" type="st__labUnique_enum"/> 
    4748  <xs:attribute name="itemLabelMode" type="st__itemLabelMode_enum"/> 
     49  <xs:attribute name="required" type="xs:string"/> 
    4850</xs:complexType> 
    4951 
  • CMIP6dreqbuild/trunk/docs/xlst_xdsSchemaGen.xml

    r526 r547  
    6262  </xs:simpleType><xsl:text>&#xa;</xsl:text> 
    6363 
     64<xs:simpleType name="st__integerList"> 
     65<xs:restriction base="aa:base__integerList"> 
     66     <xs:minLength value="0"/> 
     67</xs:restriction> 
     68</xs:simpleType> 
     69 
     70<xs:simpleType name="base__integerList"> 
     71    <xs:list itemType="xs:integer"/> 
     72</xs:simpleType><xsl:text>&#xa;</xsl:text> 
     73 
     74<xs:simpleType name="st__integerListMonInc"> 
     75  <xs:restriction base="aa:st__integerList" /> 
     76</xs:simpleType><xsl:text>&#xa;</xsl:text> 
    6477 
    6578<xs:simpleType name="st__floatList"> 
     
    7184<xs:simpleType name="base__floatList"> 
    7285    <xs:list itemType="xs:float"/> 
    73 </xs:simpleType> 
     86</xs:simpleType><xsl:text>&#xa;</xsl:text> 
    7487 
    7588  <xs:complexType name="ct__info" mixed="true"> 
  • CMIP6dreqbuild/trunk/srcMisc/dreqSX.py

    r508 r547  
    99shvg = shelve.open( 'dreq_consol_tables_shelve_v%s' % vdate, 'r' ) 
    1010shnv = shelve.open( 'dreq_consol_tables_nv_shelve_v%s' % vdate, 'r' ) 
     11shnvo = shelve.open( 'dreq_consol_tables_nvom_shelve_v%s' % vdate, 'r' ) 
    1112## from vlsc5b --- includes new names from OMIP 
    1213shold = shelve.open( 'dreq_consol_tables_old_shelve_v20150713', 'r' ) 
     
    4344ee0 = {} 
    4445eenv = {} 
     46eenvo = {} 
    4547## dictionary to carry short names of old variables. 
    4648eeold = {} 
     
    4951for k in shnv: 
    5052  eenv[k] = shnv[k] 
     53for k in shnvo: 
     54  eenvo[k] = shnvo[k] 
    5155ccl = collections.defaultdict( int ) 
    5256for k in shvg: 
     
    129133## check cmip5 vs. standard output 
    130134s1 = Set() 
     135cmip5ByVar = collections.defaultdict( list ) 
    131136for k in ee_miptables_vars_old.keys(): 
    132137  if k[:6] == 'CMIP5_': 
     
    152157  if not s in s1: 
    153158    print 'ERROR.010.0002: Table %s not in old mip tables' % s 
     159  for v in cmip5so.so[s].a.keys(): 
     160    cmip5ByVar[v].append(s) 
     161     
    154162 
    155163for s in shlist: 
  • CMIP6dreqbuild/trunk/srcMisc/dreq_consol_dreq.py

    r508 r547  
    361361    return k 
    362362 
    363   def addItem( self, mip, tab, nn, nexmax, nenmax, nymax, expt=None, rid=None ): 
     363  def addItem( self, mip, tab, nn, nexmax, nenmax, nymax, expt=None, rid=None, treset=None ): 
    364364    if not self.tabindx.has_key( tab ): 
    365365      self.tabindx[tab] = len(self.tablist) 
     
    368368    self.tablist[ix][mip] = nn 
    369369    self.mips[mip] += 1 
    370     self.records.append( (mip,tab,expt, rid,nn, nexmax, nenmax, nymax) ) 
     370    self.records.append( (mip,tab,expt, rid,nn, nexmax, nenmax, nymax,treset) ) 
    371371 
    372372  def show(self,oo): 
     
    514514                if ok: 
    515515                  nbl = True 
    516           for je in r4i.othix: 
    517                 ok = self.readDeckColPair( j, je, 100, expt=string.strip(r4[je+1]), rid=uid,mode=3 ) 
     516          for jei in range( len(r4i.othix) ): 
     517                je = r4i.othix[jei] 
     518                tr = r4i.treset[jei] 
     519                ok = self.readDeckColPair( j, je, 100, expt=string.strip(r4[je+1]), rid=uid,mode=3,treset=tr ) 
    518520                if ok: 
    519521                  nbl = True 
     
    524526    return True 
    525527 
    526   def readDeckColPair( self,j, ix, nydef, expt=None, rid=None, mode=2 ): 
     528  def readDeckColPair( self,j, ix, nydef, expt=None, rid=None, mode=2, treset=None ): 
    527529      assert mode in [2,3], 'Only modes 2,3 supported, not mode=%s' % mode 
    528530      this = map( lambda x: x.value, self.wk1.currentSi.row(j)[ix:ix+mode] ) 
     
    634636            tab = '%s!!%s' % (self.mip,tab) 
    635637 
    636         self.parent.addItem( self.mip, tab, ntot, nexmax, nenmax, nymax, expt=expt, rid=rid ) 
     638        self.parent.addItem( self.mip, tab, ntot, nexmax, nenmax, nymax, expt=expt, rid=rid, treset=treset ) 
    637639        return True 
    638640      except: 
     
    747749sh['__info__'] = { 'label':'requestItems', 'title':'Specification for a single experiment' , \ 
    748750     'comment':'Currently only has number of years -- need to include more details' } 
    749 sh['__cols__'] = [ 'mip', 'tab', 'expt','rlid','ny', 'nexmax', 'nenmax', 'nymax'] 
     751sh['__cols__'] = [ 'mip', 'tab', 'expt','rlid','ny', 'nexmax', 'nenmax', 'nymax','treset'] 
    750752##('AerChemMIP', u'Omon_3d', u'CMIP6 historical', 'ad74be9a-26ef-11e5-8d9b-ac72891c3257', 0.0) 
    751753for i in rqs.records: 
  • CMIP6dreqbuild/trunk/srcMisc/dreq_utils.py

    r508 r547  
    1818        comment = '' 
    1919        try: 
    20           tier = int( r[5] ) 
     20          if type(r[5]) == type(1.): 
     21            tier = int( r[5] ) 
     22          else: 
     23            tier = [int( x) for x in string.split( r[5] )] 
    2124        except: 
    2225          print 'ERROR.001.0001: tier not integer: %s, %s' % (mip,r[5]) 
     
    2932        for j in [6,11,12,13]: 
    3033          try: 
    31             ll.append( int( r[j] ) ) 
     34            if type(r[j]) == type(1.): 
     35              v = int( r[j] ) 
     36            else: 
     37              v = [int( x) for x in string.split( r[j] )] 
     38            ll.append( v ) 
    3239          except: 
    3340            k = {6:'nstart', 11:'years per sim', 12:'ensemble size', 13:'total number of years'}[j] 
     
    127134 
    128135  def __init__(self,dd=None): 
    129     self.nt = collections.namedtuple( 'r4info', ['ixcntl','ixh','ix0','ixm','ownix','ownhr','othix','othhr','mode'] ) 
     136    self.nt = collections.namedtuple( 'r4info', ['ixcntl','ixh','ix0','ixm','ownix','ownhr','othix','othhr','mode','treset'] ) 
    130137 
    131138    if dd != None: 
     
    188195    self.ownex = [] 
    189196    self.othex = [] 
     197    self.othetrst = [] 
    190198    for j in range(self.ix0,self.ixm,2): 
    191199      if string.strip(r4[j]) != '': 
     
    194202      if string.strip(r4[j+1]) != '': 
    195203        self.othex.append(j) 
     204        if r4[j+2] != '': 
     205          self.othetrst.append(int(r4[j+2])) 
     206        else: 
     207          self.othetrst.append('') 
    196208     
    197209    print mip, self.ixh, self.iccntl, self.ix0, self.ixm , self.ownex, self.othex 
     
    199211    othhr =  map(lambda x: r4[x+1], self.othex) 
    200212    print ownhr, othhr 
    201     self.r4info = self.nt( self.iccntl, self.ixh, self.ix0, self.ixm, self.ownex, ownhr, self.othex, othhr,mode ) 
     213    self.r4info = self.nt( self.iccntl, self.ixh, self.ix0, self.ixm, self.ownex, ownhr, self.othex, othhr,mode,self.othetrst ) 
    202214    ##( 'r4info', ['ixcntl','ixh','ix0','ixm','ownix','ownhr','othix','othhr','mode'] ) 
    203215 
     
    206218class parseShb(object): 
    207219  def __init__(self,vdate,sx,cmip5gplk): 
     220    """Parse **'dreq_consol_tables_reviewed_b_v%s' % vdate** from dreq_consol_tables.py""" 
    208221    shb = shelve.open( 'dreq_consol_tables_reviewed_b_v%s' % vdate, 'r' ) 
    209222    revTabIds = Set( shb.keys()[:] ) 
  • CMIP6dreqbuild/trunk/srcMisc/sx2.py

    r508 r547  
    393393sh = shelve.open( '%s/cmipVars' % odir, 'n' ) 
    394394sh['__info__'] = { 'label':'cmipVars', 'title':'CMIP variables', 'prov':'sx.eenv and sx.eeold' } 
    395 sh['__cols__'] = ['label','title','sn','units','description','procnote','procComment','prov','priority0'] 
     395sh['__cols__'] = ['label','title','sn','units','description','procnote','procComment','prov','priority0','realm0'] 
    396396 
    397397ee = {} 
     
    400400  ##sh[k] = { 'label':this.v, 'title':this.l, 'sn':this.s, 'units':this.u, 'description':this.c, 'procnote':'', 'procComment':'','prov':'CMIP6 endorsement' } 
    401401  prov = 'CMIP6 endorsement [%s]' % sx.eenv[k][1] 
    402   sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',prov, sx.eenv[k][0] ] 
     402  sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',prov, sx.eenv[k][0], sx.eenv[k][8] ] 
    403403  ee[this.u] = k 
    404404  if this.u == 'atmos': 
     
    412412  this = nt_vrecix._make( map( lambda x: sx.eeold[k][x], vrecix_old ) ) 
    413413  ##sh[k] = { 'label':this.v, 'title':this.l, 'sn':this.s, 'units':this.u, 'description':this.c, 'procnote':'', 'procComment':'','prov':sx.eeold[k][6]} 
    414   sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',sx.eeold[k][6], 101 ] 
     414  if this.v in sx.cmip5ByVar.keys(): 
     415    s = set() 
     416    for t in sx.cmip5ByVar[this.v]: 
     417      s.add( sx.cmip5so.so[t].a[this.v][18] ) 
     418    s = list(s) 
     419    rlm0 = string.join( s ) 
     420  elif this.v in sx.eenvo: 
     421    rlm0 = sx.eenvo[this.v][0][8] 
     422    print 'INFO.llll: using eenvo .....',this.v 
     423  else: 
     424    rlm0 = '__na__' 
     425       
     426  sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',sx.eeold[k][6], 101, rlm0 ] 
    415427  nk += 1 
    416428 
     
    12201232 
    12211233 
    1222  wb = utils_wb.workbook( 'CMIP6DataRequest_ConsolidatedExperiments_20151028.xls' ) 
     1234 ##wb = utils_wb.workbook( 'CMIP6DataRequest_ConsolidatedExperiments_20151028.xls' ) 
     1235 wb = utils_wb.workbook( 'CMIP6DataRequest_ConsolidatedExperiments_20160110.xls' ) 
    12231236 sht = wb.book.sheet_by_name( 'Experiments' ) 
    12241237 p = dreq_utils.prconsolexpt() 
     
    12451258     eegg[gp] = str( uuid.uuid1() ) 
    12461259   
    1247    eetm[gp].add( r[5] ) 
     1260   if type( r[5] ) == type( 1 ): 
     1261     eetm[gp].add( r[5] ) 
     1262   else: 
     1263     eetm[gp].add( r[5][-1] ) 
    12481264   eent[gp] += r[11] 
    12491265   label = labcoerce( r[0] ) 
Note: See TracChangeset for help on using the changeset viewer.