source: BOL/Multi_atlas/make_html_libigcm.sh @ 4942

Last change on this file since 4942 was 4341, checked in by musat, 20 months ago

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

  • Property svn:executable set to *
File size: 10.0 KB
Line 
1#!/bin/bash
2
3#set -x
4
5source ~/env_Multi_atlas.sh
6
7###########################################################################
8###########################################################################
9# Traitement d'une serie d'experiences se trouvant sur le repertoire
10# $ROOTSTORAGE/$EXPNAME
11# L'organisation des fichiers suit celle de libIGCM
12# Une simulation sera par exemple stokÃee sur
13# $ROOTSTORAGE/$EXPNAME/${run}/ATM/Analyse/${run}_SE_1980_1986_1M_hitsmth.nc
14#                             /ATLAS/Analyse/SE/${run}_base
15# le script cree eventuellement les atlas si ils n'existent pas
16# calcule les valeurs inglobales (flux au sommet, prÃecip ...)
17# publie l'ensemble sur DODS
18# et cree un fichier html pointant vers cette arborescence dods.
19###########################################################################
20###########################################################################
21
22logname=aidel
23comp=COMP
24EXPNAME=NPV5LRL79
25put=cp
26
27helptext="
28        --help Ce manuel
29        --run Nom de la simulation
30        --id  Nom du repertoire contenant la simuation a partir de $STORAGE
31        --wd  Nom du repetoire temporaire
32        --origwww Au cas ou les simulations viennent d ailleurs
33"
34
35while test -n "${1}"; do
36  case "${1}" in
37        --help) echo "$helptext";
38            exit 0;;
39        --comp) comp="${2}"
40                 shift;;
41        --runstxt) runstxt="${2}" 
42                 shift ;;
43        --id) CONFIGNAME="${2}"
44                 shift;;
45        --wd) ROOTWORK="${2}"
46                 shift;;
47        --origwww) ROOTWEBORIG="${2}"
48                 shift;;
49        *) echo "make_se.sh: argument non reconnu ${1}"; exit 1;;
50  esac
51  shift
52done
53
54HTML=http://${dthredds}/$login/lmdz/MultiSimu/$comp
55MULTIDIR=${DODSDIR}/${login}/lmdz/MultiSimu
56COMP_D=$MULTIDIR/$comp
57DEF_FILE=$COMP_D/def.txt
58HTML_D=$COMP_D
59CICLAD=/thredds/ipsl/${login}/lmdz
60ROOTWORK=$CICLAD
61
62####################################################################
63glob=1
64
65# Version Abderrahmane/centres de caclcul
66listevar="bils fnet tops topl topl0 crfsw crflw crfnet eva pr prw "
67# Version ciclad multi-atlas
68listevar="bils rt   rst  rlut rlutcs  crest crelt cret eva pr prw "
69listevalvar="7.097 0.7823 240.4 239.6 269.4 -47.05 29.84 -17.21 3.415 2.61 27.46 "
70
71
72###########################################################################
73# CREATION DE L'ENTETE DU FICHIER html
74###########################################################################
75
76# Horrible astuce pour controler a peu pres la longueur des chaines
77# de caractere pour la description des simus
78longn=`wc -lc $DEF_FILE | awk ' { print int ( $2 / $1 / 2 ) } '`
79longc="" ; i=0 ; while [ $i != $longn ] ; do (( i = $i + 1 )) ; longc="$longc"_ ; done
80
81htmlfile=$CICLAD/HTML/tmp.html   ; rm -f $htmlfile ; touch $htmlfile
82errfile=$CICLAD/HTML/tmphtml$$.err ; rm -f $errfile  ; touch $errfile
83D_work=$ROOTWORK/tmp_makehtml$$ ; rm -rf $D_work ; mkdir -p $D_work
84emptyelt='<td> - </td>'
85
86cat <<eod>| $htmlfile
87<table cellpadding="2" cellspacing="2" border="1"
88 style="text-align: left; width: 100px; margin-left: auto;
89margin-right: auto;">
90<tr>
91<td><a href="https://thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds/${login}/lmdz/MultiSimu/$comp/def.txt"> RUN (link to outputs)  </a></td>
92<td> Atlas YEAR</td>
93<td> Atlas --DJF-- </td>
94<td> Atlas --JJA-- </td>
95<td> Atlas --MAM-- </td>
96<td> Atlas --SON-- </td>
97<td> Description of the simulation $longc </td>
98<td> Period </td>
99<td> Name (link to parameters) </td>
100eod
101
102if [ $glob = 1 ] ; then
103   for var in $listevar ; do
104      echo '<td> '$var' </td>' >> $htmlfile
105   done
106fi
107
108################CLIMATOS##################################################
109echo '<tr>' >> $htmlfile
110echo "<td> CLIMATOS </td>" >> $htmlfile
111echo "<td>        </td>" >> $htmlfile
112echo "<td>        </td>" >> $htmlfile
113echo "<td>        </td>" >> $htmlfile
114echo "<td>        </td>" >> $htmlfile
115echo "<td>        </td>" >> $htmlfile
116echo "<td>        </td>" >> $htmlfile
117echo "<td>        </td>" >> $htmlfile
118echo "<td>        </td>" >> $htmlfile
119if [ $glob = 1 ] ; then
120   for var in $listevalvar ; do
121      echo '<td> '$var' </td>' >> $htmlfile
122   done
123fi
124echo '<tr>' >> $htmlfile
125
126lc=`wc -l $DEF_FILE | awk ' { print $1 } '`
127ll=1
128###########################################################################
129# DEBUT DE LA BOUCLE SUR LES SIMULATIONS
130while [ $ll -le $lc ] ; do
131#for sim in `awk ' {print $1} ' $DEF_FILE` ; do
132    line=`sed -n -e ${ll}p $DEF_FILE`
133    sim=`echo $line | awk ' { print $1 } '`
134    simdir=`grep -w "^$sim "  $runstxt | awk ' { print $2 } '`
135    echo simdir $simdir
136    run=`basename $simdir `
137    years=`echo $line | awk ' { print $2 } '`
138#    years=`grep '^'$run' ' $DEF_FILE | awk ' { print $2 }'`
139    yearsb=`echo $years | sed -e 's/_/-/'`
140    echo run $run
141    echo '<tr>' >> $htmlfile
142###########################################################################
143
144
145
146NCFILE=${run}_SE_${years}_1M_histmth.nc
147
148# AI partie rapat
149#$home/Diagnos_v6/dods_publi.sh $EXPNAME/$run/DEBUG
150#Mettre les sorties sur dods
151#$home/Diagnos_v6/dods_publi.sh $EXPNAME/$run/ATM/Output
152#Mettre les sorties sur dods les restart
153#$home/Diagnos_v6/dods_publi.sh $EXPNAME/$run/RESTART
154
155
156#--------------------------------------------------------------------------
157# Liens vers les fichiers, monitoring et atlas
158#--------------------------------------------------------------------------
159#    echo "<td><a href=\"$ROOTWEBatlas/"$run"\"> "$run" </a></td>" >> $htmlfile
160    echo "<td><a href=\"$ROOTWEB_PRODout/"$run"/catalog.html\"> "$sim" </a></td>" >> $htmlfile
161
162D_SE=$run/ATM/Analyse/SE
163
164echo OK0
165#    if [ -f "$ROOTSTORAGE/$D_SE/$NCFILE" ] ; then
166     if [ 1 = 1 ] ; then
167
168            for SEAS in YEAR DJF JJA MAM SON ; do
169               echo '<td>' >> $htmlfile
170               for PROJ in GLOB NH SH ; do
171                 atlas=index_${PROJ}_${SEAS}_${run}_$years.html
172                 echo Chemin atlas
173                 echo $COMP_D/ATLAS/$atlas
174                 if [ -f $COMP_D/ATLAS/$atlas ] ; then
175                     atlasf=$COMP_D/ATLAS/$atlas
176                 else # Ancienne version des scripts d'atlas :
177                     atlasf=$ROOTSTORAGE/$run/ATLAS/SE_$years/ATM/$atlas
178                 fi
179                 ###atlas_html=`echo $atlasf | sed -e 's:/thredds/ipsl/:http\://thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds/:'`
180                 atlas_html=`echo $atlasf | sed -e 's:/thredds/ipsl/:http\://thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds/:'`
181                 echo atlas_html $atlas_html
182                 echo atlasf $atlasf
183                 if [ -f $atlasf ] ; then
184                    echo "<a href=\"$atlas_html\"> ${PROJ:0:1} </a>"
185                    echo "<a href=\"$atlas_html\"> ${PROJ:0:1} </a>" >> $htmlfile
186                 else
187                    echo "-" >> $htmlfile
188                    echo Le fichier $atlas_html n\'existe pas
189                 fi
190               done
191               echo '</td>' >> $htmlfile
192            done
193
194
195#--------------------------------------------------------------------------
196    else # Cas ou le fichier histmth.nc n est pas present
197#--------------------------------------------------------------------------
198        echo Le fichier $ROOTSTORAGE/"$run"/$D_SE/$NCFILE n\'existe pas >> $errfile
199        for i in 1 2 3 ; do
200            echo "$emptyelt" >> $htmlfile
201        done
202    fi
203
204# Parametres testes par rapport a la simulation de Ref
205    grep "^$sim "  $DEF_FILE | grep $years | sed -e 's/'$years'//' -e 's/'$sim'/<td>/' -e 's/$/<\/td>/' >> $htmlfile
206    echo '<td> '$years' </td>' >> $htmlfile
207
208    echo "<td><a href=\"$ROOTWEB_PROD/"$run"/catalog.html\"> "$sim" </a></td>" >> $htmlfile
209#--------------------------------------------------------------------------
210# Parametres globaux
211#--------------------------------------------------------------------------
212echo OK0
213   if [ $glob = 1 ] ; then
214      echo OK GGGGGGGGGGGGG $glob
215      listeval=""
216      echo LISTEVAR $listevar
217#      echo NCFILE $NCFILE
218      for var in $listevar ; do
219      echo $ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob
220#          if [ -f "$ROOTSTORAGE/$run/ATM/Analyse/Bilans/$years/${run}_bilans.data" ] ; then
221#           if [ -f "$ROOTWORK/VLR/YEAR/${run}_$years/METRICS/glob" ] ; then
222           if [ -f "$ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob" ] ; then 
223              val=`grep "^$var " $ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob | awk ' { print $2 }' `
224            echo $val
225          else
226              val=.
227          fi
228          listeval="$listeval <td> $val </td>"
229     done
230     echo $listeval
231     echo $listeval >> $htmlfile
232   fi # glob
233echo LISTEVAL $listeval
234
235
236###########################################################################
237# FIN DE LA BOUCLE SUR LES SIMULATIONS
238###########################################################################
239    echo '</tr>' >> $htmlfile
240    (( ll = $ll + 1 ))
241done
242echo $htmlfile
243
244#############################################################################
245# Traitement eventuel des comparaisons
246#############################################################################
247
248echo '<tr>' >> $htmlfile
249
250if [ -f cmp.liste ] ; then
251
252 for cmp in `awk ' { print $1 } ' cmp.liste` ; do
253
254  descr=`grep "$cmp " cmp.liste | awk ' { print $2 } '`
255
256# Rajout des courbes de comparaison entre simulations
257 echo '<tr>' >> $htmlfile
258    echo "<td> $cmp </td>" >> $htmlfile
259    echo "<td><a href=\"$ROOTWEB/$cmp/ATLAS\"> X </a></td>" >> $htmlfile
260    echo "<td> X </td>" >> $htmlfile
261    echo "<td> X </td>" >> $htmlfile
262    echo "<td><a href=\"$ROOTWEB/$cmp/MoyZon/$years/catalog.html\"> "X" </a></td>" >> $htmlfile
263    echo "<td><a href=\"$ROOTWEB/$cmp/CRF/$years/catalog.html\"> "X" </a></td>" >> $htmlfile
264    echo "<td> X  </td>" >> $htmlfile
265    echo "<td> X  </td>" >> $htmlfile
266    echo "<td> X  </td>" >> $htmlfile
267    echo "<td> X  </td>" >> $htmlfile
268    echo "<td> X  </td>" >> $htmlfile
269    echo "<td> $descr </td>" >> $htmlfile
270  echo '</tr>' >> $htmlfile
271
272done
273fi
274
275echo '</table>' >> $htmlfile
276###########################################################################
277
278mkdir -p $HTML_D
279$put $htmlfile $HTML_D/Table_simulations_$comp.html
280echo $put $htmlfile $HTML_D/Table_simulations_$comp.html
281
282#$home/Diagnos_v6/dods_publi.sh $EXPNAME/HTML
Note: See TracBrowser for help on using the repository browser.