Changeset 655
 Timestamp:
 12/05/16 13:23:47 (5 years ago)
 Location:
 CMIP6dreqbuild/trunk/src/framework/dreqPy
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

CMIP6dreqbuild/trunk/src/framework/dreqPy/makeTables.py
r650 r655 446 446 x = self.acc 447 447 else: 448 x = self.sc.volByExpt( l1, m2, expFullEx=(m2 in self.mips), pmax=pmax ) 448 x = self.sc.volByExpt( l1, m2, pmax=pmax ) 449 450 ##self.volByExpt( l1, e, pmax=pmax, cc=cc, retainRedundantRank=retainRedundantRank, intersection=intersection, adsCount=adsCount ) 451 v0 = self.sc.volByMip( m, pmax=pmax, exptid=m2 ) 452 #### 453 cc = collections.defaultdict( int ) 454 for e in self.sc.volByE: 455 for v in self.sc.volByE[e][2]: 456 cc[v] += self.sc.volByE[e][2][v] 457 xxx = 0 458 for v in cc: 459 xxx += cc[v] 460 print m,m2,'%12.5e' % x[0],'%12.5e' % xxx, '%12.5e' % v0 461 #### 449 462 if acc: 450 self.accAdd(x) 451 452 if x[0] > 0: 453 if m2 not in [ None, 'TOTAL']: 463 for e in self.sc.volByE: 464 self.accAdd(self.sc.volByE[e]) 465 if m2 not in [ None, 'TOTAL']: 454 466 im2 = self.dq.inx.uid[m2] 455 467 mlab2 = im2.label 468 else: 469 mlab2 = 'TOTAL' 470 471 for e in self.sc.volByE: 472 x = self.sc.volByE[e] 473 if x[0] > 0: 456 474 collector[mlab].a[mlab2] += x[0] 457 else: 458 mlab2 = 'TOTAL'475 476 if collector[mlab].a[mlab2] > 0: 459 477 # 460 478 # create sum for each table 461 479 # 480 x0 = collector[mlab].a[mlab2] 462 481 xs = 0 463 482 kkc = '_%s_%s' % (mlab,mlab2) 464 for k in x[2].keys(): 465 i = self.dq.inx.uid[k] 466 xxx = x[2][k] 467 xs += xxx 468 if xxx > 0: 483 if m2 in [None, 'TOTAL']: 484 x = self.acc 485 for k in x[2].keys(): 486 i = self.dq.inx.uid[k] 487 xxx = x[2][k] 488 xs += xxx 489 if xxx > 0: 469 490 collector[kkc].a[i.mipTable] += xxx 470 assert x[0] == xs, 'ERROR.0088: consistency problem %s %s %s %s' % (m,m2,x[0],xs) 471 if x[0] == 0: 491 for e in self.sc.volByE: 492 x = self.sc.volByE[e] 493 for k in x[2].keys(): 494 i = self.dq.inx.uid[k] 495 xxx = x[2][k] 496 xs += xxx 497 if xxx > 0: 498 collector[kkc].a[i.mipTable] += xxx 499 ##if m2 != None: 500 assert x0 == xs, 'ERROR.0088: consistency problem %s %s %s %s' % (m,m2,x0,xs) 501 if x0 == 0: 472 502 print ( 'Zero size: %s, %s' % (m,m2) ) 473 503 if len( x[2].keys() ) > 0: … … 475 505 476 506 if acc and m2 not in [ None, 'TOTAL']: 477 collector[mlab].a['TOTAL'] += x [0]507 collector[mlab].a['TOTAL'] += x0 478 508 479 509 dd = collections.defaultdict( list ) 
CMIP6dreqbuild/trunk/src/framework/dreqPy/scope.py
r643 r655 349 349 for i in l1: 350 350 imips.add(i.mip) 351 ##imips = {i.mip for i in l1}352 351 353 352 rql, l1p, exset = self.rqlByExpt( l1, ex, pmax=pmax, expFullEx=expFullEx ) … … 367 366 if exi._h.label == 'experiment': 368 367 exset = set( [ex,exi.egid,exi.mip] ) 369 370 368 ##### 371 369 if len( rql ) == 0: … … 411 409 ## 412 410 nymg = collections.defaultdict( dict ) 413 414 411 ## 415 412 ## if dataset count rather than volume is wanted, use item 3 from rqiExp tuple. … … 633 630 def rqiByMip( self, mip): 634 631 632 if mip == 'TOTAL': 633 mip = self.mips 635 634 if type(mip) in [type( '' ),type( u'') ]: 636 635 if mip not in self.mips: … … 641 640 nf = [ m for m in mip if m not in self.mips] 642 641 if len(nf) > 0: 643 raise baseException( 'rqiByMip: Name of mip(s) not recognised: %s' % str(nf) )642 raise baseException( 'rqiByMip: Name of mip(s) not recognised: %s' % str(nf) ) 644 643 l1 = [i for i in self.dq.coll['requestItem'].items if i.mip in mip] 645 644 elif type(mip) == type( dict()): … … 718 717 for e in exps: 719 718 expts = self.esid_to_exptList(e,deref=True,full=False) 719 print 'EXPTS: ',e,len(expts) 720 720 if expts not in [None,[]]: 721 self.volByE[e] = self.volByExpt( l1, e, pmax=pmax, cc=cc, retainRedundantRank=retainRedundantRank, intersection=intersection, adsCount=adsCount ) 722 vtot += self.volByE[e][0] 721 for ei in expts: 722 self.volByE[ei.label] = self.volByExpt( l1, ei.uid, pmax=pmax, cc=cc, retainRedundantRank=retainRedundantRank, intersection=intersection, adsCount=adsCount ) 723 vtot += self.volByE[ei.label][0] 723 724 self.allVars = self.allVars.union( self.vars ) 724 725 ##else: … … 900 901 mips = self.adict['m'] 901 902 odir = self.adict.get( 'xlsdir', 'xls' ) 902 ##print 'odir:::::::::: ',odir903 ##m = list( mips )[0]904 903 self.sc.checkDir( odir, 'xls files' ) 905 904
Note: See TracChangeset
for help on using the changeset viewer.