Changeset 554 for CMIP6dreqbuild
- Timestamp:
- 19/01/16 21:19:26 (6 years ago)
- Location:
- CMIP6dreqbuild/trunk/src/framework
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
CMIP6dreqbuild/trunk/src/framework/Makefile
r539 r554 74 74 75 75 localHtml: 76 cp -r tab2/* /var/www/f/data/tabs02/ 77 cp -r tabs03/* /var/www/f/tabs03/ 78 cp tab01_1_1.html tab01_3_3.html /var/www/f 76 79 cp data2.js /var/www/f/data/mipVarsData.js 77 80 cp websiteExtras/dreq.css /var/www/f/css … … 81 84 cp -r html/index.html /var/www/f/ 82 85 86 83 87 sHtml: 84 88 zip -r html.zip data2.js html -
CMIP6dreqbuild/trunk/src/framework/dreqPy/scope.py
r553 r554 327 327 if inx.uid[u]._h.label != 'remarks': 328 328 rql.add( u ) 329 else: 330 exi = self.dq.inx.uid[ex] 331 if exi._h.label == 'experiment': 332 exset = set( [ex,exi.egid,exi.mip] ) 329 333 330 334 ##### … … 442 446 if i.esid in exset and v in e[i.rlid]: 443 447 ix = inx.uid[i.esid] 444 if ix._h.label == 'experiment': 448 if exi._h.label == 'experiment': 449 if ex in self.rqiExp[i.uid][1]: 450 this = self.rqiExp[i.uid][1][ex] 451 cc2[i.esid].add( this[-1]*this[-2] ) 452 elif ix._h.label == 'experiment': 445 453 cc2[i.esid].add( self.rqiExp[i.uid][irqi] ) 446 454 else: 447 455 if 'experiment' in inx.iref_by_sect[i.esid].a: 448 456 for u in inx.iref_by_sect[i.esid].a['experiment']: 449 cc2[u].add( self.rqiExp[i.uid][irqi] ) 457 if u in self.rqiExp[i.uid][1]: 458 this = self.rqiExp[i.uid][1][u] 459 cc2[u].add( this[-1]*this[-2] ) 460 ###cc2[u].add( self.rqiExp[i.uid][irqi] ) 450 461 ##else: 451 462 ##print 'WARNING .... empty experiment set' … … 563 574 if i._h.label != 'experiment': 564 575 mlg.prnt ( 'ERROR: %s, %s, %s ' % ( u,i._h.label, i.label, i.title ) ) 565 dat = [ (i.ntot, i.yps, i.ensz, i.tier, i.nstart, filter1(i.yps,rqi.nymax), filter2(i.ensz,rqi.nenmax,i.tier,self.tierMax) ) for i in e] 566 nytot = sum( [x[-2]*x[-1] for x in dat ] ) 567 netot = sum( [x[-1] for x in dat ] ) 576 ##dat = [ (i.ntot, i.yps, i.ensz, i.tier, i.nstart, filter1(i.yps,rqi.nymax), filter2(i.ensz,rqi.nenmax,i.tier,self.tierMax) ) for i in e] 577 dat2 = {} 578 for i in e: 579 dat2[i.uid] = (i.ntot, i.yps, i.ensz, i.tier, i.nstart, filter1(i.yps,rqi.nymax), filter2(i.ensz,rqi.nenmax,i.tier,self.tierMax) ) 580 ### number of 581 nytot = sum( [dat2[x][-2]*dat2[x][-3] for x in dat2 ] ) 582 netot = sum( [dat2[x][-1] for x in dat2 ] ) 568 583 ##print 'debug1:: ',dat, nytot, netot 569 584 else: 570 dat = [ (0,0,0,0,0) ]585 dat2 = {} 571 586 nytot = 0 572 587 netot = 0 573 588 574 return (expts, dat , nytot, netot )589 return (expts, dat2, nytot, netot ) 575 590 576 591 def setTierMax( self, tierMax ): -
CMIP6dreqbuild/trunk/src/framework/makeTables.py
r553 r554 89 89 90 90 class makeTab(object): 91 def __init__(self, subset=None, dest='tables/test.xlsx' ):91 def __init__(self, subset=None, dest='tables/test.xlsx', skipped=set()): 92 92 if subset != None: 93 93 cmv = [x for x in dq.coll['CMORvar'].items if x.uid in subset] … … 163 163 164 164 if not ok: 165 print 'skipping %s %s' % (t,v.label) 165 if (t,v.label) not in skipped: 166 print 'makeTables: skipping %s %s' % (t,v.label) 167 skipped.add( (t,v.label) ) 166 168 else: 167 169 dims = [] -
CMIP6dreqbuild/trunk/src/framework/overviewTabs.py
r553 r554 20 20 elif x < 1.e15: 21 21 s = '%3iT' % int( x*1.e-12 ) 22 elif x < 1.e18: 23 s = '%3iP' % int( x*1.e-15 ) 22 24 else: 23 25 s = '{:,.2f}'.format( x*1.e-9 ) … … 57 59 ## sss=True not yet tested 58 60 ## 59 sss = False61 sss = True 60 62 if sss: 61 63 for i in xx: 62 self.doTable(m,l1,i.uid,self.cc) 64 self.doTable(m,l1,i.uid,self.cc,acc=False) 65 self.makeMMhtml(m,m2) 66 self.doTable(m,l1,m2,self.cc) 63 67 else: 64 68 self.doTable(m,l1,m2,self.cc) 65 69 66 self.writeMips() 67 68 def writeMips(self): 70 self.writeMips(sss) 71 72 def makeMMhtml(self,m,m2): 73 fss = '%s-%s_%s_%s.html' % (m,m2,self.tiermax, self.pmax) 74 oo = open( 'tabs03/%s' % fss, 'w' ) 75 ttl = 'Date requested by %s from %s experiments' % (m,m2) 76 jsh = '' 77 bdy = '<p>All variables in one <a href="../data/tabs02/%s-%s_%s_%s.xlsx">Excel file</a></p>\n' % (m,m2,self.tiermax, self.pmax) 78 79 bdy += '<table>\n' 80 for i in self.cc[m].ee[m2]: 81 x = self.cc[m].a[i.uid]*2. 82 s = vfmt( x ) 83 bdy += '<tr><td>%s</td><td><a href="../data/tabs02/%s-%s_%s_%s.xlsx">%s</a></td></tr>\n' % (i.label,m,i.uid,self.tiermax, self.pmax,s) 84 bdy += '</table>\n' 85 86 oo.write( self.dq.pageTmpl % (ttl, jsh, '../', '../index.html', bdy ) ) 87 oo.close() 88 89 90 91 def writeMips(self,sss=False): 69 92 70 93 oo = open( 'tab01_%s_%s.texfrag' % (self.tiermax,self.pmax), 'w' ) … … 102 125 oo1.write( '</body></html>' ) 103 126 104 105 127 if m2 in self.cc[m].dd or m2 == 'TOTAL': 106 128 if self.cc[m].a[m2] == 0: … … 117 139 fn = '%s-%s_%s_%s.xlsx' % (m,m2,self.tiermax, self.pmax) 118 140 kc = '_%s_%s' % (m,m2) 119 sm = string.join( ['%s: %s' % (k,vfmt(self.cc[kc].a[k] )) for k in sorted( self.cc[kc].a.keys() ) ], '; ' )141 sm = string.join( ['%s: %s' % (k,vfmt(self.cc[kc].a[k]*2.)) for k in sorted( self.cc[kc].a.keys() ) ], '; ' ) 120 142 if m2 == 'TOTAL': 121 143 llh.append( s1 ) 144 elif sss: 145 fss = '%s-%s_%s_%s.html' % (m,m2,self.tiermax, self.pmax) 146 llh.append( '<a title="Excel variable list: %s" href="tabs03/%s">%s</a>' % (sm,fss,s) ) 122 147 else: 123 148 llh.append( '<a title="Excel variable list: %s" href="data/tabs02/%s">%s</a>' % (sm,fn,s) ) … … 128 153 ll.append( '' ) 129 154 llh.append( '' ) 130 print ll131 155 oo.write( string.join(ll, ' & ' ) + '\\\\ \n\\hline\n' ) 132 156 mmh.append( '<tr>' + string.join(['<td>%s</td>' % x for x in llh] ) + '</tr>\n' ) … … 143 167 oo.close() 144 168 145 def doTable(self,m,l1,m2,collector): 169 def doTable(self,m,l1,m2,collector,acc=True): 170 """acc allows accumulation of values to be switched off when called in single expt mode""" 146 171 147 x = sc.volByExpt( l1, m2, expFullEx= True,pmax=self.pmax )172 x = sc.volByExpt( l1, m2, expFullEx=(m2 in self.mips), pmax=self.pmax ) 148 173 collector[m].a[m2] += x[0] 149 174 # 150 175 # create sum for each table 151 176 # 177 xs = 0 152 178 for k in x[2].keys(): 153 179 i = self.dq.inx.uid[k] 154 180 xxx = x[2][k] 181 xs += xxx 155 182 if xxx > 0: 156 183 collector['_%s_%s' % (m,m2)].a[i.mipTable] += xxx 184 assert x[0] == xs, 'ERROR.0088: consistency problem %s %s %s %s' % (m,m2,x[0],xs) 157 185 if m == 'FAFMIP' and m2 == 'DECK': 158 186 print 'FAFMIP [1]:: ',x[1].keys() 159 187 print 'FAFMIP [2]:: ',collector['_FAFMIP_DECK'].a.keys() 160 188 161 collector[m].a['TOTAL'] += x[0] 189 if acc: 190 collector[m].a['TOTAL'] += x[0] 162 191 dd = collections.defaultdict( list ) 163 192 lll = set() … … 171 200 collector[m].dd[m2] = dd 172 201 makeTables.makeTab( subset=lll, dest='tab2/%s-%s_%s_%s.xlsx' % (m,m2,self.tiermax,self.pmax) ) 173 174 202 175 203 if __name__ == "__main__": 176 204 sc = scope.dreqQuery() 177 #r = r1( sc, tiermax=1, pmax=1 )205 r = r1( sc, tiermax=1, pmax=1 ) 178 206 r = r1( sc, tiermax=3, pmax=3 )
Note: See TracChangeset
for help on using the changeset viewer.