source: BOL/Multi_atlas/multi_atlas.sh @ 4221

Last change on this file since 4221 was 3915, checked in by musat, 3 years ago

Corrections pour la realisation et l'acceleration des cartes des multi-atlas
IM

  • Property svn:executable set to *
File size: 4.4 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
47sed -i -e "s:thredds\/ipsl:thredds\/fileServer\/IPSLFS:g" ${sref}
48#############################################################################
49
50compf=$COMP_D/$bias$proj$season.html
51
52echo $compf
53echo $ref
54emptyelt='<td> - </td>'
55
56
57entete=1
58
59rm -f $compf ; touch $compf
60
61echo PROJ $proj
62echo SEASON $season
63if [ -f $sref ] ; then
64for i in `sed -n -e '/TH ALIGN=LEFT.*.li/=' $sref` ; do
65#for i in `sed -n -e '/<TH ALIGN=LEFT> <li>/=' $sref` ; do
66   var=`sed -n -e ${i}p $sref | cut -d\( -f2 | cut -d\) -f1`
67   echo $i $var
68   if [ $entete = 1 ] ; then
69      lpdf=`sed -n -e /PDF/= $sref`
70      (( lpdfm1 = $lpdf - 1 )) ; (( lpdfp1 = $lpdf + 1 )) ; 
71      echo $lpdfm1
72      entete=0
73      #head -$lpdfm1 $sref | sed -e '/border-color:transparent/d' -e '/font-size:80/d' >> $compf
74
75
76      ##############################################################
77      # MENU DEROULANT
78      ##############################################################:$
79      cat $COMP_D/entete.html >> $compf
80 
81      #####################################################################
82      # Fichiers pour l'enetete
83      #####################################################################
84      echo '<hr/>' >> $compf
85      echo '<h1> Multi atlas, '$season', simulation de référence : '$ref' ('$bias') </h1>' >> $compf
86     #####################################################################
87
88       sed -n -e $lpdfp1,${i}p $sref >> $compf 
89
90      cat <<eod>> $compf
91<TH ALIGN=LEFT>OBSERVATIONS</TH>
92<TH ALIGN=LEFT>$ref</TH>
93eod
94      if [ "$bias" = "BIAS" ] ; then echo '<TH ALIGN=LEFT>'$ref' (BIAS)</TH>' >> $compf ; fi
95      for sim in $sims ; do
96         echo '<TH ALIGN=LEFT>' $sim '</TH>' >> $compf
97      done
98      echo ' <TR>' >> $compf
99   else # entete=1
100      (( iobs   = $i + 4 ))
101      (( iref   = $i + 3 ))
102      (( ibiais = $i + 5 ))
103      # Repetition des noms des variables
104      (( ntext = $nsims / 3 + 1 ))
105      iii=1
106      while [ $iii -le $ntext ] ; do
107         sed -n -e ${i}p $sref | sed -e 's:^:<th></th>:' -e 's/LEFT/LEFT colspan="2"/' >> $compf
108         (( iii = $iii + 1 ))
109      done
110      echo ' <TR>' >> $compf
111      # Inclusion des moyennes zonales
112      if [ -f $ZON_DIR/${var}zon.png ] ; then 
113          thredds=/thredds/fileServer/IPSLFS/fabric/lmdz/MultiSimu/$comp/ZON/${var}zon.png
114          echo '<TD ALIGN=RIGHT><A HREF="'$thredds'"><IMG HEIGHT=200 WIDTH=200 SRC="'$thredds'"></a></TD>' >> $compf
115      else
116          echo $emptyelt >> $compf
117      fi
118
119      sed -n -e ${iobs}p $sref >> $compf
120      sed -n -e ${iref}p $sref >> $compf
121      if [ "$bias" = "BIAS" ] ; then sed -n -e ${ibiais}p $sref >> $compf ; fi
122      for sim in $sims ; do
123         #########################################################
124         simb=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'`
125         years=`echo $sim | sed -e 's/'$simb'//'`
126         index=$COMP_D/ATLAS/index_${proj}_${season}_${sim}.html
127#        if [ -f $index ] ; then
128         is=`sed -n -e '/<TH ALIGN=LEFT> <li.*.('$var')/=' $index | head -1`
129         echo $sim $var $is
130         #########################################################
131         if [ "$is" = "" ] ; then
132            echo '<td> Missing </td>' >> $compf
133         else
134            if [ "$bias" = "BIAS" ] ; then (( isbiais = $is + 5 )) ; else (( isbiais = $is + 3 )) ; fi
135            sed -n -e ${isbiais}p $index >> $compf
136         fi
137#        fi
138      done
139      echo ' <TR>' >> $compf
140   fi
141done
142fi
143
144#echo VOTRE MULTIATLAS EST DISPONIBLE SUR $HTML/ACCUEIl.html
Note: See TracBrowser for help on using the repository browser.