Changeset 429


Ignore:
Timestamp:
18/10/15 21:38:51 (4 years ago)
Author:
mjuckes
Message:

Command line added; package directory referencing cleaned up

Location:
CMIP6dreqbuild/trunk/src/framework
Files:
1 added
5 edited
1 moved

Legend:

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

    r424 r429  
    5959        cp  out/vocabDefn.xml  out/vocabSample.xml  out/vocabSchema.xsd vocab.xml  /data/tmp/svn3/exarch/CMIP6dreq/trunk/docs 
    6060        echo "docs copied to /data/tmp/svn3/exarch/CMIP6dreq/trunk/docs" 
    61         bash seddreq.sh annotated_20150731.xml "\.\.\/docs\/dreq.xml" "out\/dreq2Defn.xml" "\.\.\/docs\/dreq2Defn.xml" dreqPy/dreq.py >  /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy/dreq.py 
    62         bash seddreq02.sh "out" "\.\.\/docs" simpleCheck.py > /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy/simpleCheck.py 
    63         cp htmlTemplates.py dreqPy/scope.py dreqPy/example.py dreqPy/__init__.py /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy    
     61        bash seddreq.sh annotated_20150731.xml dreq.xml dreqPy/dreq.py >  /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy/dreq.py 
     62        bash seddreq02.sh "\.\.\/out" "\.\.\/docs" dreqPy/__init__.py > /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy/__init__.py 
     63        cp htmlTemplates.py dreqPy/scope.py dreqPy/example.py dreqPy/utilities.py /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy   
    6464        cp vocabDemo.py /data/tmp/svn3/exarch/CMIP6dreq/trunk/dreqPy     
    65         cp annotated_20150731.xml /data/tmp/svn3/exarch/CMIP6dreq/trunk/docs/dreq.xml 
     65        cp out/annotated_20150731.xml /data/tmp/svn3/exarch/CMIP6dreq/trunk/docs/dreq.xml 
    6666        cp  LICENSE README.txt setup.py setup.cfg /data/tmp/svn3/exarch/CMIP6dreq/trunk/ 
    6767        cp tables/test.xlsx /data/tmp/svn3/exarch/CMIP6dreq/trunk/docs/CMIP6_MIP_tables.xlsx 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/__init__.py

    r424 r429  
    11 
     2import os 
    23 
     4HERE = os.path.dirname(os.path.abspath(__file__) ) 
     5 
     6##DOC_DEFAULT_DIR 
     7DOC_DEFAULT_DIR = os.path.join(HERE, '../out') 
     8 
     9DOC_DIR = os.environ.get('DRQ_CONFIG_DIR', DOC_DEFAULT_DIR) 
     10 
     11__versionComment__ = "Support for command line interface added" 
    312__version__ = "01.beta.08" 
    413__title__ = "dreqPy" 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/dreq.py

    r424 r429  
    88import xml.dom.minidom 
    99import re, shelve 
     10from __init__ import DOC_DIR 
    1011 
    1112class rechecks(object): 
     
    462463defaultDreq = 'annotated_20150731.xml' 
    463464#DEFAULT CONFIG 
    464 defaultConfig = 'out/dreq2Defn.xml' 
     465defaultConfig = 'dreq2Defn.xml' 
     466 
     467defaultDreqPath = '%s/%s' % (DOC_DIR, defaultDreq ) 
     468defaultConfigPath = '%s/%s' % (DOC_DIR, defaultConfig ) 
    465469 
    466470class loadDreq(object): 
    467   def __init__(self,dreqXML=defaultDreq, configdoc=defaultConfig, useShelve=False ): 
     471  def __init__(self,dreqXML=defaultDreqPath, configdoc=defaultConfigPath, useShelve=False ): 
    468472    self.c = config( thisdoc=dreqXML, configdoc=configdoc, useShelve=useShelve) 
    469473    self.coll = self.c.get() 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/scope.py

    r424 r429  
    66from utilities import cmvFilter 
    77import collections, string 
     8import sys 
    89 
    910class baseException(Exception): 
     
    353354      od[k] = d2 
    354355    return od 
     356 
     357class dreqUI(object): 
     358  """Data Request Command line. 
     359------------------------- 
     360      -m <mip>:  MIP of list of MIPs (comma separated); 
     361      -h :       help: print help text; 
     362      -t <tier> maxmum tier; 
     363      -p <priority>  maximum priority; 
     364""" 
     365  def __init__(self,args): 
     366    self.adict = {} 
     367    self.knownargs = {'-m':('m',True), '-p':('p',True), '-t':('t',True), '-h':('h',False)}  
     368    aa = args[:] 
     369    while len(aa) > 0: 
     370      a = aa.pop(0) 
     371      if a in self.knownargs: 
     372        b = self.knownargs[a][0] 
     373        if self.knownargs[a][1]: 
     374          v = aa.pop(0) 
     375          self.adict[b] = v 
     376        else: 
     377          self.adict[b] = True 
     378 
     379    if 'm' in self.adict: 
     380      self.adict['m'] = set(self.adict['m'].split(',') ) 
     381 
     382    integerArgs = {'p','t'} 
     383    for i in integerArgs.intersection( self.adict ): 
     384      self.adict[i] = int( self.adict[i] ) 
     385 
     386  def run(self, dq=None): 
     387    if 'h' in self.adict: 
     388      print self.__doc__ 
     389      return 
     390 
     391    if not 'm' in self.adict: 
     392      print 'Current version requires -m argument'  
     393      print self.__doc__ 
     394      sys.exit(0) 
     395 
     396    if dq == None: 
     397      self.dq = dreq.loadDreq() 
     398    else: 
     399      self.dq = None 
     400 
     401    sc = dreqQuery( dq=self.dq ) 
     402    tierMax = self.adict.get( 't', 2 ) 
     403    sc.setTierMax(  tierMax ) 
     404    pmax = self.adict.get( 'p', 2 ) 
     405    v = sc.volByMip( self.adict['m'], pmax=pmax ) 
     406    print '%7.2fTb' % (v*2.*1.e-12) 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/simpleCheck.py

    r424 r429  
     1from __init__ import DOC_DIR 
    12 
    23try: 
     
    910  print 'Failed to load pkgutil .. more limited tests on available modules will be done' 
    1011  ll = [] 
    11  
    1212 
    1313requiredModules = ['xml','string','collections','os'] 
     
    3939  all = True 
    4040 
    41  
    4241import inspect 
    4342class checkbase(object): 
     
    4746 
    4847#document directory 
    49     self.docdir = 'out' 
     48    self.docdir = DOC_DIR 
    5049#schema location 
    5150    self.schema = '%s/dreq2Schema.xsd' % self.docdir 
  • CMIP6dreqbuild/trunk/src/framework/scanDreq.py

    r424 r429  
    547547   
    548548    txt = self.doc.toprettyxml(indent='\t', newl='\n', encoding=None) 
    549     oo = open( 'annotated_20150731.xml', 'w' ) 
     549    oo = open( 'out/annotated_20150731.xml', 'w' ) 
    550550    lines = string.split( txt, '\n' ) 
    551551    for line in lines: 
Note: See TracChangeset for help on using the changeset viewer.