- Timestamp:
- Jan 14, 2015, 5:28:41 PM (10 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r204 r218 1479 1479 draw_lines(ncfilens, values, varname): 1480 1480 ncfilens= [filen] ',' separated list of netCDF files 1481 values= [dimvname]:[valuesaxis]:[dimtit]:[leglabels]:[vtit]:[title]:[ graphk]1481 values= [dimvname]:[valuesaxis]:[dimtit]:[leglabels]:[vtit]:[title]:[locleg]:[graphk] 1482 1482 [dimvname]: name of the variable with he values of the common dimension 1483 1483 [valuesaxis]: which axis will be used for the values ('x', or 'y') … … 1486 1486 [vartit]: name of the variable in the graph 1487 1487 [title]: title of the plot ('|' for spaces) 1488 [locleg]: location of the legend (-1, autmoatic) 1489 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 1490 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', 1491 9: 'upper center', 10: 'center' 1488 1492 [graphk]: kind of the graphic 1489 1493 varname= variable to plot … … 1498 1502 quit() 1499 1503 1500 expectargs = '[dimvname]:[valuesaxis]:[dimtit]:[leglabels]:[vtit]:[title]:[ graphk]'1504 expectargs = '[dimvname]:[valuesaxis]:[dimtit]:[leglabels]:[vtit]:[title]:[locleg]:[graphk]' 1501 1505 drw.check_arguments(fname,len(expectargs.split(':')),values,':',expectargs) 1502 1506 -
trunk/tools/drawing_tools.py
r208 r218 3466 3466 y[i,:] = dimyv 3467 3467 3468 plt.rc('text', usetex=True)3468 # plt.rc('text', usetex=True) 3469 3469 3470 3470 plt.pcolormesh(x, y, varsv, cmap=plt.get_cmap(colorbar), vmin=vs[0], vmax=vs[1]) … … 4431 4431 return 4432 4432 4433 def plot_lines(vardv, varvv, vaxis, dtit, linesn, vtit, vunit, gtit, kfig):4433 def plot_lines(vardv, varvv, vaxis, dtit, linesn, vtit, vunit, gtit, gloc, kfig): 4434 4434 """ Function to plot a collection of lines 4435 4435 vardv= list of set of dimension values … … 4441 4441 vunit= units of the vaxis 4442 4442 gtit= main title 4443 gloc= location of the legend (-1, autmoatic) 4444 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right', 4445 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', 4446 9: 'upper center', 10: 'center' 4443 4447 kfig= kind of figure 4444 4448 plot_lines([np.arange(10)], [np.sin(np.arange(10)*np.pi/2.5)], 'y', 'time (s)', \ … … 4485 4489 4486 4490 plt.title(graphtit) 4487 plt.legend( )4491 plt.legend(loc=gloc) 4488 4492 4489 4493 output_kind(kfig, figname, True) -
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.