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