Changeset 230 in lmdz_wrf
- Timestamp:
- Jan 30, 2015, 4:33:33 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/lmdz_check.bash
r226 r230 1 #!/bin/bash 1 #!/bin/bash 2 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 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 … … 18 18 echo " [visualize]: 0, no; 1: yes, whether to visualize results" 19 19 else 20 21 function 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 20 90 rootsh=`pwd` 21 91 errmsg='ERROR -- error -- ERROR -- error' … … 31 101 32 102 # To paint figures 33 draw= 1103 draw=0 34 104 35 105 # To generate Hovmoller graph … … 58 128 kvalues='2dh:hovz:tevol' 59 129 60 otex=${ofold}'/lmdz_check.tex' 130 filetexn='lmdz_check.tex' 131 otex=${ofold}'/'${filetexn} 61 132 ####### ###### ##### #### ### ## # 62 133 # Levels to interpolate … … 402 473 ivar=1 403 474 for var in ${vars}; do 475 varL=`to_LaTeX ${var}` 404 476 varvals=`python ${PYHOME}/drawing.py -o variable_values -S LDQ${var} \ 405 477 | grep all_values` … … 436 508 firstvar=${varn} 437 509 caption='\caption{Instantaneaous value at time='${tvalS}', z='${zval} 438 caption=${caption}' level of humidity tendency due to '${varn}' (top left)'510 caption=${caption}' level of humidity tendency due to '${varn}' ['${varL}'] (top left)' 439 511 caption=${caption}', thermal tendency (top right), temporal evolution of ' 440 512 caption=${caption}'the vertical profile at yval='${yval}', xval='${xval} … … 445 517 else 446 518 caption='\caption{As in figure \ref{fig:d_qt_'${firstvar}'}, but for ' 447 caption=${caption}${varn}' }'519 caption=${caption}${varn}' ['${varL}']}' 448 520 fi 449 521 cat << EOF >> ${otex} … … 488 560 EOF 489 561 caption='\caption{As in figure \ref{fig:d_qt_'${firstvar}'}, but for ' 490 caption=${caption}${varn}' }'562 caption=${caption}${varn}'[ '${varL}']}' 491 563 cat << EOF >> ${otex} 492 564 ${caption} … … 506 578 ivar=1 507 579 for var in ${vars}; do 580 varL=`to_LaTeX ${var}` 508 581 varvals=`python ${PYHOME}/drawing.py -o variable_values -S ${var} \ 509 582 | grep all_values` 510 583 varn=`echo ${varvals} | tr ',' ' ' | awk '{print $3}'` 584 echo " var: "${varn} 511 585 ln=`echo ${varvals} | tr ',' ' ' | awk '{print $7}'` 512 586 cat << EOF >> ${otex} … … 527 601 firstvar=${varn} 528 602 caption='\caption{Instantaneaous value at time='${tvalS}' of '${varn} 529 caption=${caption}' (left), temporal evolution at the given point'603 caption=${caption}' ['${varL}'] (left), temporal evolution at the given point' 530 604 caption=${caption}' (middle), evolution of a box of 5x5 centered on the ' 531 605 caption=${caption}'point (right)}' 532 606 else 533 607 caption='\caption{As in figure \ref{fig:state_'${firstvar}'}, but for ' 534 caption=${caption}${varn}' }'608 caption=${caption}${varn}' ['${varL}']}' 535 609 fi 536 610 cat << EOF >> ${otex} … … 550 624 ivar=1 551 625 for var in ${vars}; do 626 varL=`to_LaTeX ${var}` 552 627 varvals=`python ${PYHOME}/drawing.py -o variable_values -S ${var} \ 553 628 | grep all_values` 554 629 varn=`echo ${varvals} | tr ',' ' ' | awk '{print $3}'` 630 echo " var: "${varn} 555 631 ln=`echo ${varvals} | tr ',' ' ' | awk '{print $7}'` 556 632 cat << EOF >> ${otex} … … 573 649 firstvar=${varn} 574 650 caption='\caption{Instantaneaous value at time='${tvalS}', z='${zval} 575 caption=${caption}' level of '${varn}' (top left), temporal evolution of the'651 caption=${caption}' level of '${varn}' ['${varL}'] (top left), temporal evolution of the' 576 652 caption=${caption}' vertical profile at yval='${yval}', xval='${xval} 577 653 caption=${caption}' (top right), temporal evolution at the given point ' … … 580 656 else 581 657 caption='\caption{As in figure \ref{fig:state_'${firstvar}'}, but for ' 582 caption=${caption}${varn}' }'658 caption=${caption}${varn}' ['${varL}']}' 583 659 fi 584 660 cat << EOF >> ${otex} … … 599 675 \\end{document} 600 676 EOF 601 otexn=`echo ${ otex} | tr '.' ' ' | awk '{print $1}'`677 otexn=`echo ${filetexn} | tr '.' ' ' | awk '{print $1}'` 602 678 cd ${ofold} 603 679 pdflatex ${otexn}
Note: See TracChangeset
for help on using the changeset viewer.