Changeset 218 in lmdz_wrf for trunk/tools/nc_var_tools.py
- Timestamp:
- Jan 14, 2015, 5:28:41 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r204 r218 12134 12134 'tex3': printed output as LaTeX table of three columns \verb+namelist_name+ & value 12135 12135 'column': printed output as namelist_name value 12136 'dic ': as python dictionary object12136 'dict': as two python dictionary object (namelistname, value and namelistname, sectionname) 12137 12137 namelist= namelist_like file to retrieve values 12138 12138 >>> get_namelist_vars('geogrid,dic','/home/lluis/etudes/domains/medic950116/namelist.wps') … … 12167 12167 sections = {} 12168 12168 namelistvals = {} 12169 namelistsecs = {} 12169 12170 sectionnames = [] 12170 12171 namessec = [] 12171 12172 allnames = [] 12172 12173 namelistvalssec = {} 12174 namelistsecssec = {} 12175 nmlname = '' 12173 12176 sectionname = '' 12174 12177 … … 12182 12185 12183 12186 sectionname = linevals[0][1:len(linevals[0])+1] 12184 print ' ' + fname + ": new section '" + sectionname + "' !!!"12187 # print ' ' + fname + ": new section '" + sectionname + "' !!!" 12185 12188 sectionnames.append(sectionname) 12186 12189 namessec = [] 12190 nmlname = '' 12187 12191 elif Nvals >= 1 and not searchInlist(commentchars,linevals[0][0:1]): 12188 12192 if Nvals >= 3 and searchInlist(valuessep,linevals[1]): … … 12212 12216 print ' line values:',linevals 12213 12217 # quit(-1) 12218 12214 12219 namelistvals[nmlname] = nmlval 12220 namelistsecs[nmlname] = sectionname 12221 12215 12222 namessec.append(nmlname) 12216 12223 allnames.append(nmlname) … … 12230 12237 for nnml in sections[secname]: 12231 12238 namelistvalssec[nnml] = namelistvals[nnml] 12239 namelistsecssec[nnml] = secname 12232 12240 if nml == nnml: namestouse.append(nml) 12233 12241 else: 12234 12242 namestouse = allnames 12235 12243 namelistvalssec = namelistvals 12244 namelistsecssec = namelistsecs 12236 12245 12237 12246 if kout == 'tex3': … … 12288 12297 return 12289 12298 elif kout == 'dict': 12290 return namelistvalssec 12299 return namelistvalssec, namelistsecssec 12291 12300 else: 12292 12301 print errormsg … … 12616 12625 12617 12626 #filter_2dim('80,y,x,lon,lat', 'tahiti_5m_ll.grd', 'z') 12618 12619 12627 12620 12628 def ncreplace(values, ncfile, varn):
Note: See TracChangeset
for help on using the changeset viewer.