Changeset 2035 in lmdz_wrf for trunk/tools
- Timestamp:
- Aug 7, 2018, 3:09:47 PM (6 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic.py
r2027 r2035 24 24 # coincident_CFtimes: Function to make coincident times for two different sets of CFtimes 25 25 # count_cond: Function to count values of a variable which attain a condition 26 # create_LateX_figs: Function to create a LaTeX from a folder with multiple plots from different values 26 27 # datetimeStr_conversion: Function to transform a string date to an another date object 27 28 # grid_combinations: Function to provide all the possible grid points combination for a given pair of values … … 53 54 # List of available operations 54 55 operations=['ASCIIfile_stats', 'coincident_CFtimes', 'count_cond', \ 55 ' datetimeStr_conversion',\56 'create_LateX_figs', 'datetimeStr_conversion', \ 56 57 'grid_combinations', 'inf_operSlist', \ 57 58 'interpolate_locs', 'latex_fig_array', 'list_operations', 'PolyArea', \ … … 89 90 ## e.g. # generic.py -o ASCIIfile_stats -S times_CDXWRF1.dat,#,R 90 91 ## e.g. # generic.py -o inf_operSlist -S '-98.21:1.2:3.45:100.1:34321.1,threshold,:,3.' 92 ## e.g. # generic.py -o create_LateX_figs -S '/home/lluis/estudios/FPS_ALPS/additional/IOP/analysis/figs,WindRose_obs_@SkewT-logP_obs_ta-tda@SkewT-logP_obs_evol@WindRose_obs-sim_step@SkewT-logP_obs-sim_step@SkewT-logP_obs-sim_evol,10868@16080@16144@16546,png' 91 93 92 94 operationnames = "'" + gen.numVector_String(operations, "', '") + "'" … … 146 148 print gen.count_cond(np.array(vals[0].split(cV), dtype=np.float), \ 147 149 np.float(vals[1]), vals[2]) 150 151 152 elif oper == 'create_LateX_figs': 153 Nvals = 4 154 vals = opts.values.split(cS) 155 if vals[0] == 'h': 156 print gen.create_LateX_figs.__doc__ 157 quit(-1) 158 else: 159 if len(vals) != Nvals: 160 print errormsg 161 print ' ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \ 162 len(vals), ' has passed!!' 163 print gen.create_LateX_figs.__doc__ 164 quit(-1) 165 vals0 = vals[0] 166 vals1 = vals[1].split('@') 167 vals2 = vals[2].split('@') 168 vals3 = vals[3] 169 170 print gen.create_LateX_figs(vals0, vals1, vals2, vals3) 148 171 149 172 elif oper == 'datetimeStr_conversion': -
trunk/tools/generic_tools.py
r2034 r2035 13486 13486 otex.write('\\documentclass{article}\n') 13487 13487 otex.write('\\usepackage{graphicx}\n') 13488 otex.write('\\usepackage[colorlinks=true,urlcolor=blue]{hyperref}\n') 13488 13489 otex.write('\n') 13489 13490 otex.write('\\textheight=23cm\n') … … 13495 13496 otex.write('\n') 13496 13497 otex.write('\\begin{document}\n') 13498 otex.write('\n') 13499 otex.write('\\listoffigures\n') 13500 otex.write('\\clearpage\n') 13497 13501 13498 13502 for plotn in plots: … … 13513 13517 if Nvalfig > 0: 13514 13518 Ncol = int(np.sqrt(Nvalfig)) 13519 Nrow = Nvalfig/Ncol 13520 if Nrow > Ncol: Ncol = Nrow 13515 13521 cs = Ntchar('c', Ncol) 13516 13522 frcwth = 0.9/Ncol … … 13530 13536 ifig = ifig + 1 13531 13537 13532 print 'Lluis ifig:', ifig-1, 'Ncol:', Ncol, 'mod:', np.mod(ifig-1,Ncol)13533 13538 if Nvalfig - ifig + 1 != 0: 13534 13539 endrow = Ntchar(' & ', Nvalfig - ifig + 1) … … 13536 13541 otex.write('\\end{tabular}\n') 13537 13542 otex.write('\\end{center}\n') 13543 otex.write('\\caption{' + latex_text(plotn) +' '+ latex_text(valn) + \ 13544 '}\n') 13545 otex.write('\\label{fig:' + plotn + '_' + valn + '}\n') 13538 13546 otex.write('\\end{figure}\n') 13539 13547 … … 13541 13549 Nunsortfig = len(unsortfigs) 13542 13550 Ncol = int(np.sqrt(Nunsortfig)) 13551 Nrow = Nvalfig/Ncol 13552 if Nrow > Ncol: Ncol = Nrow 13543 13553 cs = Ntchar('c', Ncol) 13544 13554 frcwth = 0.9/Ncol … … 13563 13573 otex.write('\\end{tabular}\n') 13564 13574 otex.write('\\end{center}\n') 13575 otex.write('\\caption{' + latex_text(plotn) + '}\n') 13576 otex.write('\\label{fig:' + plotn + '_unsorted}\n') 13565 13577 otex.write('\\end{figure}\n') 13566 13578 otex.write('\n') … … 13575 13587 sub.call('pdflatex ' + texfn.split('.')[0], shell=True) 13576 13588 sub.call('pdflatex ' + texfn.split('.')[0], shell=True) 13589 sub.call('evince ' + texfn.split('.')[0]+'.pdf &', shell=True) 13577 13590 13578 13591 return
Note: See TracChangeset
for help on using the changeset viewer.