Changeset 442 for CMIP6dreqbuild
- Timestamp:
- 24/10/15 23:05:00 (7 years ago)
- Location:
- CMIP6dreqbuild/trunk
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
CMIP6dreqbuild/trunk/docs/vocab.txt
r397 r442 37 37 - iso 38 38 - uid 39 - isClimatology {True if term is a climatology label} [xs:boolean] 39 40 ## vsf=f 40 41 vocab realm; Modeling realm; cmip.drv.004; def; 0; 1; Yes … … 97 98 - url 98 99 - uid 100 vocab modelConfig; Model configuration options; cmip.drv.004; an; 0; 1; Yes 101 - title 102 - MIPs 103 - usage 104 - type 105 - range {Range of valid values, e.g. xs:boolean} -
CMIP6dreqbuild/trunk/docs/vocabFrameworkSchema.xsd
r397 r442 26 26 <xs:attribute name="title" type="xs:string"/> 27 27 <xs:attribute name="type" type="xs:string"/> 28 <xs:attribute name=" class" type="xs:string"/>28 <xs:attribute name="useClass" type="xs:string"/> 29 29 <xs:attribute name="techNote" type="xs:string"/> 30 <xs:attribute name="superclass" type="xs:string"/> 30 31 </xs:complexType> 31 32 -
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] -
CMIP6dreqbuild/trunk/srcMisc/dreqSX.py
r382 r442 46 46 eeold = {} 47 47 ###for ee,shv in [(ee0,shvg),(eenv,shnv),(eeold,shold)]: 48 for ee,shv in [(ee0,shvg),(eenv,shnv)]: 49 for k in shv.keys(): 50 ee[k] = shv[k] 48 ##for ee,shv in [(ee0,shvg),(eenv,shnv)]: 49 for k in shnv: 50 eenv[k] = shnv[k] 51 ccl = collections.defaultdict( int ) 52 for k in shvg: 53 ee0[k] = shvg[k] 54 ccl[len(ee0[k])] += 1 55 56 print 'tables ... groups ....',ccl 57 51 58 52 59 rmod = 'csv' -
CMIP6dreqbuild/trunk/srcMisc/dreq_consol_tables.py
r382 r442 412 412 kk=3 413 413 self.idx = 0 414 self.vl3 = None 414 415 self.sh = shelve.open( 'dreq_consol_tables_shelve_v%s' % vdate, 'n' ) 415 416 self.shnv = shelve.open( 'dreq_consol_tables_nv_shelve_v%s' % vdate, 'n' ) 417 self.shnvo = shelve.open( 'dreq_consol_tables_nvom_shelve_v%s' % vdate, 'n' ) 416 418 self.shold = shelve.open( 'dreq_consol_tables_old_shelve_v%s' % vdate, 'n' ) 419 self.oonvo = open('DepricatedNewVars.txt', 'w' ) 417 420 418 421 base = '/home/martin/2014/wip/dreq/' … … 422 425 fileTmpl = 'CMIP6DataRequestCompilationTemplate_20141218.xls' 423 426 self.newVars = 'CMIP6DataRequest_ConsolidatedNewVariables_v20150907.xls' 427 self.newVars = 'CMIP6DataRequest_ConsolidatedNewVariables.xls' 424 428 self.nvd = {} 425 429 … … 496 500 try: 497 501 if m == 'LUMIP': 498 p = int( r[12] ) 499 else: 500 p = int( r[11] ) 502 r = r[:5] + r[6:] 503 p = int( r[11] ) 501 504 except: 502 505 print '!!!!!! Failed to read priority: ',v,m … … 509 512 self.nvd[v] = [p,] + r 510 513 for v in self.nvd.keys(): 511 k = str( uuid.uuid1() ) 512 self.shnv[k] = self.nvd[v][:] + [k,] 514 if v in self.vl3: 515 print 'WARN.090.08000: "new" variable in old list: %s: %s ' % (v,str(self.vl3[v]) ) 516 self.shnvo[v] = ( self.nvd[v][:], self.vl3[v] ) 517 self.oonvo.write( '-- %s --\n' % v ) 518 self.oonvo.write( str( self.nvd[v][:]) + '\n' ) 519 self.oonvo.write( str( self.vl3[v][:] ) + '\n' ) 520 else: 521 k = str( uuid.uuid1() ) 522 self.shnv[k] = self.nvd[v][:] + [k,] 513 523 oo.close() 514 524 515 def groups(self, vl3=None): 525 def groups(self): 526 vl3 = self.vl3 516 527 rh1 = ['Short name', 'Standard Name', 'Table', 'Frequency', 'Description extension (optional)', 'Shape', 'Levels', 'Time mean, point or climatology', 'Mask (optional)'] 517 528 rh2 = ['Short name of group', 'Variable short name', 'Table', 'Frequency', 'Description extension (optional)', 'Shape', 'Levels', 'Time mean, point or climatology', 'Mask (optional)'] … … 557 568 thisl = 9 558 569 else: 559 print ' *************',k,s570 print 'ERROR.090.090010: duplicate record ....',k,s 560 571 ok = len( hr ) >= 9 and all( map( lambda x: string.strip(hr[x].value) == rh1[x], range(9) ) ) 561 572 assert ok, '002: Sheet heading not recognised: %s' % str(hr) … … 567 578 irsh = 5 568 579 for i in range(ll[-1]+1,sh.nrows): 580 rowIndex = i 569 581 thisr = sh.row(i) 570 582 if iv == 1: … … 577 589 if thisl == 9: 578 590 lll.append( 105 ) 591 592 assert len(lll) == 10,'bad record length ....' 593 ### 594 ### add mip name and space ... 579 595 lll += [k,''] 580 596 if it >= 0: … … 657 673 ku = str( uuid.uuid1() ) 658 674 lll[11] = ku 659 self.sh[ku] = tuple( lll )675 self.sh[ku] = tuple( lll + [rowIndex,]) 660 676 ### MIP, group, size, dictionary -- # items in each shape. 661 677 self.glist.append( (k, s, ll, e1) ) … … 729 745 wbx.write( 'CMIP6_DataRequest_CMIP5changes.xls' ) 730 746 731 vl3 = {}732 747 ##wb3 = workbook( 'vlsc5b_v20150714.xls' ) 733 748 wb3 = workbook( 'vlsc5b_v20150907.xls' ) … … 737 752 opt = 1 738 753 if opt == 1: 754 m.vl3 = {} 739 755 for i in range(sh.nrows): 740 756 r = map( lambda x: string.strip(str(uniCleanFunc(x.value))), sh.row(i) ) 741 757 if len(r) < 9 or r[8] == '': 742 vl3[r[1]] = tuple( r[:8] )758 m.vl3[r[1]] = tuple( r[:8] ) 743 759 m.shold[r[0]] = r 744 745 760 746 761 m.run1(nmip=1) 747 762 m.loadNewVars() 748 m.groups( vl3=vl3)763 m.groups( ) 749 764 k = m.sh.keys()[4] 750 765 print '##############################################' … … 753 768 m.sh.close() 754 769 m.shnv.close() 770 m.shnvo.close() 771 m.oonvo.close() 755 772 m.shold.close() 756 773 -
CMIP6dreqbuild/trunk/srcMisc/fcc_utils2.py
r355 r442 10 10 class mipTableScan(object): 11 11 12 def __init__(self, vats = ['standard_name','long_name','units','cell_methods' ] ):12 def __init__(self, vats = ['standard_name','long_name','units','cell_methods','valid_min', 'valid_max', 'ok_min_mean_abs', 'ok_max_mean_abs'] ): 13 13 self.al = [] 14 14 self.vats = vats -
CMIP6dreqbuild/trunk/srcMisc/sx2.py
r397 r442 98 98 for k in sx.ee0.keys(): 99 99 r = sx.ee0[k] 100 mip = r[-2] 100 mip = r[10] 101 assert mip == r[-3],'Double check failed' 101 102 tab = r[2] 102 103 grp = r[0] … … 105 106 ee_tabs[thistab].append(k) 106 107 ee_grps[grp].append(k) 108 109 110 import sys 107 111 108 112 kf = [] … … 142 146 thise = collections.defaultdict( int ) 143 147 for k2 in ee_tabs[k]: 144 thise[sx.ee0[k2][ -2]] += 1148 thise[sx.ee0[k2][12-2]] += 1 145 149 keys = thise.keys() 146 150 keys.sort() … … 234 238 235 239 if not ok: 236 print ' -----',tab,sx.ee0[u]240 print 'ERROR.090.077000:',tab,sx.ee0[u] 237 241 ee0_xref[u] += ((-1,['__var_not_found_012__',]),) 238 242 … … 314 318 ll_ov.append( ee_mv0[k] ) 315 319 print 'Number of old variables: %s [%s]' % (len(ll_ov), len(ee_mv0.keys()) ) 316 print 320 print len(sx.eenv.keys()) 317 321 print "Number of new variables: %s" % ( len(sx.eenv.keys()) ) 318 322 ## … … 378 382 sh = shelve.open( '%s/cmipVars' % odir, 'n' ) 379 383 sh['__info__'] = { 'label':'cmipVars', 'title':'CMIP variables', 'prov':'sx.eenv and sx.eeold' } 380 sh['__cols__'] = ['label','title','sn','units','description','procnote','procComment','prov' ]384 sh['__cols__'] = ['label','title','sn','units','description','procnote','procComment','prov','priority0'] 381 385 382 386 ee = {} … … 384 388 this = nt_vrecix._make( map( lambda x: sx.eenv[k][x], vrecix_new ) ) 385 389 ##sh[k] = { 'label':this.v, 'title':this.l, 'sn':this.s, 'units':this.u, 'description':this.c, 'procnote':'', 'procComment':'','prov':'CMIP6 endorsement' } 386 sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '','CMIP6 endorsement' ] 390 prov = 'CMIP6 endorsement [%s]' % sx.eenv[k][1] 391 sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',prov, sx.eenv[k][0] ] 387 392 ee[this.u] = k 388 393 if this.u == 'atmos': … … 396 401 this = nt_vrecix._make( map( lambda x: sx.eeold[k][x], vrecix_old ) ) 397 402 ##sh[k] = { 'label':this.v, 'title':this.l, 'sn':this.s, 'units':this.u, 'description':this.c, 'procnote':'', 'procComment':'','prov':sx.eeold[k][6]} 398 sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',sx.eeold[k][6] ]403 sh[k] = [ this.v, this.l, this.s, this.u, this.c, '', '',sx.eeold[k][6], 101 ] 399 404 nk += 1 400 405 … … 506 511 ## parse 1 507 512 ee0_p1 = {} 508 ee0_gp = collections.defaultdict( int )509 513 ee0_gp = collections.defaultdict( d1 ) 514 st1 = set() 510 515 for k in sx.ee0.keys(): 511 516 r = list(sx.ee0[k][:] ) … … 520 525 ee0_p1[k] = r[:] 521 526 ee0_gp[r[0]][r[10]] = k 527 st1.add( r[10] ) 522 528 if r[0] == '': 523 529 print '################' 524 530 print r 531 532 533 assert 'CFMIP' in st1, 'FAILED sanity check 1 ... CFMIP not in st1 %s' % str(st1) 534 assert len( list(st1) ) < 40, 'FAILED sanity check 2 ... too many items in st1 [should be list of MIPs] %s' % len(list(st1)) 525 535 print '################### groups referenced from new groups sheets' 526 536 print ee0_gp.keys() … … 800 810 sh['__info__'] = {'label':'groupItems', 'title':'List of items in new groups', 'description':"New groups" } 801 811 ##(u'DYVR_daily', u'utendnogw', '', u'daily', '', '', '', '', '', u'DynVar', 'DynVar', '772da0b6-25b6-11e5-8cf6-ac72891c3257') 802 sh['__cols__'] = ['group','var','table','freq','', 'shape', '', '', '','mip','mip?','uuid',' new','gpid','vkey','vid']812 sh['__cols__'] = ['group','var','table','freq','', 'shape', '', '', '','mip','mip?','uuid','rowIndex','new','gpid','vkey','vid'] 803 813 for k in ee0_p1.keys(): 804 814 kkk = '%s.%s' % (ee0_p1[k][10],ee0_p1[k][0]) … … 909 919 else: 910 920 p = sx.cmip5so.so[t].a[v1][0] 921 rwix = sx.cmip5so.so[t].a[v1][-2] 922 si = sx.cmip5so.so[t].a[v1][-1] 923 rwix = rwix + 200*si 911 924 912 925 ## the "Oyr" group is for import, not needed in request … … 1028 1041 ff[vdefex[u][1]] = u 1029 1042 ##if sx.ee_xref_bck.has_key(u): 1043 1030 1044 for v0 in vars.keys(): 1031 1045 v = string.strip( v0 )
Note: See TracChangeset
for help on using the changeset viewer.