示例#1
0
            else:
                start += '= %s +\n     & (%%s)' % start.strip()
            if k in spc_data['AE']:
                mapo.aero(True)
            else:
                mapo.aero(False)
            try:
                out = start % (var.sub(r'%(\1)s', v) % mapo)
            except KeyError, e1:
                try:
                    out = start % (var.sub(r'%(\1)s', v) % profo)
                    nprof += 1
                except KeyError, e2:
                    raise KeyError('Variable not found in either GEOS-Chem or Profile data\n\n' + str(e1) + '\n' + str(e2))
        else:
            warn("Skipping %s; not in mech" % k)

        
        outs.append(out)
    mapo.check()
    return '\n'.join(outs), nprof

if __name__ == '__main__':
    from both import geos
    from profile import profile
    go = geos('testdata/tracerinfo.dat',
                  'testdata/smv2.log')
    po = geos('testdata/profile.dat')
    from mech import mechext as mech
    map(mech('testdata'), 'mapping/saprc07tb.csv', go, po)
示例#2
0
    for f in glob(os.path.join(os.path.dirname(__file__), 'fortran_template', '*')):
        shutil.copy(f, outdir)
    for f in glob(os.path.join(os.path.dirname(__file__), 'mechmap_archive', options.archive, '*')):
        shutil.copy(f, outdir)

    

from both import geos
from profile import profile
from mech import mechnml, mechinc, mechext
from map import map, trymap
if options.extfiles:
    mech = mechext
else:
    mech = mechnml
go = geos(tracerpath,
          smvpath)
po = profile(profilepath)

if not os.path.exists(convpath):
    if os.path.exists(os.path.join(os.path.dirname(__file__), convpath + '.csv')):
        convpath = os.path.join(os.path.dirname(__file__), convpath + '.csv')
    elif 'Y' == raw_input("Conversion path does not exist; type Y to create it or any other key to abort\n"):
        trymap(mech(mechpath), convpath, go)
    else:
        exit()
mech_info = mechinc(mech(mechpath), convpath)
cspec_info = go.cspec_info()
tracer_info = go.tracer_info()
profile_info = po.profile_info()
try: 
    mappings, nprof = map(mech(mechpath), convpath, go, po)