source: BOL/Multi_atlas/multi_atlas.sh @ 4470

Last change on this file since 4470 was 4341, checked in by musat, 21 months ago

Inclut environnement spirit et dernieres corrections (2/3)
IonelaMusat?

  • Property svn:executable set to *
File size: 4.8 KB
RevLine 
[3684]1#!/bin/bash
2
[3745]3#set -v
[3684]4
[4341]5source ~/env_Multi_atlas.sh
6
[3697]7login=`whoami`
8
[3684]9comp=$1
10bias=$2
11season=$3
12proj=$4
[4341]13dref=$5
14ref=$6
[3684]15
[4341]16shift ; shift ; shift ; shift ; shift ; shift
17
[3684]18sims="$*"
[4341]19echo sims are: $sims
20
[3684]21nsims=$#
[4341]22echo REF $dref
23#echo SIM $sims
24echo SIM are $ref
25#sims="$ref $sims"
26#echo sims are: $sims
[3684]27
[4341]28if [ 1 == 0 ]; then
[3684]29login=`whoami`
30hostname=`hostname`
31if [ ${hostname:0:5} = cicla ] ; then
[3881]32DODSDIR=/thredds/ipsl
[4307]33dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds
34HTML=http://${dthredds}/$login/lmdz/MultiSimu/$comp
[3684]35fi
[4307]36if [ ${hostname:0:5} = spiri ] ; then
37DODSDIR=/thredds/ipsl
38dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds
39HTML=http://${dthredds}/$login/lmdz/MultiSimu/$comp
40fi
[3684]41if [ ${hostname:0:5} = camel ] ; then
[3881]42DODSDIR=/thredds/ipsl
[3684]43fi
44if [ ${hostname:0:5} = irene ] ; then
45DODSDIR=
46fi
47if [ ${hostname:0:5} = jean- ] ; then
48DODSDIR=
49fi
[4341]50fi
[3684]51
52ATLAS_DIR=$DODSDIR/$login/lmdz/atlas
53COMP_D=$DODSDIR/$login/lmdz/MultiSimu/$comp
54ZON_DIR=$COMP_D/ZON
55
56#############################################################################
57refb=`echo $ref | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'`
58years=`echo $ref | sed -e 's/'$refb'//'`
59echo YEARS $years
60# Le nom semble avoir changé ... sref=$COMP_D/ATLAS/index_${proj}_${season}_${ref}.html
61sref=$COMP_D/ATLAS/index_${proj}_${season}_${ref}.html
[3915]62
[4307]63sed -i -e "s:thredds\/ipsl:thredds\/fileServer\/ipsl_thredds:g" ${sref}
[3684]64#############################################################################
65
66compf=$COMP_D/$bias$proj$season.html
67
68echo $compf
69echo $ref
70emptyelt='<td> - </td>'
71
72
73entete=1
74
75rm -f $compf ; touch $compf
76
77echo PROJ $proj
78echo SEASON $season
[4341]79#if [ -f $sref ] ; then
[3684]80for 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>
109eod
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
157done
[4341]158#fi
[3684]159
[3745]160#echo VOTRE MULTIATLAS EST DISPONIBLE SUR $HTML/ACCUEIl.html
Note: See TracBrowser for help on using the repository browser.