Ignore:
Timestamp:
24/10/15 23:05:00 (7 years ago)
Author:
mjuckes
Message:

Preparing to split documents as a separate package

Location:
CMIP6dreqbuild/trunk/src/framework
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreqbuild/trunk/src/framework/Makefile

    r429 r442  
    6262        bash seddreq02.sh "\.\.\/out" "\.\.\/docs" dreqPy/__init__.py > /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy/__init__.py 
    6363        cp htmlTemplates.py dreqPy/scope.py dreqPy/example.py dreqPy/utilities.py /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy   
     64        cp dreqPy/dreqCmdl.py  dreqPy/simpleCheck.py /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy 
    6465        cp vocabDemo.py /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy     
    6566        cp out/annotated_20150731.xml /data/tmp/svn3/exarch/CMIP6dreq/trunk/docs/dreq.xml 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/__init__.py

    r433 r442  
    11 
    2 import os 
     2from packageConfig import * 
    33 
    4 HERE = os.path.dirname(os.path.abspath(__file__) ) 
    5  
    6 ##DOC_DEFAULT_DIR 
    7 DOC_DEFAULT_DIR = os.path.join(HERE, '../out') 
    8  
    9 DOC_DIR = os.environ.get('DRQ_CONFIG_DIR', DOC_DEFAULT_DIR) 
    10  
    11 __versionComment__ = "Support for command line interface added" 
    12 __version__ = "01.beta.09" 
    13 __title__ = "dreqPy" 
    14 __description__ = "CMIP6 Data Request Python API" 
    15 __uri__ = "http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreq/tags/{0}".format(__version__) 
    16 __author__ = "Martin Juckes" 
    17 __email__ = "martin.juckes@stfc.ac.uk" 
    18 __license__ = "BSD" 
    19 __copyright__ = "Copyright (c) 2015 Science & Technology Facilities Council (STFC)" 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/dreq.py

    r433 r442  
    5858           for a in self.__dict__.keys(): 
    5959             if a[0] != '_' or full: 
    60                if self._a[a].rClass == 'internalLink' and self._base._indexInitialised: 
     60               if self._a[a].useClass == 'internalLink' and self._base._indexInitialised: 
    6161                 if self.__dict__[a] in self._base._inx.uid: 
    6262                   targ = self._base._inx.uid[ self.__dict__[a] ] 
     
    8989           for a in self.__dict__.keys(): 
    9090             if a[0] != '_': 
    91                if self._a[a].rClass == 'internalLink' and self._base._indexInitialised: 
     91               if self._a[a].useClass == 'internalLink' and self._base._indexInitialised: 
    9292                 if self.__dict__[a] == '__unset__': 
    9393                   m = '<li>%s: %s [missing link]</li>' % ( a, self.__dict__[a] ) 
     
    222222    self.vsamp = thisdoc 
    223223    self.nts = collections.namedtuple( 'sectdef', ['tag','label','title','id','itemLabelMode','level'] ) 
    224     self.nti = collections.namedtuple( 'itemdef', ['tag','label','title','type','rClass','techNote'] ) 
     224    self.nti = collections.namedtuple( 'itemdef', ['tag','label','title','type','useClass','techNote'] ) 
    225225    self.ntt = collections.namedtuple( 'sectinit', ['header','attributes','defaults'] ) 
    226226    self.nt__default = collections.namedtuple( 'deflt', ['defaults','glob'] ) 
     
    325325The instanstiated object contains a single data record. The "_h" attribute links to information about the record and the section it belongs to.  
    326326 
    327 object._a: a python dictionary defining the attributes in each record. The keys in the dictionary correspond to the attribute names and the values are python "named tuples" (from the "collections" module). E.g. object._a['priority'].type contains the type of the 'priority' attribute. Type is expressed using XSD schema language, so "xs:integer" implies integer.  The "rClass" attribute carries information about usage. If object._a['xxx'].rClass = u'internalLink' then the record attribute provides a link to another element and object.xxx is the unique identifier of that element. 
     327object._a: a python dictionary defining the attributes in each record. The keys in the dictionary correspond to the attribute names and the values are python "named tuples" (from the "collections" module). E.g. object._a['priority'].type contains the type of the 'priority' attribute. Type is expressed using XSD schema language, so "xs:integer" implies integer.  The "useClass" attribute carries information about usage. If object._a['xxx'].useClass = u'internalLink' then the record attribute provides a link to another element and object.xxx is the unique identifier of that element. 
    328328 
    329329object._h: a python named tuple describing the section. E.g. object._h.title is the section title (E.g. "CMOR Variables") 
     
    361361      defs = {'type':"xs:string"} 
    362362      ll = [] 
    363       for k in ['label','title','type','class','techNote']: 
     363      for k in ['label','title','type','useClass','techNote']: 
    364364        if i.hasAttribute( k ): 
    365365          ll.append( i.getAttribute( k ) ) 
     
    408408    ## 
    409409      for ka in dreq[k].attDefn.keys(): 
    410         if dreq[k].attDefn[ka].rClass == 'internalLink': 
     410        if dreq[k].attDefn[ka].useClass == 'internalLink': 
    411411           irefdict[k].append( ka ) 
    412412 
  • CMIP6dreqbuild/trunk/src/framework/out/dreq2Defn.xml

    r424 r442  
    77  <rowAttribute label="label" title="Record Label"/> 
    88  <rowAttribute label="title" title="Record Title"/> 
    9   <rowAttribute label="sn" title="CF Standard Name" class="externalTextRef"/> 
     9  <rowAttribute label="sn" title="CF Standard Name" useClass="internalLink"/> 
    1010  <rowAttribute label="units" title="Units"/> 
    1111  <rowAttribute label="description"/> 
    1212  <rowAttribute label="title" title="Long name"/> 
    13   <rowAttribute label="procnote" title="Processing notes" class="list"/> 
    14   <rowAttribute label="procComment" title="Processing comments" class="freeText"/> 
    15   <rowAttribute label="prov" title="Provenance" class="freeText"/> 
    16   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
     13  <rowAttribute label="procnote" title="Processing notes" useClass="list"/> 
     14  <rowAttribute label="procComment" title="Processing comments" useClass="freeText"/> 
     15  <rowAttribute label="prov" title="Provenance" useClass="freeText"/> 
     16  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
    1717</table> 
    1818<table label="CMORvar" uid="SECTION:CMORvar" title="CMOR Variable" id="cmip.drv.002" itemLabelMode="def" level="1" maxOccurs="1" labUnique="No"> 
    1919  <rowAttribute label="label" title="Record Label"/> 
    2020  <rowAttribute label="title" title="Record Title"/> 
    21   <rowAttribute label="uid" class="recordId"/> 
     21  <rowAttribute label="uid" useClass="recordId"/> 
    2222  <rowAttribute label="title" title="Long name"/> 
    23   <rowAttribute label="stid" title="Link to a record specifying the structure of the variable (dimensions and associated variable attributes)." class="internalLink" techNote="structure"/> 
    24   <rowAttribute label="vid" title="Identifier for MIP Variable" class="internalLink" techNote="var"/> 
     23  <rowAttribute label="stid" title="Link to a record specifying the structure of the variable (dimensions and associated variable attributes)." useClass="internalLink" techNote="structure"/> 
     24  <rowAttribute label="vid" title="Identifier for MIP Variable" useClass="internalLink" techNote="var"/> 
    2525  <rowAttribute label="valid_min" title="Minimum expected value for this variable."/> 
    2626  <rowAttribute label="valid_max" title="Maximum expected value for this variable."/> 
     
    3030  <rowAttribute label="deflate_level" title="Deflate Level: NetCDF compression parameter"/> 
    3131  <rowAttribute label="shuffle" title="Shuffle: NetCDF compression parameter"/> 
     32  <rowAttribute label="defaultPriority" type="xs:integer" title="Indicative priority for this parameter, which is over-ruled by the requestVar priority setting, but provides a reference for organisation of the CMORvariables"/> 
    3233  <rowAttribute label="type"/> 
    33   <rowAttribute label="modeling_realm" class="drsVocab"/> 
    34   <rowAttribute label="positive" class="CMORdirective"/> 
    35   <rowAttribute label="mipTable" title="The MIP table: each table identifies a collection of variables" class="drsVocab"/> 
     34  <rowAttribute label="modeling_realm" useClass="drsVocab"/> 
     35  <rowAttribute label="positive" useClass="CMORdirective"/> 
     36  <rowAttribute label="mipTable" title="The MIP table: each table identifies a collection of variables" useClass="drsVocab"/> 
    3637  <rowAttribute label="prov"/> 
    3738  <rowAttribute label="provNote"/> 
    38   <rowAttribute label="frequency" title="Frequency of time steps to be archived." class="drsVocab"/> 
     39  <rowAttribute label="frequency" title="Frequency of time steps to be archived." useClass="drsVocab"/> 
    3940  <rowAttribute label="rowIndex" type="xs:integer" title="Row index of entry in source sheet"/> 
    4041  <rowAttribute label="description"/> 
     
    4344  <rowAttribute label="label" title="Record Label"/> 
    4445  <rowAttribute label="title" title="Record Title"/> 
    45   <rowAttribute label="uid" class="recordId"/> 
    46   <rowAttribute label="spid" class="internalLink" techNote="spatialShape"/> 
    47   <rowAttribute label="tmid" class="internalLink" techNote="temporalShape"/> 
     46  <rowAttribute label="uid" useClass="recordId"/> 
     47  <rowAttribute label="spid" useClass="internalLink" techNote="spatialShape"/> 
     48  <rowAttribute label="tmid" useClass="internalLink" techNote="temporalShape"/> 
    4849  <rowAttribute label="odims"/> 
    4950  <rowAttribute label="coords"/> 
     
    5960  <rowAttribute label="label" title="Record Label"/> 
    6061  <rowAttribute label="title" title="Record Title"/> 
    61   <rowAttribute label="uid" class="recordId"/> 
     62  <rowAttribute label="uid" useClass="recordId"/> 
    6263  <rowAttribute label="dimensions"/> 
    6364  <rowAttribute label="shape"/> 
     
    6869  <rowAttribute label="label" title="Record Label"/> 
    6970  <rowAttribute label="title" title="Record Title"/> 
    70   <rowAttribute label="uid" class="recordId"/> 
     71  <rowAttribute label="uid" useClass="recordId"/> 
    7172  <rowAttribute label="dimensions"/> 
    7273  <rowAttribute label="label"/> 
     
    7677  <rowAttribute label="label" title="Record Label"/> 
    7778  <rowAttribute label="title" title="Record Title"/> 
    78   <rowAttribute label="uid" class="recordId"/> 
     79  <rowAttribute label="uid" useClass="recordId"/> 
    7980  <rowAttribute label="priority" type="xs:integer"/> 
    80   <rowAttribute label="vid" title="Identifier for MIP Output Variable" class="internalLink" techNote="ovar"/> 
    81   <rowAttribute label="vgid" title="Identifier for Variable Group" class="internalLink" techNote="requestVarGroup"/> 
     81  <rowAttribute label="vid" title="Identifier for MIP Output Variable" useClass="internalLink" techNote="ovar"/> 
     82  <rowAttribute label="vgid" title="Identifier for Variable Group" useClass="internalLink" techNote="requestVarGroup"/> 
    8283  <rowAttribute label="mip"/> 
    8384  <rowAttribute label="table"/> 
     
    8687  <rowAttribute label="label" title="Record Label"/> 
    8788  <rowAttribute label="title" title="Record Title"/> 
    88   <rowAttribute label="uid" class="recordId"/> 
    89   <rowAttribute label="gpid" title="Identifier for CMOR Tables" class="internalLink" techNote="requestVarGroup"/> 
     89  <rowAttribute label="uid" useClass="recordId"/> 
     90  <rowAttribute label="gpid" title="Identifier for CMOR Tables" useClass="internalLink" techNote="requestVarGroup"/> 
    9091  <rowAttribute label="mip" title="Project"/> 
    9192  <rowAttribute label="ref"/> 
     
    9596  <rowAttribute label="label" title="Record Label"/> 
    9697  <rowAttribute label="title" title="Record Title"/> 
    97   <rowAttribute label="uid" class="recordId"/> 
     98  <rowAttribute label="uid" useClass="recordId"/> 
    9899  <rowAttribute label="mip" title="Endorsed MIP requesting the data"/> 
    99100  <rowAttribute label="ref"/> 
     
    103104  <rowAttribute label="label" title="Record Label"/> 
    104105  <rowAttribute label="title" title="Record Title"/> 
    105   <rowAttribute label="uid" class="recordId"/> 
     106  <rowAttribute label="uid" useClass="recordId"/> 
    106107  <rowAttribute label="mip"/> 
    107108  <rowAttribute label="tab"/> 
     
    112113  <rowAttribute label="ref"/> 
    113114  <rowAttribute label="refNote"/> 
    114   <rowAttribute label="refid" title="reference to a request Variable Group" class="internalLink"/> 
     115  <rowAttribute label="refid" title="reference to a request Variable Group" useClass="internalLink"/> 
    115116  <rowAttribute label="opt" title="option for selecting a subset of variables"/> 
    116117  <rowAttribute label="opar" title="parameter associated with *opt*"/> 
     
    120121  <rowAttribute label="label" title="Record Label"/> 
    121122  <rowAttribute label="title" title="Record Title"/> 
    122   <rowAttribute label="uid" class="recordId"/> 
     123  <rowAttribute label="uid" useClass="recordId"/> 
    123124  <rowAttribute label="mip"/> 
    124125  <rowAttribute label="tab"/> 
    125126  <rowAttribute label="expt"/> 
    126   <rowAttribute label="rlid" title="Identifier of corresponding requestLink" class="internalLink"/> 
    127   <rowAttribute label="esid" title="Identifier experiment(s): a link to an experiment, an experiment group or a MIP" class="internalLink"/> 
     127  <rowAttribute label="rlid" title="Identifier of corresponding requestLink" useClass="internalLink"/> 
     128  <rowAttribute label="esid" title="Identifier experiment(s): a link to an experiment, an experiment group or a MIP" useClass="internalLink"/> 
    128129  <rowAttribute label="esidComment"/> 
    129130  <rowAttribute label="ny" type="xs:integer"/> 
     
    135136  <rowAttribute label="label" title="Record Label"/> 
    136137  <rowAttribute label="title" title="Record Title"/> 
    137   <rowAttribute label="uid" class="recordId"/> 
    138   <rowAttribute label="tid" title="Target identifier: the record ID of the item this refers to." class="internalLink"/> 
     138  <rowAttribute label="uid" useClass="recordId"/> 
     139  <rowAttribute label="tid" title="Target identifier: the record ID of the item this refers to." useClass="internalLink"/> 
    139140  <rowAttribute label="tattr" title="Target attribute: an attribute of the target item, or 'ALL'"/> 
    140141  <rowAttribute label="description" title="Free text remarks -- unless there are specific restrictions associated with the class attribute of this remark"/> 
     
    147148  <rowAttribute label="label" title="Record Label"/> 
    148149  <rowAttribute label="title" title="Record Title"/> 
    149   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
    150   <rowAttribute label="description" title="Description" class="freeText"/> 
    151   <rowAttribute label="egid" title="Identifier for experiment group" class="internalLink"/> 
    152   <rowAttribute label="mip" title="MIP defining experiment" class="internalLink"/> 
     150  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
     151  <rowAttribute label="description" title="Description" useClass="freeText"/> 
     152  <rowAttribute label="egid" title="Identifier for experiment group" useClass="internalLink"/> 
     153  <rowAttribute label="mip" title="MIP defining experiment" useClass="internalLink"/> 
    153154  <rowAttribute label="mcfg" title="Model category"/> 
    154155  <rowAttribute label="tier" type="xs:integer" title="Tier of experiment"/> 
     
    164165  <rowAttribute label="label" title="Record Label"/> 
    165166  <rowAttribute label="title" title="Record Title"/> 
    166   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
     167  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
    167168  <rowAttribute label="tierMin" type="xs:integer" title="Minimum tier of experiments in group"/> 
    168169  <rowAttribute label="ntot" type="xs:integer" title="Total number of years"/> 
     
    171172  <rowAttribute label="label" title="Record Label"/> 
    172173  <rowAttribute label="title" title="Record Title"/> 
    173   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
    174   <rowAttribute label="description" title="Description" class="freeText"/> 
     174  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
     175  <rowAttribute label="description" title="Description" useClass="freeText"/> 
    175176  <rowAttribute label="title" title="Long name"/> 
    176177  <rowAttribute label="mip" title="Endorsed MIP"/> 
     
    179180  <rowAttribute label="label" title="Record Label"/> 
    180181  <rowAttribute label="title" title="Record Title"/> 
    181   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
    182   <rowAttribute label="oid" title="Identifier for a scientific objective" class="internalLink" techNote="objective"/> 
    183   <rowAttribute label="rid" title="Identifier for a request link" class="internalLink" techNote="requestLink"/> 
     182  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
     183  <rowAttribute label="oid" title="Identifier for a scientific objective" useClass="internalLink" techNote="objective"/> 
     184  <rowAttribute label="rid" title="Identifier for a request link" useClass="internalLink" techNote="requestLink"/> 
    184185</table> 
    185186<table label="varChoiceLinkR" uid="SECTION:varChoiceLinkR" title="Links a variable to a choice element" id="cmip.drv.016" itemLabelMode="def" level="0" maxOccurs="1" labUnique="Yes"> 
    186187  <rowAttribute label="label" title="Record Label"/> 
    187188  <rowAttribute label="title" title="Record Title"/> 
    188   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
    189   <rowAttribute label="vid" title="Variable" class="internalLink"/> 
    190   <rowAttribute label="cid" title="Choice" class="internalLink"/> 
     189  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
     190  <rowAttribute label="vid" title="Variable" useClass="internalLink"/> 
     191  <rowAttribute label="cid" title="Choice" useClass="internalLink"/> 
    191192  <rowAttribute label="rank" type="xs:integer" title="For ranked choices, the rank of this variable (higher rank makes lower ranks redundant)"/> 
    192193</table> 
     
    194195  <rowAttribute label="label" title="Record Label"/> 
    195196  <rowAttribute label="title" title="Record Title"/> 
    196   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
    197   <rowAttribute label="vid" title="Variable" class="internalLink"/> 
    198   <rowAttribute label="cfgid" title="Configuration Option" class="internalLink"/> 
     197  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
     198  <rowAttribute label="vid" title="Variable" useClass="internalLink"/> 
     199  <rowAttribute label="cfgid" title="Configuration Option" useClass="internalLink"/> 
    199200  <rowAttribute label="cfg" type="xs:boolean" title="Configuration Value"/> 
    200   <rowAttribute label="cid" title="Choice -- can provide a link to related variables" class="internalLink"/> 
     201  <rowAttribute label="cid" title="Choice -- can provide a link to related variables" useClass="internalLink"/> 
    201202</table> 
    202203<table label="varChoice" uid="SECTION:varChoice" title="Indicates variables for which a there is a range of potential CMOR Varibles" id="cmip.drv.018" itemLabelMode="def" level="0" maxOccurs="1" labUnique="Yes"> 
    203204  <rowAttribute label="label" title="Record Label"/> 
    204205  <rowAttribute label="title" title="Record Title"/> 
    205   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
     206  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
    206207  <rowAttribute label="class" title="Class of choice: heirarchy|cfg"/> 
    207208  <rowAttribute label="title"/> 
     
    213214  <rowAttribute label="label" title="Record Label"/> 
    214215  <rowAttribute label="title" title="Record Title"/> 
    215   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
     216  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
    216217  <rowAttribute label="title"/> 
    217218  <rowAttribute label="description"/> 
     
    222223  <rowAttribute label="label" title="Record Label"/> 
    223224  <rowAttribute label="title" title="Record Title"/> 
    224   <rowAttribute label="uid" title="Record identifier" class="recordId"/> 
     225  <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 
    225226  <rowAttribute label="title"/> 
    226227  <rowAttribute label="MIPs"/> 
     
    229230  <rowAttribute label="range" title="Range of valid values, e.g. xs:boolean"/> 
    230231</table> 
     232<table label="standardname" uid="SECTION:standardname" title="CF Standard Names" id="cmip.drv.021" itemLabelMode="an" level="0" maxOccurs="1" labUnique="Yes"> 
     233  <rowAttribute label="label" title="Record Label"/> 
     234  <rowAttribute label="title" title="Record Title"/> 
     235  <rowAttribute label="uid" title="CF Standard Name" useClass="recordId"/> 
     236  <rowAttribute label="description"/> 
     237  <rowAttribute label="title"/> 
     238  <rowAttribute label="label"/> 
     239  <rowAttribute label="units" title="Canonical Units"/> 
     240</table> 
    231241</defDoc> 
  • CMIP6dreqbuild/trunk/src/framework/ptxt.py

    r431 r442  
    7272ial_elTmpl = '  <rowAttribute label="%(label)s"%(wrappedType)s%(wrappedTitle)s%(wrappedClass)s%(wrappedTechn)s/>' 
    7373 
    74 expl_Tmpl = '''<%(label)s uid="%(uid)s" class="vocab" title="%(title)s" id="%(id)s"> 
     74expl_Tmpl = '''<%(label)s uid="%(uid)s" useClass="vocab" title="%(title)s" id="%(id)s"> 
    7575<!-- <info srcType="dummy" srcRef="ptxt.py">Dummy entries</info> --> 
    7676%(exampleItem)s 
     
    104104       for i in self.itematts: 
    105105         if i.clss != None: 
    106            wrappedClass = ' class="%s"' % i.clss 
     106           wrappedClass = ' useClass="%s"' % i.clss 
    107107         else: 
    108108           wrappedClass = '' 
  • CMIP6dreqbuild/trunk/src/framework/scanDreq.py

    r430 r442  
    253253   xr_var_ovar[vid].append( i.uid ) 
    254254   if not inx.var.uid.has_key(vid): 
    255      print 'missing key:',i.label, i.prov 
     255     print 'missing key:',i.label, i.prov, vid 
    256256     nerr += 1 
    257257   else: 
     
    519519        this.removeChild(d) 
    520520    for k in mrefs.keys(): 
     521      print '>>>>>>>>>>> ',k 
    521522      if len(  mrefs[k] ) == 1: 
    522523        tid = mrefs[k][0][2] 
Note: See TracChangeset for help on using the changeset viewer.