Changeset 712 for CMIP6dreqbuild


Ignore:
Timestamp:
09/08/16 17:00:21 (3 years ago)
Author:
mjuckes
Message:

charme enabled

Location:
CMIP6dreqbuild/trunk/src/framework/dreqPy
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/dreq.py

    r711 r712  
    2020  pythonPre27 = sys.version_info[1] < 7 
    2121 
     22charmeTempl = """<span title="Using the CHARMe annotation system">Comment on this page:<a href="%s/%s/%s.html" class="charme-metadata-document"></a></span> 
     23 
     24<span> 
     25<div id="charme-placeholder"></div> 
     26</span> 
     27<br/> 
     28<!-- the charme-placeholder-all-targets appears to be required, but can be hidden ... --> 
     29<span style="display: None;"> 
     30<div id="charme-placeholder-all-targets"></div> 
     31</span> 
     32""" 
     33 
    2234jsh='''<link type="text/css" href="/css/jquery-ui-1.8.16.custom.css" rel="Stylesheet" /> 
    2335 <script src="/js/2013/jquery.min.js" type="text/javascript"></script> 
     
    2739<link type="text/css" href="/css/dreq.css" rel="Stylesheet" /> 
    2840''' 
     41 
     42def dref(i,x): 
     43  return i._inx.uid[i.__dict__[x]] 
    2944 
    3045blockSchemaFile = '%s/%s' % (DOC_DIR, 'BlockSchema.csv' ) 
     
    135150       _htmlStyle = {} 
    136151       _linkAttrStyle = {} 
     152       __charmeEnable__ = {} 
    137153 
    138154       def __init__(self,idict=None,xmlMiniDom=None,id='defaultId',etree=False): 
     
    232248           sect = self._h.label 
    233249           msg.append( '<h1>%s: [%s] %s</h1>' % (self._h.title,self.label,self.title) ) 
     250           if sect in self.__charmeEnable__: 
     251             msg.append( charmeTempl % (self.__charmeEnable__[sect].site, 'u', self.uid) ) 
    234252           msg.append( '<a href="../index.html">Home</a> &rarr; <a href="../index/%s.html">%s section index</a><br/>\n' % (sect, self._h.title) ) 
    235253           msg.append( '<ul>' ) 
     
    303321           elif self._base._indexInitialised: 
    304322             msg += self.__irefHtml__(sect,ghis) 
     323           if sect in self.__charmeEnable__: 
     324             msg.append( '<script src="/js/dreq/charme/charme.js"></script>' ) 
    305325         else: 
    306326           msg.append( '<b>Item %s: uninitialised</b>' % self.sectionLabel ) 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/makeTables.py

    r711 r712  
    11 
    22import collections, string, os, sys 
     3 
     4nt__charmeEnable = collections.namedtuple( 'charme', ['id','site'] ) 
    35 
    46try: 
     
    770772  dq.itemStyles['requestVar'] = styls.rqvLink01 
    771773 
     774  dreq.dreqItemBase.__charmeEnable__['var'] = nt__charmeEnable( 'test','http://clipc-services.ceda.ac.uk/dreq' ) 
     775 
    772776  ht = htmlTrees(dq) 
    773777  dq.makeHtml( annotations={'var':ht.anno}, ttl0='Data Request [%s]' % dreq.version ) 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/misc_utils.py

    r711 r712  
    1 import collections, string 
     1import collections, string , os 
     2import logging 
     3import time 
     4 
     5class dreqLog(object): 
     6  def __init__(self, dir='.'): 
     7    self.tstring2 = '%4.4i%2.2i%2.2i' % time.gmtime()[0:3] 
     8    self.logdir = dir 
     9    if not os.path.isdir( dir ): 
     10      os.mkdir(dir ) 
     11      print ( 'dreqLog: making a new directory fr log files: %s' % dir ) 
     12 
     13  def getLog(self,name,dir=None): 
     14    if dir == None: 
     15      dir = self.logdir 
     16    testLogFile = '%s/dreq_%s_%s.txt' % (dir,name,self.tstring2) 
     17    log = logging.getLogger(testLogFile) 
     18    fHdlr = logging.FileHandler(testLogFile,mode='w') 
     19    fileFormatter = logging.Formatter('%(message)s') 
     20    fHdlr.setFormatter(fileFormatter) 
     21    log.addHandler(fHdlr) 
     22    log.setLevel(logging.INFO) 
     23    return log 
    224 
    325def rankCMORvars(dq): 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/scope.py

    r711 r712  
    185185      if i.odims != '': 
    186186        s = s*5 
    187       self.sz[i.uid] = self.szss[i.spid]*s 
    188       for k in szr: 
    189         self.szg[k][i.uid] = self.szgss[k][i.spid]*s 
     187      if i.spid in self.szss: 
     188        self.sz[i.uid] = self.szss[i.spid]*s 
     189        for k in szr: 
     190          self.szg[k][i.uid] = self.szgss[k][i.spid]*s 
     191      else: 
     192        print ('WARNING: spid has no size info: %s' % i.spid ) 
     193        self.sz[i.uid] = 0. 
     194        for k in szr: 
     195          self.szg[k][i.uid] = 0. 
    190196 
    191197  def getRequestLinkByMip( self, mipSel ): 
Note: See TracChangeset for help on using the changeset viewer.