source: BOL/Multi_atlas/make_html_libigcm.sh @ 4314

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

Correction login
IonelaMusat?

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