Changeset 442 for CMIP6dreqbuild/trunk/src
- Timestamp:
- 24/10/15 23:05:00 (7 years ago)
- Location:
- CMIP6dreqbuild/trunk/src/framework
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
CMIP6dreqbuild/trunk/src/framework/Makefile
r429 r442 62 62 bash seddreq02.sh "\.\.\/out" "\.\.\/docs" dreqPy/__init__.py > /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy/__init__.py 63 63 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 64 65 cp vocabDemo.py /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy 65 66 cp out/annotated_20150731.xml /data/tmp/svn3/exarch/CMIP6dreq/trunk/docs/dreq.xml -
CMIP6dreqbuild/trunk/src/framework/dreqPy/__init__.py
r433 r442 1 1 2 import os 2 from packageConfig import * 3 3 4 HERE = os.path.dirname(os.path.abspath(__file__) )5 6 ##DOC_DEFAULT_DIR7 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 58 58 for a in self.__dict__.keys(): 59 59 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: 61 61 if self.__dict__[a] in self._base._inx.uid: 62 62 targ = self._base._inx.uid[ self.__dict__[a] ] … … 89 89 for a in self.__dict__.keys(): 90 90 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: 92 92 if self.__dict__[a] == '__unset__': 93 93 m = '<li>%s: %s [missing link]</li>' % ( a, self.__dict__[a] ) … … 222 222 self.vsamp = thisdoc 223 223 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'] ) 225 225 self.ntt = collections.namedtuple( 'sectinit', ['header','attributes','defaults'] ) 226 226 self.nt__default = collections.namedtuple( 'deflt', ['defaults','glob'] ) … … 325 325 The instanstiated object contains a single data record. The "_h" attribute links to information about the record and the section it belongs to. 326 326 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.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 "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. 328 328 329 329 object._h: a python named tuple describing the section. E.g. object._h.title is the section title (E.g. "CMOR Variables") … … 361 361 defs = {'type':"xs:string"} 362 362 ll = [] 363 for k in ['label','title','type',' class','techNote']:363 for k in ['label','title','type','useClass','techNote']: 364 364 if i.hasAttribute( k ): 365 365 ll.append( i.getAttribute( k ) ) … … 408 408 ## 409 409 for ka in dreq[k].attDefn.keys(): 410 if dreq[k].attDefn[ka]. rClass == 'internalLink':410 if dreq[k].attDefn[ka].useClass == 'internalLink': 411 411 irefdict[k].append( ka ) 412 412 -
CMIP6dreqbuild/trunk/src/framework/out/dreq2Defn.xml
r424 r442 7 7 <rowAttribute label="label" title="Record Label"/> 8 8 <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"/> 10 10 <rowAttribute label="units" title="Units"/> 11 11 <rowAttribute label="description"/> 12 12 <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"/> 17 17 </table> 18 18 <table label="CMORvar" uid="SECTION:CMORvar" title="CMOR Variable" id="cmip.drv.002" itemLabelMode="def" level="1" maxOccurs="1" labUnique="No"> 19 19 <rowAttribute label="label" title="Record Label"/> 20 20 <rowAttribute label="title" title="Record Title"/> 21 <rowAttribute label="uid" class="recordId"/>21 <rowAttribute label="uid" useClass="recordId"/> 22 22 <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"/> 25 25 <rowAttribute label="valid_min" title="Minimum expected value for this variable."/> 26 26 <rowAttribute label="valid_max" title="Maximum expected value for this variable."/> … … 30 30 <rowAttribute label="deflate_level" title="Deflate Level: NetCDF compression parameter"/> 31 31 <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"/> 32 33 <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"/> 36 37 <rowAttribute label="prov"/> 37 38 <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"/> 39 40 <rowAttribute label="rowIndex" type="xs:integer" title="Row index of entry in source sheet"/> 40 41 <rowAttribute label="description"/> … … 43 44 <rowAttribute label="label" title="Record Label"/> 44 45 <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"/> 48 49 <rowAttribute label="odims"/> 49 50 <rowAttribute label="coords"/> … … 59 60 <rowAttribute label="label" title="Record Label"/> 60 61 <rowAttribute label="title" title="Record Title"/> 61 <rowAttribute label="uid" class="recordId"/>62 <rowAttribute label="uid" useClass="recordId"/> 62 63 <rowAttribute label="dimensions"/> 63 64 <rowAttribute label="shape"/> … … 68 69 <rowAttribute label="label" title="Record Label"/> 69 70 <rowAttribute label="title" title="Record Title"/> 70 <rowAttribute label="uid" class="recordId"/>71 <rowAttribute label="uid" useClass="recordId"/> 71 72 <rowAttribute label="dimensions"/> 72 73 <rowAttribute label="label"/> … … 76 77 <rowAttribute label="label" title="Record Label"/> 77 78 <rowAttribute label="title" title="Record Title"/> 78 <rowAttribute label="uid" class="recordId"/>79 <rowAttribute label="uid" useClass="recordId"/> 79 80 <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"/> 82 83 <rowAttribute label="mip"/> 83 84 <rowAttribute label="table"/> … … 86 87 <rowAttribute label="label" title="Record Label"/> 87 88 <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"/> 90 91 <rowAttribute label="mip" title="Project"/> 91 92 <rowAttribute label="ref"/> … … 95 96 <rowAttribute label="label" title="Record Label"/> 96 97 <rowAttribute label="title" title="Record Title"/> 97 <rowAttribute label="uid" class="recordId"/>98 <rowAttribute label="uid" useClass="recordId"/> 98 99 <rowAttribute label="mip" title="Endorsed MIP requesting the data"/> 99 100 <rowAttribute label="ref"/> … … 103 104 <rowAttribute label="label" title="Record Label"/> 104 105 <rowAttribute label="title" title="Record Title"/> 105 <rowAttribute label="uid" class="recordId"/>106 <rowAttribute label="uid" useClass="recordId"/> 106 107 <rowAttribute label="mip"/> 107 108 <rowAttribute label="tab"/> … … 112 113 <rowAttribute label="ref"/> 113 114 <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"/> 115 116 <rowAttribute label="opt" title="option for selecting a subset of variables"/> 116 117 <rowAttribute label="opar" title="parameter associated with *opt*"/> … … 120 121 <rowAttribute label="label" title="Record Label"/> 121 122 <rowAttribute label="title" title="Record Title"/> 122 <rowAttribute label="uid" class="recordId"/>123 <rowAttribute label="uid" useClass="recordId"/> 123 124 <rowAttribute label="mip"/> 124 125 <rowAttribute label="tab"/> 125 126 <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"/> 128 129 <rowAttribute label="esidComment"/> 129 130 <rowAttribute label="ny" type="xs:integer"/> … … 135 136 <rowAttribute label="label" title="Record Label"/> 136 137 <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"/> 139 140 <rowAttribute label="tattr" title="Target attribute: an attribute of the target item, or 'ALL'"/> 140 141 <rowAttribute label="description" title="Free text remarks -- unless there are specific restrictions associated with the class attribute of this remark"/> … … 147 148 <rowAttribute label="label" title="Record Label"/> 148 149 <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"/> 153 154 <rowAttribute label="mcfg" title="Model category"/> 154 155 <rowAttribute label="tier" type="xs:integer" title="Tier of experiment"/> … … 164 165 <rowAttribute label="label" title="Record Label"/> 165 166 <rowAttribute label="title" title="Record Title"/> 166 <rowAttribute label="uid" title="Record identifier" class="recordId"/>167 <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 167 168 <rowAttribute label="tierMin" type="xs:integer" title="Minimum tier of experiments in group"/> 168 169 <rowAttribute label="ntot" type="xs:integer" title="Total number of years"/> … … 171 172 <rowAttribute label="label" title="Record Label"/> 172 173 <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"/> 175 176 <rowAttribute label="title" title="Long name"/> 176 177 <rowAttribute label="mip" title="Endorsed MIP"/> … … 179 180 <rowAttribute label="label" title="Record Label"/> 180 181 <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"/> 184 185 </table> 185 186 <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"> 186 187 <rowAttribute label="label" title="Record Label"/> 187 188 <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"/> 191 192 <rowAttribute label="rank" type="xs:integer" title="For ranked choices, the rank of this variable (higher rank makes lower ranks redundant)"/> 192 193 </table> … … 194 195 <rowAttribute label="label" title="Record Label"/> 195 196 <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"/> 199 200 <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"/> 201 202 </table> 202 203 <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"> 203 204 <rowAttribute label="label" title="Record Label"/> 204 205 <rowAttribute label="title" title="Record Title"/> 205 <rowAttribute label="uid" title="Record identifier" class="recordId"/>206 <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 206 207 <rowAttribute label="class" title="Class of choice: heirarchy|cfg"/> 207 208 <rowAttribute label="title"/> … … 213 214 <rowAttribute label="label" title="Record Label"/> 214 215 <rowAttribute label="title" title="Record Title"/> 215 <rowAttribute label="uid" title="Record identifier" class="recordId"/>216 <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 216 217 <rowAttribute label="title"/> 217 218 <rowAttribute label="description"/> … … 222 223 <rowAttribute label="label" title="Record Label"/> 223 224 <rowAttribute label="title" title="Record Title"/> 224 <rowAttribute label="uid" title="Record identifier" class="recordId"/>225 <rowAttribute label="uid" title="Record identifier" useClass="recordId"/> 225 226 <rowAttribute label="title"/> 226 227 <rowAttribute label="MIPs"/> … … 229 230 <rowAttribute label="range" title="Range of valid values, e.g. xs:boolean"/> 230 231 </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> 231 241 </defDoc> -
CMIP6dreqbuild/trunk/src/framework/ptxt.py
r431 r442 72 72 ial_elTmpl = ' <rowAttribute label="%(label)s"%(wrappedType)s%(wrappedTitle)s%(wrappedClass)s%(wrappedTechn)s/>' 73 73 74 expl_Tmpl = '''<%(label)s uid="%(uid)s" class="vocab" title="%(title)s" id="%(id)s">74 expl_Tmpl = '''<%(label)s uid="%(uid)s" useClass="vocab" title="%(title)s" id="%(id)s"> 75 75 <!-- <info srcType="dummy" srcRef="ptxt.py">Dummy entries</info> --> 76 76 %(exampleItem)s … … 104 104 for i in self.itematts: 105 105 if i.clss != None: 106 wrappedClass = ' class="%s"' % i.clss106 wrappedClass = ' useClass="%s"' % i.clss 107 107 else: 108 108 wrappedClass = '' -
CMIP6dreqbuild/trunk/src/framework/scanDreq.py
r430 r442 253 253 xr_var_ovar[vid].append( i.uid ) 254 254 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 256 256 nerr += 1 257 257 else: … … 519 519 this.removeChild(d) 520 520 for k in mrefs.keys(): 521 print '>>>>>>>>>>> ',k 521 522 if len( mrefs[k] ) == 1: 522 523 tid = mrefs[k][0][2]
Note: See TracChangeset
for help on using the changeset viewer.