Changeset 487 for CMIP6dreq/trunk


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

dict issue again

File:
1 edited

Legend:

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

    r460 r487  
    7474    self.cmvFilter = cmvFilter( self ) 
    7575    self.tierMax = tierMax 
    76     self.mips = { i.mip for i in  self.dq.coll['requestItem'].items} 
     76 
     77    self.mips = set() 
     78    for i in  self.dq.coll['requestItem'].items: 
     79       self.mips.add(i.mip) 
    7780    self.mipls = sorted( list( self.mips ) ) 
    7881 
    7982    self.default_mcfg = nt_mcfg._make( [259200,60,64800,40,20,5,100] ) 
    80     self.mcfg = {} 
    81     for k in self.default_mcfg.__dict__.keys(): 
    82       self.mcfg[k] = self.default_mcfg.__dict__[k] 
     83    self.mcfg = self.default_mcfg._asdict() 
     84    ##for k in self.default_mcfg.__dict__.keys(): 
     85      ##self.mcfg[k] = self.default_mcfg.__dict__[k] 
    8386    self.szcfg() 
    8487    self.requestItemExpAll(  ) 
     
    131134    if type(mipSel) == type(''): 
    132135      t1 = lambda x: x == mipSel 
    133     elif type(mipSel) == type({1,2}): 
     136    elif type(mipSel) == type(set()): 
    134137      t1 = lambda x: x in mipSel 
    135138    self.rqs = list({self.dq.inx.uid[i.rid] for i in self.dq.coll['objectiveLink'].items if t1(i.label) }) 
     
    140143    if type(objSel) == type(''): 
    141144      t1 = lambda x: x == self.rlu[objSel] 
    142     elif type(objSel) == type({1,2}): 
     145    elif type(objSel) == type(set()): 
    143146      t1 = lambda x: x in {self.rlu[i] for i in objSel} 
    144147 
    145     self.rqs = list({self.dq.inx.uid[i.rid] for i in self.dq.coll['objectiveLink'].items if t1(i.oid) }) 
     148    s = set() 
     149    for i in self.dq.coll['objectiveLink'].items: 
     150      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) }) 
     156    self.rqs = list( s ) 
     157    ##self.rqs = list({self.dq.inx.uid[i.rid] for i in self.dq.coll['objectiveLink'].items if t1(i.oid) }) 
    146158    return self.rqs 
    147159 
Note: See TracChangeset for help on using the changeset viewer.