Changeset 488 for CMIP6dreq/trunk


Ignore:
Timestamp:
19/11/15 09:38:59 (5 years ago)
Author:
mjuckes
Message:

some prep for 2.6

File:
1 edited

Legend:

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

    r487 r488  
    136136    elif type(mipSel) == type(set()): 
    137137      t1 = lambda x: x in mipSel 
    138     self.rqs = list({self.dq.inx.uid[i.rid] for i in self.dq.coll['objectiveLink'].items if t1(i.label) }) 
     138 
     139    s = set() 
     140    for i in self.dq.coll['objectiveLink'].items: 
     141      if t1(i.label): 
     142        s.add( self.dq.inx.uid[i.rid] ) 
     143    ##self.rqs = list({self.dq.inx.uid[i.rid] for i in self.dq.coll['objectiveLink'].items if t1(i.label) }) 
     144    self.rqs = list( s ) 
    139145    return self.rqs 
    140146 
     
    144150      t1 = lambda x: x == self.rlu[objSel] 
    145151    elif type(objSel) == type(set()): 
    146       t1 = lambda x: x in {self.rlu[i] for i in objSel} 
     152      t1 = lambda x: x in [self.rlu[i] for i in objSel] 
    147153 
    148154    s = set() 
    149155    for i in self.dq.coll['objectiveLink'].items: 
    150156      if t1(i.label): 
    151         s.add( self.dq.inx.uid[i.rid] ) 
    152 ## 
    153 ## not sure about the oid/label difference below ... which option works ... and why? 
    154 ## 
    155     ##self.rqs = list({self.dq.inx.uid[i.rid] for i in self.dq.coll['objectiveLink'].items if t1(i.label) }) 
     157        s.add( self.dq.inx.uid[i.oid] ) 
     158## 
    156159    self.rqs = list( s ) 
    157160    ##self.rqs = list({self.dq.inx.uid[i.rid] for i in self.dq.coll['objectiveLink'].items if t1(i.oid) }) 
     
    161164    """For a list of request links, return a list of variable group IDs for each experiment""" 
    162165    self.cc = collections.defaultdict( list ) 
    163     dummy = {self.cc[i.expt].append(i.rlid) for i in self.dq.coll['requestItem'].items if i.rlid in {j.uid for j in rqList} } 
     166    ## dummy = {self.cc[i.expt].append(i.rlid) for i in self.dq.coll['requestItem'].items if i.rlid in {j.uid for j in rqList} } 
    164167    return self.cc 
    165168 
     
    175178## 
    176179    inx = self.dq.inx 
    177     imips = {i.mip for i in l1} 
     180    imips = set() 
     181    for i in l1: 
     182      imips.add(i.mip) 
     183    ##imips = {i.mip for i in l1} 
    178184## 
    179185## rql is the set of all request links which are associated with a request item for this experiment set 
    180186## 
    181     l1p = {i for i in l1 if (i.esid == ex) and (i.preset < 0 or i.preset <= pmax) } 
    182  
    183     rql0 = {i.rlid for i in l1p} 
    184  
    185     rqlInv = {u for u in rql0 if inx.uid[u]._h.label == 'remarks' } 
     187    l1p = set() 
     188    for i in l1: 
     189      if (i.esid == ex) and (i.preset < 0 or i.preset <= pmax): 
     190        l1p.add(i) 
     191 
     192    rql0 = set() 
     193    for i in l1p: 
     194       rql0.add(i.rlid) 
     195 
     196    rqlInv = set() 
     197    for u in rql0: 
     198      if inx.uid[u]._h.label == 'remarks': 
     199        rqlInv.add( u ) 
    186200    if len(rqlInv) != 0: 
    187201      print ( 'WARNING.001.00002: %s invalid request links from request items ...' % len(rqlInv) ) 
Note: See TracChangeset for help on using the changeset viewer.