source: BOL/Multi_atlas/make_html_libigcm.sh @ 3684

Last change on this file since 3684 was 3684, checked in by idelkadi, 4 years ago

Repository under svn of a first version of Multiatlas diagnostics for LMDZ. This version is adapted to be able to run a LMDZ multiatlas on an individual account on the ciclad machine of the IPSL. In this version, the parts to be modified are identified so as to subsequently adapt it to other machines.
This version is still under development.

  • Property svn:executable set to *
File size: 11.6 KB
Line 
1#o!/bin/bash
2# AI mai 2020
3# A REFAIRE PROPREMENT
4# A NETTOYER, ADAPTER AUX AUTRES MACHINES
5
6###########################################################################
7###########################################################################
8# Traitement d'une serie d'experiences se trouvant sur le repertoire
9# $ROOTSTORAGE/$EXPNAME
10# L'organisation des fichiers suit celle de libIGCM
11# Une simulation sera par exemple stokÃee sur
12# $ROOTSTORAGE/$EXPNAME/${run}/ATM/Analyse/${run}_SE_1980_1986_1M_hitsmth.nc
13#                             /ATLAS/Analyse/SE/${run}_base
14# le script cree eventuellement les atlas si ils n'existent pas
15# calcule les valeurs inglobales (flux au sommet, prÃecip ...)
16# publie l'ensemble sur DODS
17# et cree un fichier html pointant vers cette arborescence dods.
18###########################################################################
19###########################################################################
20module load ferret
21
22#set -x
23
24
25comp=COMP
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        --id) CONFIGNAME="${2}"
42                 shift;;
43        --wd) ROOTWORK="${2}"
44                 shift;;
45        --origwww) ROOTWEBORIG="${2}"
46                 shift;;
47        *) echo "make_se.sh: argument non reconnu ${1}"; exit 1;;
48  esac
49  shift
50done
51
52local=`pwd -P`
53
54login=`whoami`
55hostname=`hostname`
56if [ ${hostname:0:5} = cicla ] ; then
57DODSDIR=/prodigfs/ipslfs/dods
58HTML=http://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/$login/lmdz/MultiSimu/$comp
59machine=ciclad
60fi
61if [ ${hostname:0:5} = camel ] ; then
62DODSDIR=/prodigfs/ipslfs/dods
63fi
64if [ ${hostname:0:5} = irene ] ; then
65DODSDIR=
66fi
67if [ ${hostname:0:5} = jean- ] ; then
68DODSDIR=
69fi
70
71tmpdir=$DODSDIR/$login/lmdz
72EXPNAME=B96x95x39/V20090611.dev/
73ROOTWORK=$tmpdir
74ROOTWEBORIG=""
75EXPNAME=IGCM_OUT/$CONFIGNAME/DEVT/clim
76
77STORAGE=$ARCHIVE
78put=mfput
79ROOTWEBatlas=http://dods.idris.fr/$LOGNAME/$EXPNAME
80HTML_D=$ROOTSTORAGE/HTML
81
82if [ "$machine" = "ciclad" ] ; then
83EXPNAME=NPV5LRL79
84put=cp
85CICLAD=$DODSDIR/$login/lmdz
86ARCHIVE=$CICLAD/STORE
87workdir=$CICLAD/WORK
88STORAGE=$CICLAD
89ROOTWEBatlas=http://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/$login/lmdz/STORE/$EXPNAME
90MULTIDIR=/prodigfs/ipslfs/dods/$login/lmdz/MultiSimu
91COMP_D=$MULTIDIR/$comp
92DEF_FILE=$COMP_D/def.txt
93HTML_D=$COMP_D
94runstxt=$local/runs.txt
95fi
96
97
98ROOTSTORAGE=$ARCHIVE/$EXPNAME
99ROOTDODS=DODS/pub/$LOGNAME/$CONFIGNAME
100ROOTWEB="http://dodsp.idris.fr/$LOGNAME/$EXPNAME"
101# http://dods.extra.cea.fr/work/aidel/IGCM_OUT/LMDZOR/DEVT/clim/AR5.0lr/ATM/Analyse/COSP/Calipso/1982-1989
102#ROOTWEB_PROD=http://dods.extra.cea.fr/work/aidel/IGCM_OUT/LMDZOR/DEVT/clim
103ROOTWEB_PROD=http://esgf.extra.cea.fr/thredds/catalog/work/aidel/IGCM_OUT/LMDZOR/DEVT/clim
104ROOTWEB_PROD=https://vesg.ipsl.upmc.fr/thredds/catalog/work/aidel/IGCM_OUT/LMDZOR/DEVT/clim
105ROOTWEB_PROD=https://vesg.ipsl.upmc.fr/thredds/catalog/store_thredds/aidel/IGCM_OUT/LMDZOR/DEVT/clim
106ROOTWEB_PRODout=https://vesg.ipsl.upmc.fr/thredds/catalog/store_thredds/aidel/LMDZOR/DEVT/clim
107#STOREWEB_PROD=http://dods.extra.cea.fr/store/aidel/IGCM_OUT/LMDZOR/DEVT/clim
108#STOREWEB_PROD=http://esgf.extra.cea.fr/thredds/catalog/store/aidel/IGCM_OUT/LMDZOR/DEVT/clim
109STOREWEB_PROD=http://esgf.extra.cea.fr/thredds/catalog/store_thredds/aidel/IGCM_OUT/LMDZOR/DEVT/clim
110STOREWEB_PRODold=http://esgf.extra.cea.fr/thredds/catalog/store/aidel/IGCM_OUT/LMDZOR/DEVT/clim
111#ROOTWEBatlas=http://dods.idris.fr/$LOGNAME/$CONFIGNAME/DEVT/clim
112if [ "$ROOTWEBORIG" = "" ] ; then
113ROOTWEBORIG=ROOTWEBlibigcm
114fi
115
116echo ROOTSTORAGE $ROOTSTORAGE ROOTWEB $ROOTWEB
117 
118glob=1
119
120# Version Abderrahmane/centres de caclcul
121listevar="bils fnet tops topl topl0 crfsw crflw crfnet eva pr prw "
122# Version ciclad multi-atlas
123listevar="bils rt   rst  rlut rlutcs  crest crelt cret eva pr prw "
124listevalvar="7.097 0.7823 240.4 239.6 269.4 -47.05 29.84 -17.21 3.415 2.61 27.46 "
125
126
127###########################################################################
128# CREATION DE L'ENTETE DU FICHIER html
129###########################################################################
130
131# Horrible astuce pour controler a peu pres la longueur des chaines
132# de caractere pour la description des simus
133longn=`wc -lc $DEF_FILE | awk ' { print int ( $2 / $1 / 2 ) } '`
134longc="" ; i=0 ; while [ $i != $longn ] ; do (( i = $i + 1 )) ; longc="$longc"_ ; done
135
136htmlfile=$CICLAD/HTML/tmp.html   ; rm -f $htmlfile ; touch $htmlfile
137errfile=$CICLAD/HTML/tmphtml$$.err ; rm -f $errfile  ; touch $errfile
138D_work=$ROOTWORK/tmp_makehtml$$ ; rm -rf $D_work ; mkdir -p $D_work
139emptyelt='<td> - </td>'
140
141cat <<eod>| $htmlfile
142<table cellpadding="2" cellspacing="2" border="1"
143 style="text-align: left; width: 100px; margin-left: auto;
144margin-right: auto;">
145<tr>
146<td><a href="$HTML/def.txt"> RUN (link to outputs)  </a></td>
147<td> Atlas YEAR</td>
148<td> Atlas --DJF-- </td>
149<td> Atlas --JJA-- </td>
150<td> Description of the simulation $longc </td>
151<td> Period </td>
152<td> Name (link to parameters) </td>
153eod
154
155if [ $glob = 1 ] ; then
156   for var in $listevar ; do
157      echo '<td> '$var' </td>' >> $htmlfile
158   done
159fi
160
161################CLIMATOS##################################################
162echo '<tr>' >> $htmlfile
163echo "<td> CLIMATOS </td>" >> $htmlfile
164echo "<td>        </td>" >> $htmlfile
165echo "<td>        </td>" >> $htmlfile
166echo "<td>        </td>" >> $htmlfile
167echo "<td>        </td>" >> $htmlfile
168echo "<td>        </td>" >> $htmlfile
169echo "<td>        </td>" >> $htmlfile
170if [ $glob = 1 ] ; then
171   for var in $listevalvar ; do
172      echo '<td> '$var' </td>' >> $htmlfile
173   done
174fi
175echo '<tr>' >> $htmlfile
176
177lc=`wc -l $DEF_FILE | awk ' { print $1 } '`
178ll=1
179###########################################################################
180# DEBUT DE LA BOUCLE SUR LES SIMULATIONS
181while [ $ll -le $lc ] ; do
182#for sim in `awk ' {print $1} ' $DEF_FILE` ; do
183    line=`sed -n -e ${ll}p $DEF_FILE`
184    sim=`echo $line | awk ' { print $1 } '`
185    simdir=`grep -w "^$sim "  $runstxt | awk ' { print $2 } '`
186    run=`basename $simdir `
187    years=`echo $line | awk ' { print $2 } '`
188#    years=`grep '^'$run' ' $DEF_FILE | awk ' { print $2 }'`
189    yearsb=`echo $years | sed -e 's/_/-/'`
190    echo run $run
191    echo '<tr>' >> $htmlfile
192###########################################################################
193
194
195
196NCFILE=${run}_SE_${years}_1M_histmth.nc
197
198# AI partie rapat
199#$home/Diagnos_v6/dods_publi.sh $EXPNAME/$run/DEBUG
200#Mettre les sorties sur dods
201#$home/Diagnos_v6/dods_publi.sh $EXPNAME/$run/ATM/Output
202#Mettre les sorties sur dods les restart
203#$home/Diagnos_v6/dods_publi.sh $EXPNAME/$run/RESTART
204
205
206#--------------------------------------------------------------------------
207# Liens vers les fichiers, monitoring et atlas
208#--------------------------------------------------------------------------
209#    echo "<td><a href=\"$ROOTWEBatlas/"$run"\"> "$run" </a></td>" >> $htmlfile
210    echo "<td><a href=\"$ROOTWEB_PRODout/"$run"/catalog.html\"> "$sim" </a></td>" >> $htmlfile
211
212D_SE=$run/ATM/Analyse/SE
213
214echo OK0
215#    if [ -f "$ROOTSTORAGE/$D_SE/$NCFILE" ] ; then
216     if [ 1 = 1 ] ; then
217
218            for SEAS in YEAR DJF JJA ; do
219               echo '<td>' >> $htmlfile
220               for PROJ in GLOB NH SH ; do
221                 atlas=index_${PROJ}_${SEAS}_${run}_$years.html
222                 echo Chemin atlas
223                 echo $COMP_D/ATLAS/$atlas
224                 if [ -f $COMP_D/ATLAS/$atlas ] ; then
225                     atlasf=$COMP_D/ATLAS/$atlas
226                 else # Ancienne version des scripts d'atlas :
227                     atlasf=$ROOTSTORAGE/$run/ATLAS/SE_$years/ATM/$atlas
228                 fi
229# ATTENTION A REFAIRE EN FONCTION DE LA MACHINE
230                 atlas_html=`echo $atlasf | sed -e 's:/prodigfs/ipslfs/dods/:http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/:'`
231                 echo atlas_html $atlas_html
232                 echo atlasf $atlasf
233                 if [ -f $atlasf ] ; then
234                    echo "<a href=\"$atlas_html\"> ${PROJ:0:1} </a>"
235                    echo "<a href=\"$atlas_html\"> ${PROJ:0:1} </a>" >> $htmlfile
236                 else
237                    echo "-" >> $htmlfile
238                    echo Le fichier $atlas_html n\'existe pas
239                 fi
240               done
241               echo '</td>' >> $htmlfile
242            done
243
244
245#--------------------------------------------------------------------------
246    else # Cas ou le fichier histmth.nc n est pas present
247#--------------------------------------------------------------------------
248        echo Le fichier $ROOTSTORAGE/"$run"/$D_SE/$NCFILE n\'existe pas >> $errfile
249        for i in 1 2 3 ; do
250            echo "$emptyelt" >> $htmlfile
251        done
252    fi
253
254# Parametres testes par rapport a la simulation de Ref
255    grep "^$sim "  $DEF_FILE | grep $years | sed -e 's/'$years'//' -e 's/'$sim'/<td>/' -e 's/$/<\/td>/' >> $htmlfile
256    echo '<td> '$years' </td>' >> $htmlfile
257
258    echo "<td><a href=\"$ROOTWEB_PROD/"$run"/catalog.html\"> "$sim" </a></td>" >> $htmlfile
259#--------------------------------------------------------------------------
260# Parametres globaux
261#--------------------------------------------------------------------------
262echo OK0
263   if [ $glob = 1 ] ; then
264      echo OK GGGGGGGGGGGGG $glob
265      listeval=""
266      echo LISTEVAR $listevar
267#      echo NCFILE $NCFILE
268      for var in $listevar ; do
269      echo $ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob
270#          if [ -f "$ROOTSTORAGE/$run/ATM/Analyse/Bilans/$years/${run}_bilans.data" ] ; then
271#           if [ -f "$ROOTWORK/VLR/YEAR/${run}_$years/METRICS/glob" ] ; then
272           if [ -f "$ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob" ] ; then 
273              val=`grep "^$var " $ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob | awk ' { print $2 }' `
274            echo $val
275          else
276              val=.
277          fi
278          listeval="$listeval <td> $val </td>"
279     done
280     echo $listeval
281     echo $listeval >> $htmlfile
282   fi # glob
283echo LISTEVAL $listeval
284
285
286###########################################################################
287# FIN DE LA BOUCLE SUR LES SIMULATIONS
288###########################################################################
289    echo '</tr>' >> $htmlfile
290    (( ll = $ll + 1 ))
291done
292echo $htmlfile
293
294#############################################################################
295# Traitement eventuel des comparaisons
296#############################################################################
297
298echo '<tr>' >> $htmlfile
299
300if [ -f cmp.liste ] ; then
301
302 for cmp in `awk ' { print $1 } ' cmp.liste` ; do
303
304  descr=`grep "$cmp " cmp.liste | awk ' { print $2 } '`
305
306# Rajout des courbes de comparaison entre simulations
307 echo '<tr>' >> $htmlfile
308    echo "<td> $cmp </td>" >> $htmlfile
309    echo "<td><a href=\"$ROOTWEB/$cmp/ATLAS\"> X </a></td>" >> $htmlfile
310    echo "<td> X </td>" >> $htmlfile
311    echo "<td> X </td>" >> $htmlfile
312    echo "<td><a href=\"$ROOTWEB/$cmp/MoyZon/$years/catalog.html\"> "X" </a></td>" >> $htmlfile
313    echo "<td><a href=\"$ROOTWEB/$cmp/CRF/$years/catalog.html\"> "X" </a></td>" >> $htmlfile
314    echo "<td> X  </td>" >> $htmlfile
315    echo "<td> X  </td>" >> $htmlfile
316    echo "<td> X  </td>" >> $htmlfile
317    echo "<td> X  </td>" >> $htmlfile
318    echo "<td> X  </td>" >> $htmlfile
319    echo "<td> $descr </td>" >> $htmlfile
320  echo '</tr>' >> $htmlfile
321
322done
323fi
324
325echo '</table>' >> $htmlfile
326###########################################################################
327
328mkdir -p $HTML_D
329$put $htmlfile $HTML_D/Table_simulations_$comp.html
330echo $put $htmlfile $HTML_D/Table_simulations_$comp.html
331
332#$home/Diagnos_v6/dods_publi.sh $EXPNAME/HTML
Note: See TracBrowser for help on using the repository browser.