Ignore:
Timestamp:
04/11/15 09:31:52 (5 years ago)
Author:
mjuckes
Message:

Updated request

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreq/trunk/dreqPy/scope.py

    r435 r460  
    167167## rql is the set of all request links which are associated with a request item for this experiment set 
    168168## 
    169     rql0 = {i.rlid for i in l1 if i.esid == ex} 
     169    l1p = {i for i in l1 if (i.esid == ex) and (i.preset < 0 or i.preset <= pmax) } 
     170 
     171    rql0 = {i.rlid for i in l1p} 
     172 
    170173    rqlInv = {u for u in rql0 if inx.uid[u]._h.label == 'remarks' } 
    171174    if len(rqlInv) != 0: 
    172175      print ( 'WARNING.001.00002: %s invalid request links from request items ...' % len(rqlInv) ) 
    173176    rql = {u for u in rql0 if inx.uid[u]._h.label != 'remarks' } 
     177    if len( rql ) == 0: 
     178      self.vars = set() 
     179      return (0,{},{} ) 
    174180 
    175181## The complete set of variables associated with these requests: 
     
    219225      len1 = len(vars) 
    220226      cmv = self.cmvFilter.filterByChoiceRank(cmv=vars) 
    221       ## print 'After filter: %s [%s]' % (len(cmv),len1) 
    222227 
    223228      vars = cmv 
     
    237242    nym = {} 
    238243    for v in vars: 
    239       ### for each request item, check if v is in the set of variables and then add the number of years. 
    240       nym[v] = max( {self.rqiExp[i.uid][2] for i in l1 if i.esid == ex and v in e[i.rlid]} ) 
     244      nym[v] = max( {self.rqiExp[i.uid][2] for i in l1p if i.esid == ex and v in e[i.rlid]} ) 
    241245 
    242246    szv = {} 
     
    265269        expts = [] 
    266270    else: 
    267       print ( 'WARNING: request link not associated with valid experiment group' ) 
    268       raise 
     271      ##print ( 'WARNING: request link not associated with valid experiment group' ) 
     272      ##raise 
     273      return None 
    269274 
    270275    if self.tierMax > 0: 
     
    284289    for rqi in self.dq.coll['requestItem'].items: 
    285290      a,b,c = self.requestItemExp( rqi ) 
    286       self.rqiExp[rqi.uid] = (a,b,c) 
     291      if a != None: 
     292        self.rqiExp[rqi.uid] = (a,b,c) 
    287293 
    288294  def requestItemExp( self, rqi ): 
     
    297303        expts = [] 
    298304    else: 
    299       print ( 'WARNING: request link not associated with valid experiment group'  ) 
    300       i.__info__() 
    301       raise 
     305      # print ( 'WARNING: request link not associated with valid experiment group'  ) 
     306      ##rqi.__info__() 
     307      ##raise 
     308      return (None, None, None) 
    302309 
    303310    if self.tierMax > 0: 
     
    350357    for e in exps: 
    351358      expts = self.esid_to_exptList(e,deref=True) 
    352       self.volByE[e] = self.volByExpt( l1, e, expts, pmax=pmax, cc=cc, retainRedundantRank=retainRedundantRank ) 
    353       vtot += self.volByE[e][0] 
    354       self.allVars = self.allVars.union( self.vars ) 
     359      if expts != None: 
     360        self.volByE[e] = self.volByExpt( l1, e, expts, pmax=pmax, cc=cc, retainRedundantRank=retainRedundantRank ) 
     361        vtot += self.volByE[e][0] 
     362        self.allVars = self.allVars.union( self.vars ) 
    355363    self.indexedVol = cc 
    356364 
Note: See TracChangeset for help on using the changeset viewer.