| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | #set -v |
|---|
| 4 | |
|---|
| 5 | login=`whoami` |
|---|
| 6 | |
|---|
| 7 | comp=$1 |
|---|
| 8 | bias=$2 |
|---|
| 9 | season=$3 |
|---|
| 10 | proj=$4 |
|---|
| 11 | ref=$5 |
|---|
| 12 | shift ; shift ; shift ; shift ; shift |
|---|
| 13 | |
|---|
| 14 | sims="$*" |
|---|
| 15 | nsims=$# |
|---|
| 16 | echo REF $ref |
|---|
| 17 | echo SIM $sims |
|---|
| 18 | |
|---|
| 19 | login=`whoami` |
|---|
| 20 | |
|---|
| 21 | hostname=`hostname` |
|---|
| 22 | if [ ${hostname:0:5} = cicla ] ; then |
|---|
| 23 | DODSDIR=/thredds/ipsl |
|---|
| 24 | dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds |
|---|
| 25 | HTML=http://${dthredds}/$login/lmdz/MultiSimu/$comp |
|---|
| 26 | fi |
|---|
| 27 | if [ ${hostname:0:5} = spiri ] ; then |
|---|
| 28 | DODSDIR=/thredds/ipsl |
|---|
| 29 | dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds |
|---|
| 30 | HTML=http://${dthredds}/$login/lmdz/MultiSimu/$comp |
|---|
| 31 | fi |
|---|
| 32 | if [ ${hostname:0:5} = camel ] ; then |
|---|
| 33 | DODSDIR=/thredds/ipsl |
|---|
| 34 | fi |
|---|
| 35 | if [ ${hostname:0:5} = irene ] ; then |
|---|
| 36 | DODSDIR= |
|---|
| 37 | fi |
|---|
| 38 | if [ ${hostname:0:5} = jean- ] ; then |
|---|
| 39 | DODSDIR= |
|---|
| 40 | fi |
|---|
| 41 | |
|---|
| 42 | ATLAS_DIR=$DODSDIR/$login/lmdz/atlas |
|---|
| 43 | COMP_D=$DODSDIR/$login/lmdz/MultiSimu/$comp |
|---|
| 44 | ZON_DIR=$COMP_D/ZON |
|---|
| 45 | |
|---|
| 46 | ############################################################################# |
|---|
| 47 | refb=`echo $ref | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
|---|
| 48 | years=`echo $ref | sed -e 's/'$refb'//'` |
|---|
| 49 | echo YEARS $years |
|---|
| 50 | # Le nom semble avoir changé ... sref=$COMP_D/ATLAS/index_${proj}_${season}_${ref}.html |
|---|
| 51 | sref=$COMP_D/ATLAS/index_${proj}_${season}_${ref}.html |
|---|
| 52 | |
|---|
| 53 | sed -i -e "s:thredds\/ipsl:thredds\/fileServer\/ipsl_thredds:g" ${sref} |
|---|
| 54 | ############################################################################# |
|---|
| 55 | |
|---|
| 56 | compf=$COMP_D/$bias$proj$season.html |
|---|
| 57 | |
|---|
| 58 | echo $compf |
|---|
| 59 | echo $ref |
|---|
| 60 | emptyelt='<td> - </td>' |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | entete=1 |
|---|
| 64 | |
|---|
| 65 | rm -f $compf ; touch $compf |
|---|
| 66 | |
|---|
| 67 | echo PROJ $proj |
|---|
| 68 | echo SEASON $season |
|---|
| 69 | if [ -f $sref ] ; then |
|---|
| 70 | for i in `sed -n -e '/TH ALIGN=LEFT.*.li/=' $sref` ; do |
|---|
| 71 | #for i in `sed -n -e '/<TH ALIGN=LEFT> <li>/=' $sref` ; do |
|---|
| 72 | var=`sed -n -e ${i}p $sref | cut -d\( -f2 | cut -d\) -f1` |
|---|
| 73 | echo $i $var |
|---|
| 74 | if [ $entete = 1 ] ; then |
|---|
| 75 | lpdf=`sed -n -e /PDF/= $sref` |
|---|
| 76 | (( lpdfm1 = $lpdf - 1 )) ; (( lpdfp1 = $lpdf + 1 )) ; |
|---|
| 77 | echo $lpdfm1 |
|---|
| 78 | entete=0 |
|---|
| 79 | #head -$lpdfm1 $sref | sed -e '/border-color:transparent/d' -e '/font-size:80/d' >> $compf |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | ############################################################## |
|---|
| 83 | # MENU DEROULANT |
|---|
| 84 | ##############################################################:$ |
|---|
| 85 | cat $COMP_D/entete.html >> $compf |
|---|
| 86 | |
|---|
| 87 | ##################################################################### |
|---|
| 88 | # Fichiers pour l'enetete |
|---|
| 89 | ##################################################################### |
|---|
| 90 | echo '<hr/>' >> $compf |
|---|
| 91 | echo '<h1> Multi atlas, '$season', simulation de référence : '$ref' ('$bias') </h1>' >> $compf |
|---|
| 92 | ##################################################################### |
|---|
| 93 | |
|---|
| 94 | sed -n -e $lpdfp1,${i}p $sref >> $compf |
|---|
| 95 | |
|---|
| 96 | cat <<eod>> $compf |
|---|
| 97 | <TH ALIGN=LEFT>OBSERVATIONS</TH> |
|---|
| 98 | <TH ALIGN=LEFT>$ref</TH> |
|---|
| 99 | eod |
|---|
| 100 | if [ "$bias" = "BIAS" ] ; then echo '<TH ALIGN=LEFT>'$ref' (BIAS)</TH>' >> $compf ; fi |
|---|
| 101 | for sim in $sims ; do |
|---|
| 102 | echo '<TH ALIGN=LEFT>' $sim '</TH>' >> $compf |
|---|
| 103 | done |
|---|
| 104 | echo ' <TR>' >> $compf |
|---|
| 105 | else # entete=1 |
|---|
| 106 | (( iobs = $i + 4 )) |
|---|
| 107 | (( iref = $i + 3 )) |
|---|
| 108 | (( ibiais = $i + 5 )) |
|---|
| 109 | # Repetition des noms des variables |
|---|
| 110 | (( ntext = $nsims / 3 + 1 )) |
|---|
| 111 | iii=1 |
|---|
| 112 | while [ $iii -le $ntext ] ; do |
|---|
| 113 | sed -n -e ${i}p $sref | sed -e 's:^:<th></th>:' -e 's/LEFT/LEFT colspan="2"/' >> $compf |
|---|
| 114 | (( iii = $iii + 1 )) |
|---|
| 115 | done |
|---|
| 116 | echo ' <TR>' >> $compf |
|---|
| 117 | # Inclusion des moyennes zonales |
|---|
| 118 | if [ -f $ZON_DIR/${var}zon.png ] ; then |
|---|
| 119 | thredds=/thredds/fileServer/ipsl_thredds/fabric/lmdz/MultiSimu/$comp/ZON/${var}zon.png |
|---|
| 120 | echo '<TD ALIGN=RIGHT><A HREF="'$thredds'"><IMG HEIGHT=200 WIDTH=200 SRC="'$thredds'"></a></TD>' >> $compf |
|---|
| 121 | else |
|---|
| 122 | echo $emptyelt >> $compf |
|---|
| 123 | fi |
|---|
| 124 | |
|---|
| 125 | sed -n -e ${iobs}p $sref >> $compf |
|---|
| 126 | sed -n -e ${iref}p $sref >> $compf |
|---|
| 127 | if [ "$bias" = "BIAS" ] ; then sed -n -e ${ibiais}p $sref >> $compf ; fi |
|---|
| 128 | for sim in $sims ; do |
|---|
| 129 | ######################################################### |
|---|
| 130 | simb=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
|---|
| 131 | years=`echo $sim | sed -e 's/'$simb'//'` |
|---|
| 132 | index=$COMP_D/ATLAS/index_${proj}_${season}_${sim}.html |
|---|
| 133 | # if [ -f $index ] ; then |
|---|
| 134 | is=`sed -n -e '/<TH ALIGN=LEFT> <li.*.('$var')/=' $index | head -1` |
|---|
| 135 | echo $sim $var $is |
|---|
| 136 | ######################################################### |
|---|
| 137 | if [ "$is" = "" ] ; then |
|---|
| 138 | echo '<td> Missing </td>' >> $compf |
|---|
| 139 | else |
|---|
| 140 | if [ "$bias" = "BIAS" ] ; then (( isbiais = $is + 5 )) ; else (( isbiais = $is + 3 )) ; fi |
|---|
| 141 | sed -n -e ${isbiais}p $index >> $compf |
|---|
| 142 | fi |
|---|
| 143 | # fi |
|---|
| 144 | done |
|---|
| 145 | echo ' <TR>' >> $compf |
|---|
| 146 | fi |
|---|
| 147 | done |
|---|
| 148 | fi |
|---|
| 149 | |
|---|
| 150 | #echo VOTRE MULTIATLAS EST DISPONIBLE SUR $HTML/ACCUEIl.html |
|---|