Esempio n. 1
0
def main(scope):

    sc = scope.dreqQuery()
    print('DREQ VERSION: %s' % str(sc.dq.version))
    ##print ( '######### All variables ###########' )
    ##priorityMax = 3
    ##runExample( sc, priorityMax )
    print('######### Top priority variables ###########')
    priorityMax = 1
    runExample(sc, priorityMax)
Esempio n. 2
0
def run():
    try:
        import makeTables
        import scope
    except:
        import dreqPy.scope as scope
        import dreqPy.makeTables as makeTables

    assert os.path.isdir(
        'html'
    ), 'Before running this script you need to create "html", "html/index" and "html/u" sub-directories, or edit the call to dq.makeHtml'
    assert os.path.isdir(
        'html/u'
    ), 'Before running this script you need to create "html", "html/index" and "html/u" sub-directories, or edit the call to dq.makeHtml, and refernces to "u" in style lines below'
    assert os.path.isdir(
        'html/index'
    ), 'Before running this script you need to create "html", "html/index" and "html/u" sub-directories, or edit the call to dq.makeHtml, and refernces to "u" in style lines below'
    assert os.path.isdir(
        'tables'
    ), 'Before running this script you need to create a "tables" sub-directory, or edit the table_utils.makeTab class'

    dq = dreq.loadDreq(htmlStyles=htmlStyle, manifest='out/dreqManifest.txt')
    ##
    ## add special styles to dq object "itemStyle" dictionary.
    ##
    dq.itemStyles['standardname'] = styls.snLink
    dq.itemStyles['var'] = styls.varLink
    dq.itemStyles['mip'] = styls.mipLink
    dq.itemStyles['CMORvar'] = styls.cmvLink
    dq.itemStyles['objective'] = styls.objLink
    dq.itemStyles['units'] = styls.unitLink
    dq.itemStyles['structure'] = styls.strLink
    dq.itemStyles['cellMethods'] = styls.cmLink
    dq.itemStyles['remarks'] = styls.remarkLink
    dq.itemStyles['exptgroup'] = styls.baseLink01
    dq.itemStyles['objectiveLink'] = styls.objLnkLink
    dq.itemStyles['requestVarGroup'] = styls.vgrpLink
    dq.itemStyles['miptable'] = styls.miptableLink
    dq.itemStyles['requestLink'] = styls.rqlLink02
    dq.itemStyles['requestItem'] = styls.rqiLink02
    dq.itemStyles['spatialShape'] = styls.labTtl
    dq.indexSortBy['miptable'] = 'label'
    dq.coll['var'].items[0].__class__._linkAttrStyle['sn'] = styls.snLink01
    dq.coll['CMORvar'].items[0].__class__._linkAttrStyle[
        'stid'] = styls.stidLink01
    ##dq.coll['requestVarGroup'].items[0].__class__._linkAttrStyle['requestVar'] = styls.rqvLink01
    dq.itemStyles['requestVar'] = styls.rqvLink01

    dreq.dreqItemBase._extraHtml['requestVarGroup'] = rvgExtraTable.vgx1(
        dq).mxoGet
    dreq.dreqItemBase.__charmeEnable__['var'] = nt__charmeEnable(
        'test', 'http://clipc-services.ceda.ac.uk/dreq')

    ht = htmlTrees(dq)
    dq.makeHtml(annotations={'var': ht.anno},
                ttl0='Data Request [%s]' % dreq.version)
    sc = scope.dreqQuery(dq=dq)
    try:
        mt = table_utils.makeTab(sc)
    except:
        print('Could not make tables ...')
        raise
    mp = makePurl(dq)
    mj = makeJs(dq)
Esempio n. 3
0
            self.tiermax, self.pmax)
        if self.sc.gridPolicyDefaultNative:
            defNat = 'For volume estimation, ocean data is assumed to be on the model native grid unless specifically requested on an interpolated grid'
        else:
            defNat = 'For volume estimation, ocean data is assumed to be on a regular 1-degree grid unless specifically requested on another grid (e.g. the native model grid)'
        bdy = '''<h1>%(ttl)s</h1>
<p>Data volumes are estimated for nominal model with 1 degree resolution and 40 levels in the atmosphere and 0.5 degrees with 60 levels in the ocean.  The "Requesting MIP" (rows) is the MIP specifying the data required to meet their scientific objectives. The "designing MIP" (columns) is the MIP specifying the experimental design. %(defNat)s <b>The figures below represent work in progress: there are still omissions and flaws, more details are on the 
<a href="https://earthsystemcog.org/projects/wip/CMIP6DataRequest" title="Data Request CoG page">Data Request home page</a>.</b></p>
''' % {
            'ttl': ttl,
            'defNat': defNat
        }
        bdy += '\n'.join(mmh)
        ooh = open(
            'tab01_%s_%s%s.html' % (self.tiermax, self.pmax, self.efnsfx), 'w')
        ooh.write(self.dq.pageTmpl % (ttl, jsh, './', './index.html', bdy))
        ooh.close()
        oo.close()


if __name__ == "__main__":
    try:
        import makeTables
        import scope
    except:
        import dreqPy.scope as scope
        import dreqPy.makeTables as makeTables
    sc = scope.dreqQuery()
    r = r1(sc, table_utils.tables, tiermax=1, pmax=1)
    r = r1(sc, table_utils.tables, tiermax=3, pmax=3)
Esempio n. 4
0
def initialize_scope(tier_max):
    global scope
    if scope is None:
        scope = Scope(dreqQuery(dq=dq, tierMax=tier_max))
    return scope