source: lmdz_wrf/trunk/tools/lmdz_check.bash @ 232

Last change on this file since 232 was 230, checked in by lfita, 10 years ago

Adding knwon variable name

  • Property svn:executable set to *
File size: 21.5 KB
Line 
1#!/bin/bash
2## e.g. # lmdz_check.bash -1:6:3:26 wrfout_d01_1979-12-01_00:00:00 /home/lluis/PY /home/lluis/etudes/WRF_LMDZ/WaquaL/LaTeX/NPv31_hgardfou/figs 0 None 0
3## e.g. # lmdz_check.bash -1:9:9:4 iphysiq1_time_step150/wrfout_d01_check.nc /home/lfita/PY iphysiq1_time_step150/check 1 None 0
4if test $1 = '-h'; then
5  echo "**********************************"
6  echo "***   Shell script to analyze  ***"
7  echo "*** LMDZ runs at a given point ***"
8  echo "**********************************"
9  echo "lmdz_check.bash [point](as Time:z:y:x, -1 last value) [infile] [pyhome] \
10    (place with pthon scripts) [ofold](output folder) [getvals](0, no; 1: yes, \
11    whether to compute intermediary files) [mapv](None, no; map characteristics:[proj],[res])"
12  echo "  [point]: as Time:z:y:x, (-1 for last value, python style (0 based))"
13  echo "  [infile]: file to use"
14  echo "  [pyhome]: place with pthon scripts"
15  echo "  [ofold]: output folder"
16  echo "  [getvals]: 0, no; 1: yes, whether to compute intermediary files"
17  echo "  [mapv]: None, no; map characteristics:[proj],[res]"
18  echo "  [visualize]: 0, no; 1: yes, whether to visualize results"
19else
20
21function to_LaTeX() {
22#   Function to transform an ASCII to LaTeX
23    asc=$1
24
25# Characters to find ('\' must be de first)
26    findchars='\\:_:%:&'
27
28# ASCII chains to substitue with
29    substchars='\backslash:\_:\%:\&'
30
31    fchars=`echo ${findchars} | tr ':' ' '`
32
33    foundv=0
34    for chv in ${fchars}; do
35      found=`expr index ${asc} ${chv}`
36      if test ${found} -ne 0; then 
37        foundv=1
38        break
39      fi
40    done
41
42    if test ${foundv} -eq 0; then 
43      echo ${asc}
44      return 
45    fi 
46
47    ich=1
48    newasc=''
49
50    Lasc=`expr length ${asc}`
51    partasc=${asc}
52    for chv in ${fchars}; do
53      Lpartasc=${Lasc}
54      while test ${Lpartasc} -gt 0; do
55        found=`expr index ${partasc} ${chv}`
56        if test ${found} -ne 0; then
57          newpart=`echo ${partasc} | tr ${chv} ' ' | awk '{print $1}'`
58          Lnewpart=`expr length ${newpart}`
59          Lnewpart1=`expr ${Lnewpart} + 1`
60          Lwithoutnewpart=`expr ${Lpartasc} - ${Lnewpart} - 1`
61          partasc=${partasc:${Lnewpart1}:${Lwithoutnewpart}}
62          newchar=`echo ${substchars} | tr ':' '\n' | head -n ${ich} | tail -n 1`
63          newasc=${newasc}${newpart}${newchar}
64          Lpartasc=`expr length ${partasc}`
65        else
66          Lnewpart=`expr length ${newpart}'0'`
67          if test ${Lnewpart} -gt 1; then
68            newasc=${newasc}${partasc}
69          fi
70          Lpartasc=-1
71          Lnewasc=`expr length ${newasc}'0'`
72          if test ${Lnewpart} -eq 1; then
73            partasc=${asc}
74          else
75            partasc=${newasc}
76          fi
77          newpart=''
78        fi
79      done
80      Lpartasc=`expr length ${newasc}`
81      ich=`expr ${ich} + 1`
82    done
83    echo ${newasc}
84
85    return
86}
87
88####### ###### ##### #### ### ## #
89
90  rootsh=`pwd`
91  errmsg='ERROR -- error -- ERROR -- error'
92  main='lmdz_check.bash'
93
94  point=$1
95  infile=$2
96  PYHOME=$3
97  ofold=$4
98  getvals=$5
99  mapv=$6
100  vis=$7
101
102# To paint figures
103  draw=0
104
105# To generate Hovmoller graph
106  dohov=1
107
108# To generate point graph
109  dopt=1
110
111# To generate horizontal graph
112  dohor=1
113
114# To generate neighbourghood evol graph
115  doneig=1
116
117# To generate LaTeX
118  dolatex=1
119
120  vartypes='dt:st:sfc'
121
122  dtvariables='AJS:CON:DYN:EVA:LSCST:LSCTH:LSC:PHY:THE:VDF:WAK'
123  stvariables='QVAPOR:QCLOUD:LGEOP:LTEMP:LVITU:LVITV:LVITW:LRHUM:LH2O:LPR_CON_I:'
124  stvariables=${stvariables}'LPR_CON_L:LIWCON:LPTCONV:LVPRECIP:LPR_LSC_I:'
125  stvariables=${stvariables}'LPR_LSC_L'
126  sfcvariables='LSNOW:LEVAP:LPRECIP:LPLUC:LPLUL:LRH2M:T2:U10:V10:LCLDL:LCLDM:LCLDH:PSFC'
127
128  kvalues='2dh:hovz:tevol'
129
130  filetexn='lmdz_check.tex'
131  otex=${ofold}'/'${filetexn}
132####### ###### ##### #### ### ## #
133# Levels to interpolate
134  plevels='100000.,97500.,95000.,92500.,90000.,85000.,80000.,75000.,70000.,'
135  plevels=${plevels}'65000.,60000.,55000.,50000.,45000.,40000.,35000.,30000.,'
136  plevels=${plevels}'25000.,20000.,15000.,10000.,5000.,2500.,1000.,'
137  plevels=${plevels}'500.,250.'
138
139  tval=`echo ${point} | tr ':' ' ' | awk '{print $1}'`
140  zval=`echo ${point} | tr ':' ' ' | awk '{print $2}'`
141  yval=`echo ${point} | tr ':' ' ' | awk '{print $3}'`
142  xval=`echo ${point} | tr ':' ' ' | awk '{print $4}'`
143
144  infileS=`echo ${infile} | tr '.' ' ' | awk '{print $1}'`
145
146#######    #######
147## MAIN
148    #######
149  mkdir -p ${ofold}
150
151  vtypes=`echo ${vartypes} | tr ':' ' '`
152  kvals=`echo ${kvalues} | tr ':' ' '`
153
154# All variables
155  allvars0=''
156
157  for vt in ${vtypes}; do
158    case $vt in
159      'dt' )
160        var0s=`echo ${dtvariables} | tr ':' ' '`
161        for var0 in $var0s; do
162          allvars0=${allvars0}'LDQ'${var0}',LDT'${var0}','
163          if test ${var0} = 'CON' || test ${var0} = 'DYN' || test ${var0} = 'VDF'; then
164            allvars0=${allvars0}'LDU'${var0}',LDV'${var0}','
165          fi
166        done
167      ;;
168      'sfc' )
169        var0s=`echo ${sfcvariables} | tr ':' ' '`
170        for var0 in $var0s; do
171          allvars0=${allvars0}${var0}','
172        done
173      ;;
174      'st' )
175        var0s=`echo ${stvariables} | tr ':' ' '`
176        for var0 in $var0s; do
177          allvars0=${allvars0}${var0}','
178        done
179      ;;
180    esac
181  done
182  Lallvars0=`expr length ${allvars0}`
183  Lallvars01=`expr ${Lallvars0} - 1`
184  allvars=${allvars0:0:${Lallvars01}}
185  echo "all vars: '"${allvars}"'"
186
187  if test ${getvals} -eq 1; then
188    for kvn in ${kvals}; do
189      echo "  kind of values: "${kvn}
190      case $kvn in
191        '2dh')
192          pyvls='Time,'${tval}','${tval}',1@bottom_top,'${zval}','${zval}',1'
193        ;;
194        'hovz')
195          pyvls='south_north,'${yval}','${yval}',1@west_east,'${xval}','${xval}',1'
196        ;;
197        'tevol')
198          pyvls='bottom_top,'${zval}','${zval}',1@south_north,'${yval}','${yval}
199          pyvls=${pyvls}',1@west_east,'${xval}','${xval}',1'
200        ;;
201      esac
202      ofile=`python ${PYHOME}/nc_var.py -o DataSetSection_multidims -f ${infile}     \
203        -S ${pyvls} | grep succesfull | awk '{print $6}' | tr '"' ' '`
204      if test $? -ne 0; then
205        echo ${errmsg}
206        echo "  "${main}": python failed!"
207        echo "    python "${HOME}/nc_var.py -o DataSetSection_multidims              \
208          -f ${infile} -S ${pyvls}
209        exit
210      fi
211      case $kvn in
212        '2dh')
213# Adding CF longitudes and latitudes
214          python ${PYHOME}/nc_var.py -f ${ofile} -o WRF_CFlonlat_creation            \
215            -S longitude,latitude -v XLONG,XLAT
216        ;;
217        'tevol')
218# Adding CF time
219          python ${PYHOME}/nc_var.py -f ${ofile} -o WRF_CFtime_creation              \
220            -S 19491201000000,hours -v time
221        ;;
222        'hovz')
223# Adding CF time
224          python ${PYHOME}/nc_var.py -f ${ofile} -o WRF_CFtime_creation              \
225            -S 19491201000000,hours -v time
226# Adding variable dimension from 'bottom_top'
227          python ${PYHOME}/nc_var.py -f ${ofile} -o dimVar_creation -S bottom_top
228# Vertical interpolation
229#          dvals='T:Time,Z:bottom_top,Y:south_north,X:west_east'
230#          python ${PYHOME}/vertical_interpolation.py -f ${ofile} -o WRFp             \
231#            -i ${plevels} -k 'lin' -v ${allvars} -d ${dvals}                         \
232#            -D T:Times,Z:ZNU,Y:XLAT,X:XLONG
233#          if test $? -ne 0; then
234#            echo ${errormsg}
235#            echo "  "${main}": drawing.py fails!"
236#            echo python ${PYHOME}/vertical_interpolation.py -f ${ofile} -o WRFp \
237#             -i ${plevels} -k 'lin' -v ${allvars} -d ${dvals} \
238#             -D T:Times,Z:ZNU,Y:XLAT,X:XLONG
239#            exit
240#          fi
241#          ofilen0=`echo ${ofile} | tr '.' ' ' | awk '{print $1}'`
242#          mv vertical_interpolation_WRFp.nc ${ofilen0}_WRFp.nc
243        ;;
244      esac
245    done
246  fi
247
248#exit
249  if test $draw -eq 1; then
250  echo "Drawing..."
251  mkdir ${ofold}/figs
252
253  for vt in ${vtypes}; do
254    echo "variable type: "${vt}
255    case $vt in
256      'dt' )
257        var0s=`echo ${dtvariables} | tr ':' ' '`
258        vars=''
259        for var0 in $var0s; do
260          vars=${vars}'LDQ'${var0}' LDT'${var0}' '
261          if test ${var0} = 'CON' || test ${var0} = 'DYN' || test ${var0} = 'VDF'; then
262            vars=${vars}'LDU'${var0}' LDV'${var0}' '
263          fi
264        done
265      ;;
266      'sfc' )
267        vars=`echo ${sfcvariables} | tr ':' ' '`
268      ;;
269      'st' )
270        vars=`echo ${stvariables} | tr ':' ' '`
271      ;;
272    esac
273    echo ${vars}
274    for var in ${vars}; do
275      echo "  var: "${var}
276      varvals=`python ${PYHOME}/drawing.py -o variable_values -S ${var} | grep all_values`
277      if test $? -ne 0; then
278        echo "  "${main}": Variable '"${var}"' not defined !!!!"
279        exit
280      fi
281      stdn=`echo ${varvals} | tr ',' ' ' | awk '{print $3}'`
282      cbar=`echo ${varvals} | tr ',' ' ' | awk '{print $9}'`
283      min=`echo ${varvals} | tr ',' ' ' | awk '{print $5}'`
284      max=`echo ${varvals} | tr ',' ' ' | awk '{print $6}'`
285
286      if test $dohov -eq 1 && ! test ${vt} = 'sfc'; then
287# Shadded vertical Hovmoller diagrams
288      filetail='south_north_B'${yval}'-E'${yval}'-I1_west_east_B'${xval}
289      filetail=${filetail}'-E'${xval}'-I1'
290
291# Let's make it easy
292      if test ${vt} = 'st';then
293        min='Saroundminmax@0.97'
294        max='Saroundminmax@0.97'
295      else
296        min='Spercentile@1'
297        max='Spercentile@1'
298      fi
299
300      if test ${var} = 'LDQEVA' || test ${var} = 'LDTEVA' || test ${var} = 'LH2O';then
301        min='Saroundminmax@0.75'
302        max='Saroundminmax@0.75'
303        if test ${var} = 'LDQEVA'; then
304          cbar='Reds'
305        else
306          cbar='Blues'
307        fi
308      fi
309
310      echo "    min: "${min}" max: "${max}
311
312      values=${stdn}':Time|-1,bottom_top|-1:varDIMbottom_top:time:'${cbar}':'
313      values=${values}${min}','${max}':vertical|temporal|evolution|:pdf:'
314      values=${values}'transpose:time|hours!since!1949-12-01|exct,12,h|'
315      values=${values}'$%d^{%H}$|date!($[DD]^{[HH]}$)|x:True'
316
317      python ${PYHOME}/drawing.py -o draw_2D_shad_time -f ${infileS}_${filetail}.nc   \
318        -S ${values} -v ${var},time
319      if test $? -ne 0; then
320        echo ${errormsg}
321        echo "  "${main}": drawing.py fails!"
322        echo python ${PYHOME}/drawing.py -o draw_2D_shad_time \
323          -f ${infileS}_${filetail}.nc -S ${values} -v ${var},time
324        exit
325      else
326        mv 2Dfields_shadow_time.pdf ${ofold}/figs/${stdn}_Hovmoller.pdf
327        if test $vis -eq 1; then evince ${ofold}/figs/${stdn}_Hovmoller.pdf & fi
328      fi
329      fi
330     
331      if test $dopt -eq 1; then
332# Point evolution
333      filetail='bottom_top_B'${zval}'-E'${zval}'-I1_south_north_B'${yval}'-E'
334      filetail=${filetail}${yval}'-I1_west_east_B'${xval}'-E'${xval}'-I1'
335
336      values=${stdn}':time|($[DD]^{[HH]}$):exct,12,h:$%d^{%H}$:time|evolution|at'
337      values=${values}'|(x='${xval}',y='${yval}',z='${zval}'):1:pdf'
338      python ${PYHOME}/drawing.py -o draw_timeSeries -f ${infileS}_${filetail}.nc     \
339        -S ${values} -v ${var},time
340      if test $? -ne 0; then
341        echo ${errormsg}
342        echo "  "${main}": drawing.py fails!"
343        echo python ${PYHOME}/drawing.py -o draw_timeSeries \
344          -f ${infileS}_${filetail}.nc -S ${values} -v ${var},time
345        exit
346      else
347        mv TimeSeries_${stdn}.pdf ${ofold}/figs/${stdn}_TimeSeries.pdf
348        if test $vis -eq 1; then evince ${ofold}/figs/${stdn}_TimeSeries.pdf & fi
349      fi
350      fi
351
352      if test $dohor -eq 1; then
353# Horizontal plot
354      filetail='Time_B'${tval}'-E'${tval}'-I1_bottom_top_B'${zval}
355      filetail=${filetail}'-E'${zval}'-I1'
356
357      min=`echo ${varvals} | tr ',' ' ' | awk '{print $5}'`
358      max=`echo ${varvals} | tr ',' ' ' | awk '{print $6}'`
359
360      if test ${vt} = 'dt'; then
361        min='Spercentile@1'
362        max='Spercentile@1'
363      elif test ${vt} = 'st'; then
364        min='Saroundminmax@0.97'
365        max='Saroundminmax@0.97'
366      fi
367
368      if test ${var} = 'LRH2M'; then
369        max='100.'
370      elif test ${var} = 'T2'; then
371        min='270'
372        max='300.'
373      fi
374
375      echo "    min: "${min}" max: "${max}
376
377      values=${stdn}':south_north|-1,west_east|-1:longitude:latitude:'${cbar}':'
378      values=${values}${min}','${max}':horizontal|section|at|(t='${tval}
379      values=${values}',z='${zval}'):pdf:None:'${mapv}':True'
380
381      python ${PYHOME}/drawing.py -o draw_2D_shad -f ${infileS}_${filetail}.nc        \
382        -S ${values} -v ${var}
383      if test $? -ne 0; then
384        echo ${errormsg}
385        echo "  "${main}": drawing.py fails!"
386        echo python ${PYHOME}/drawing.py -o draw_2D_shad \
387          -f ${infileS}_${filetail}.nc -S ${values} -v ${var}
388        exit
389      else
390        mv 2Dfields_shadow.pdf ${ofold}/figs/${stdn}_hor.pdf
391        if test $vis -eq 1; then evince ${ofold}/figs/${stdn}_hor.pdf & fi
392      fi
393      fi
394
395      if test $doneig -eq 1; then
396# Neighbourghood plot
397      filetail=''
398
399      min=`echo ${varvals} | tr ',' ' ' | awk '{print $5}'`
400      max=`echo ${varvals} | tr ',' ' ' | awk '{print $6}'`
401
402      if test ${vt} = 'dt'; then
403        min='Spercentile@1'
404        max='Spercentile@1'
405      elif test ${vt} = 'st'; then
406        min='Saroundminmax@0.97'
407        max='Saroundminmax@0.97'
408      fi
409
410      if test ${var} = 'LRH2M'; then
411        max='100.'
412      elif test ${var} = 'T2'; then
413        min='270'
414        max='300.'
415      fi
416
417      echo "    min: "${min}" max: "${max}
418
419      values=${stdn}':Time|-1|Times,bottom_top|'${zval}'|ZNU,south_north|'${yval}
420      values=${values}'|XLAT,west_east|'${xval}'|XLONG:south_north,west_east:5:auto:'
421      values=${values}'time|($[DD]^{[HH]}$),time|($[DD]^{[HH]}$):exct,2,h|exct,1,d:'
422      values=${values}'$%d^{%H}$,$%d^{%H}$:5|pts|neighbourghood|temporal|evolution:'
423      values=${values}${min}','${max}':'${cbar}':pdf:False'
424
425      python ${PYHOME}/drawing.py -o draw_Neighbourghood_evol -f ${infile}           \
426        -S ${values} -v ${var}
427      if test $? -ne 0; then
428        echo ${errormsg}
429        echo "  "${main}": drawing.py fails!"
430        echo python ${PYHOME}/drawing.py -o draw_Neighbourghood_evol \
431          -f ${infile} -S ${values} -v ${var}
432        exit
433      else
434        mv Neighbourghood_evol.pdf ${ofold}/figs/${stdn}_Neighbourghood_evol.pdf
435        if test $vis -eq 1; then evince ${ofold}/figs/${stdn}_Neighbourghood_evol.pdf & fi
436      fi
437      fi
438
439#      exit
440    done
441  done
442  fi
443
444# LaTeX file generation
445##
446#
447  if test $dolatex -eq 1; then
448  echo "  LaTeX file '"${otex}"' generation..."
449  if test ${tval} -eq -1; then tvalS='last'; fi
450
451  cat << EOF > ${otex}
452\\documentclass{article}
453\\usepackage{graphicx}
454
455\\textwidth=18cm
456\\textheight=23cm
457\\oddsidemargin=-1cm
458\\evensidemargin=-1cm
459\\topmargin=-1cm
460
461\\begin{document}
462
463\\title{checking LMDZ at time=${tval}, z=${zval}, y=${yval}, x=${xval}}
464\\author{}
465
466\\maketitle
467EOF
468  for vt in ${vtypes}; do
469    echo "variable type: "${vt}
470    case $vt in
471      'dt' )
472        vars=`echo ${dtvariables} | tr ':' ' '`
473        ivar=1
474        for var in ${vars}; do
475          varL=`to_LaTeX ${var}`
476          varvals=`python ${PYHOME}/drawing.py -o variable_values -S LDQ${var} \
477            | grep all_values`
478#          varn=`echo ${varvals} | tr ',' ' ' | awk '{print $3}'`
479          varn=`echo ${var} | tr '[:upper:]' '[:lower:]'`
480          ln=`echo ${varvals} | tr ',' ' ' | awk '{print $7}'`
481          echo "    var: "${varn}
482
483          cat << EOF >> ${otex}
484% d[q/t]_${varn}
485%%
486
487\\begin{figure}
488\\begin{center}
489\\begin{tabular}{cc}
490\\includegraphics[height=0.2\\textheight]{figs/dq${varn}_hor}
491&
492\\includegraphics[height=0.2\\textheight]{figs/dt${varn}_hor}
493\\\\
494\\includegraphics[height=0.2\\textheight]{figs/dq${varn}_Hovmoller}
495&
496\\includegraphics[height=0.2\\textheight]{figs/dt${varn}_Hovmoller}
497\\\\
498\\includegraphics[height=0.2\\textheight]{figs/dq${varn}_TimeSeries}
499&
500\\includegraphics[height=0.2\\textheight]{figs/dt${varn}_TimeSeries}
501\\\\
502\\includegraphics[height=0.2\\textheight]{figs/dq${varn}_Neighbourghood_evol}
503&
504\\includegraphics[height=0.2\\textheight]{figs/dt${varn}_Neighbourghood_evol}
505\\end{tabular}
506EOF
507          if test ${ivar} -eq 1; then
508            firstvar=${varn}
509            caption='\caption{Instantaneaous value at time='${tvalS}', z='${zval}
510            caption=${caption}' level of humidity tendency due to '${varn}' ['${varL}'] (top left)'
511            caption=${caption}', thermal tendency (top right), temporal evolution of '
512            caption=${caption}'the vertical profile at yval='${yval}', xval='${xval}
513            caption=${caption}'humidity tendency (2nd row left), thermal tendency '
514            caption=${caption}'(2nd row right), temporal evolution at the given point'
515            caption=${caption}' (3rd row), evolution of a box of 5x5 centered on the '
516            caption=${caption}'point (bottom)}'
517          else
518            caption='\caption{As in figure \ref{fig:d_qt_'${firstvar}'}, but for '
519            caption=${caption}${varn}' ['${varL}']}'
520          fi
521          cat << EOF >> ${otex}
522${caption}
523\\label{fig:d_qt_${varn}}
524\\end{center}
525\\end{figure}
526EOF
527# LD[U/V]
528##
529          if test ${var} = 'CON' || test ${var} = 'DYN' || test ${var} = 'VDF'; then
530            varvals=`python ${PYHOME}/drawing.py -o variable_values -S LDU${var} \
531              | grep all_values`
532#          varn=`echo ${varvals} | tr ',' ' ' | awk '{print $3}'`
533            varn=`echo ${var} | tr '[:upper:]' '[:lower:]'`
534            ln=`echo ${varvals} | tr ',' ' ' | awk '{print $7}'`
535            echo "    var: "${varn}
536
537            cat << EOF >> ${otex}
538% d[u/v]_${varn}
539%%
540
541\\begin{figure}
542\\begin{center}
543\\begin{tabular}{cc}
544\\includegraphics[height=0.2\\textheight]{figs/du${varn}_hor}
545&
546\\includegraphics[height=0.2\\textheight]{figs/dv${varn}_hor}
547\\\\
548\\includegraphics[height=0.2\\textheight]{figs/du${varn}_Hovmoller}
549&
550\\includegraphics[height=0.2\\textheight]{figs/dv${varn}_Hovmoller}
551\\\\
552\\includegraphics[height=0.2\\textheight]{figs/du${varn}_TimeSeries}
553&
554\\includegraphics[height=0.2\\textheight]{figs/dv${varn}_TimeSeries}
555\\\\
556\\includegraphics[height=0.2\\textheight]{figs/du${varn}_Neighbourghood_evol}
557&
558\\includegraphics[height=0.2\\textheight]{figs/dv${varn}_Neighbourghood_evol}
559\\end{tabular}
560EOF
561            caption='\caption{As in figure \ref{fig:d_qt_'${firstvar}'}, but for '
562            caption=${caption}${varn}'[ '${varL}']}'
563            cat << EOF >> ${otex}
564${caption}
565\\label{fig:d_qu_${varn}}
566\\end{center}
567\\end{figure}
568EOF
569          fi
570          ivar=`expr ${ivar} + 1`
571        done
572cat << EOF >> ${otex}
573\\clearpage
574EOF
575      ;;
576      'sfc' )
577        vars=`echo ${sfcvariables} | tr ':' ' '`
578        ivar=1
579        for var in ${vars}; do
580          varL=`to_LaTeX ${var}`
581          varvals=`python ${PYHOME}/drawing.py -o variable_values -S ${var} \
582            | grep all_values`         
583          varn=`echo ${varvals} | tr ',' ' ' | awk '{print $3}'`
584          echo "    var: "${varn}
585          ln=`echo ${varvals} | tr ',' ' ' | awk '{print $7}'`
586          cat << EOF >> ${otex}
587% ${varn}
588%%
589
590\\begin{figure}
591\\begin{center}
592\\begin{tabular}{ccc}
593\\includegraphics[width=0.33\\textwidth]{figs/${varn}_hor}
594&
595\\includegraphics[width=0.33\\textwidth]{figs/${varn}_TimeSeries}
596&
597\\includegraphics[width=0.33\\textwidth]{figs/${varn}_Neighbourghood_evol}
598\\end{tabular}
599EOF
600          if test ${ivar} -eq 1; then
601            firstvar=${varn}
602            caption='\caption{Instantaneaous value at time='${tvalS}' of '${varn}
603            caption=${caption}' ['${varL}'] (left), temporal evolution at the given point'
604            caption=${caption}' (middle), evolution of a box of 5x5 centered on the '
605            caption=${caption}'point (right)}'
606          else
607             caption='\caption{As in figure \ref{fig:state_'${firstvar}'}, but for '
608             caption=${caption}${varn}' ['${varL}']}'
609          fi
610          cat << EOF >> ${otex}
611${caption}
612\\label{fig:state_${varn}}
613\\end{center}
614\\end{figure}
615EOF
616          ivar=`expr ${ivar} + 1`
617        done
618cat << EOF >> ${otex}
619\\clearpage
620EOF
621      ;;
622      'st' )
623        vars=`echo ${stvariables} | tr ':' ' '`
624        ivar=1
625        for var in ${vars}; do
626          varL=`to_LaTeX ${var}`
627          varvals=`python ${PYHOME}/drawing.py -o variable_values -S ${var} \
628            | grep all_values`         
629          varn=`echo ${varvals} | tr ',' ' ' | awk '{print $3}'`
630          echo "    var: "${varn}
631          ln=`echo ${varvals} | tr ',' ' ' | awk '{print $7}'`
632          cat << EOF >> ${otex}
633% ${varn}
634%%
635
636\\begin{figure}
637\\begin{center}
638\\begin{tabular}{cc}
639\\includegraphics[width=0.5\\textwidth]{figs/${varn}_hor}
640&
641\\includegraphics[width=0.5\\textwidth]{figs/${varn}_Hovmoller}
642\\\\
643\\includegraphics[width=0.5\\textwidth]{figs/${varn}_TimeSeries}
644&
645\\includegraphics[width=0.5\\textwidth]{figs/${varn}_Neighbourghood_evol}
646\\end{tabular}
647EOF
648          if test ${ivar} -eq 1; then
649            firstvar=${varn}
650            caption='\caption{Instantaneaous value at time='${tvalS}', z='${zval}
651            caption=${caption}' level of '${varn}' ['${varL}'] (top left), temporal evolution of the'
652            caption=${caption}' vertical profile at yval='${yval}', xval='${xval}
653            caption=${caption}' (top right), temporal evolution at the given point '
654            caption=${caption}' (bottom left), evolution of a box of 5x5 centered on the '
655            caption=${caption}'point (bottom right)}'
656          else
657             caption='\caption{As in figure \ref{fig:state_'${firstvar}'}, but for '
658             caption=${caption}${varn}' ['${varL}']}'
659          fi
660          cat << EOF >> ${otex}
661${caption}
662\\label{fig:state_${varn}}
663\\end{center}
664\\end{figure}
665EOF
666          ivar=`expr ${ivar} + 1`
667        done
668cat << EOF >> ${otex}
669\\clearpage
670EOF
671      ;;
672    esac
673  done
674  cat << EOF >> ${otex}
675\\end{document}
676EOF
677  otexn=`echo ${filetexn} | tr '.' ' ' | awk '{print $1}'`
678  cd ${ofold}
679  pdflatex ${otexn}
680  pdflatex ${otexn}
681  evince ${otexn}.pdf &
682  cd ${rootsh}
683  fi
684fi
685
Note: See TracBrowser for help on using the repository browser.