Changeset 218 in lmdz_wrf for trunk/tools/nc_var_tools.py


Ignore:
Timestamp:
Jan 14, 2015, 5:28:41 PM (10 years ago)
Author:
lfita
Message:

Committing without knowing what's new!? brbrbrbrbrb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r204 r218  
    1213412134          'tex3': printed output as LaTeX table of three columns \verb+namelist_name+ & value
    1213512135          'column': printed output as namelist_name value
    12136           'dic': as python dictionary object
     12136          'dict': as two python dictionary object (namelistname, value and namelistname, sectionname)
    1213712137      namelist= namelist_like file to retrieve values
    1213812138    >>> get_namelist_vars('geogrid,dic','/home/lluis/etudes/domains/medic950116/namelist.wps')
     
    1216712167    sections = {}
    1216812168    namelistvals = {}
     12169    namelistsecs = {}
    1216912170    sectionnames = []
    1217012171    namessec = []
    1217112172    allnames = []
    1217212173    namelistvalssec = {}
     12174    namelistsecssec = {}
     12175    nmlname = ''
    1217312176    sectionname = ''
    1217412177
     
    1218212185
    1218312186            sectionname = linevals[0][1:len(linevals[0])+1]
    12184             print '    ' + fname + ": new section '" + sectionname + "' !!!"
     12187#            print '    ' + fname + ": new section '" + sectionname + "' !!!"
    1218512188            sectionnames.append(sectionname)
    1218612189            namessec = []
     12190            nmlname = ''
    1218712191        elif Nvals >= 1 and not searchInlist(commentchars,linevals[0][0:1]):
    1218812192            if Nvals >= 3 and searchInlist(valuessep,linevals[1]):
     
    1221212216                print '    line values:',linevals
    1221312217#                quit(-1)
     12218
    1221412219            namelistvals[nmlname] = nmlval
     12220            namelistsecs[nmlname] = sectionname
     12221
    1221512222            namessec.append(nmlname)
    1221612223            allnames.append(nmlname)
     
    1223012237            for nnml in sections[secname]:
    1223112238                namelistvalssec[nnml] = namelistvals[nnml]
     12239                namelistsecssec[nnml] = secname
    1223212240                if nml == nnml: namestouse.append(nml)
    1223312241    else:
    1223412242        namestouse = allnames
    1223512243        namelistvalssec = namelistvals
     12244        namelistsecssec = namelistsecs
    1223612245
    1223712246    if kout == 'tex3':
     
    1228812297        return
    1228912298    elif kout == 'dict':
    12290         return namelistvalssec
     12299        return namelistvalssec, namelistsecssec
    1229112300    else:
    1229212301        print errormsg
     
    1261612625
    1261712626#filter_2dim('80,y,x,lon,lat', 'tahiti_5m_ll.grd', 'z')
    12618 
    1261912627
    1262012628def ncreplace(values, ncfile, varn):
Note: See TracChangeset for help on using the changeset viewer.