source: BOL/Multi_atlas/multi_atlas.sh @ 3885

Last change on this file since 3885 was 3881, checked in by musat, 3 years ago

Changement des PATHS sur ciclad

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