source: BOL/Multi_atlas/multi_atlas.sh @ 4318

Last change on this file since 4318 was 4307, checked in by musat, 2 years ago

Fusion entre la version commune (compte fabric) et la version perso
du multi-atlas incluant

  • la fiabilisation de la realisation des cartes
  • la correction des coupes (latitude,altitude) pour les biais
  • l'ajout d'une option pour des multi-atlas par rapport a une simulation de reference
  • l'ajout d'options pour un multi-atlas regional
  • la mise a jour des thredds (repertoire & html) pour ciclad

IonelaMusat?

  • Property svn:executable set to *
File size: 4.6 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
24dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds
25HTML=http://${dthredds}/$login/lmdz/MultiSimu/$comp
26fi
27if [ ${hostname:0:5} = spiri ] ; then
28DODSDIR=/thredds/ipsl
29dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds
30HTML=http://${dthredds}/$login/lmdz/MultiSimu/$comp
31fi
32if [ ${hostname:0:5} = camel ] ; then
33DODSDIR=/thredds/ipsl
34fi
35if [ ${hostname:0:5} = irene ] ; then
36DODSDIR=
37fi
38if [ ${hostname:0:5} = jean- ] ; then
39DODSDIR=
40fi
41
42ATLAS_DIR=$DODSDIR/$login/lmdz/atlas
43COMP_D=$DODSDIR/$login/lmdz/MultiSimu/$comp
44ZON_DIR=$COMP_D/ZON
45
46#############################################################################
47refb=`echo $ref | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'`
48years=`echo $ref | sed -e 's/'$refb'//'`
49echo YEARS $years
50# Le nom semble avoir changé ... sref=$COMP_D/ATLAS/index_${proj}_${season}_${ref}.html
51sref=$COMP_D/ATLAS/index_${proj}_${season}_${ref}.html
52
53sed -i -e "s:thredds\/ipsl:thredds\/fileServer\/ipsl_thredds:g" ${sref}
54#############################################################################
55
56compf=$COMP_D/$bias$proj$season.html
57
58echo $compf
59echo $ref
60emptyelt='<td> - </td>'
61
62
63entete=1
64
65rm -f $compf ; touch $compf
66
67echo PROJ $proj
68echo SEASON $season
69if [ -f $sref ] ; then
70for 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>
99eod
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
147done
148fi
149
150#echo VOTRE MULTIATLAS EST DISPONIBLE SUR $HTML/ACCUEIl.html
Note: See TracBrowser for help on using the repository browser.