source: BOL/Multi_atlas/make_html_libigcm.sh @ 3694

Last change on this file since 3694 was 3694, 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.
Corrections.

  • Property svn:executable set to *
File size: 10.4 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"
101ROOTWEB_PRODout=https://vesg.ipsl.upmc.fr/thredds/catalog/store_thredds/aidel/LMDZOR/DEVT/clim
102STOREWEB_PROD=http://esgf.extra.cea.fr/thredds/catalog/store_thredds/aidel/IGCM_OUT/LMDZOR/DEVT/clim
103STOREWEB_PRODold=http://esgf.extra.cea.fr/thredds/catalog/store/aidel/IGCM_OUT/LMDZOR/DEVT/clim
104if [ "$ROOTWEBORIG" = "" ] ; then
105ROOTWEBORIG=ROOTWEBlibigcm
106fi
107
108echo ROOTSTORAGE $ROOTSTORAGE ROOTWEB $ROOTWEB
109 
110glob=1
111
112# Version Abderrahmane/centres de caclcul
113listevar="bils fnet tops topl topl0 crfsw crflw crfnet eva pr prw "
114# Version ciclad multi-atlas
115listevar="bils rt   rst  rlut rlutcs  crest crelt cret eva pr prw "
116listevalvar="7.097 0.7823 240.4 239.6 269.4 -47.05 29.84 -17.21 3.415 2.61 27.46 "
117
118
119###########################################################################
120# CREATION DE L'ENTETE DU FICHIER html
121###########################################################################
122
123# Horrible astuce pour controler a peu pres la longueur des chaines
124# de caractere pour la description des simus
125longn=`wc -lc $DEF_FILE | awk ' { print int ( $2 / $1 / 2 ) } '`
126longc="" ; i=0 ; while [ $i != $longn ] ; do (( i = $i + 1 )) ; longc="$longc"_ ; done
127
128if [ ! -d $STORAGE/HTML ] ; then mkdir -p $STORAGE/HTML ; fi
129htmlfile=$STORAGE/HTML/tmp.html   ; rm -f $htmlfile ; touch $htmlfile
130errfile=$STORAGE/HTML/tmphtml$$.err ; rm -f $errfile  ; touch $errfile
131D_work=$ROOTWORK/tmp_makehtml$$ ; rm -rf $D_work ; mkdir -p $D_work
132emptyelt='<td> - </td>'
133cat <<eod>| $htmlfile
134<table cellpadding="2" cellspacing="2" border="1"
135 style="text-align: left; width: 100px; margin-left: auto;
136margin-right: auto;">
137<tr>
138<td><a href="$HTML/def.txt"> RUN (link to outputs)  </a></td>
139<td> Atlas YEAR</td>
140<td> Atlas --DJF-- </td>
141<td> Atlas --JJA-- </td>
142<td> Description of the simulation $longc </td>
143<td> Period </td>
144<td> Name (link to parameters) </td>
145eod
146
147if [ $glob = 1 ] ; then
148   for var in $listevar ; do
149      echo '<td> '$var' </td>' >> $htmlfile
150   done
151fi
152
153################CLIMATOS##################################################
154echo '<tr>' >> $htmlfile
155echo "<td> CLIMATOS </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
162if [ $glob = 1 ] ; then
163   for var in $listevalvar ; do
164      echo '<td> '$var' </td>' >> $htmlfile
165   done
166fi
167echo '<tr>' >> $htmlfile
168
169lc=`wc -l $DEF_FILE | awk ' { print $1 } '`
170ll=1
171###########################################################################
172# DEBUT DE LA BOUCLE SUR LES SIMULATIONS
173while [ $ll -le $lc ] ; do
174#for sim in `awk ' {print $1} ' $DEF_FILE` ; do
175    line=`sed -n -e ${ll}p $DEF_FILE`
176    sim=`echo $line | awk ' { print $1 } '`
177    simdir=`grep -w "^$sim "  $runstxt | awk ' { print $2 } '`
178    run=`basename $simdir `
179    years=`echo $line | awk ' { print $2 } '`
180    yearsb=`echo $years | sed -e 's/_/-/'`
181    echo run $run
182    echo '<tr>' >> $htmlfile
183###########################################################################
184
185
186
187NCFILE=${run}_SE_${years}_1M_histmth.nc
188
189#--------------------------------------------------------------------------
190# Liens vers les fichiers, monitoring et atlas
191#--------------------------------------------------------------------------
192    echo "<td><a href=\"$ROOTWEB_PRODout/"$run"/catalog.html\"> "$sim" </a></td>" >> $htmlfile
193
194D_SE=$run/ATM/Analyse/SE
195
196echo OK0
197#    if [ -f "$ROOTSTORAGE/$D_SE/$NCFILE" ] ; then
198     if [ 1 = 1 ] ; then
199
200            for SEAS in YEAR DJF JJA ; do
201               echo '<td>' >> $htmlfile
202               for PROJ in GLOB NH SH ; do
203                 atlas=index_${PROJ}_${SEAS}_${run}_$years.html
204                 echo Chemin atlas
205                 echo $COMP_D/ATLAS/$atlas
206                 if [ -f $COMP_D/ATLAS/$atlas ] ; then
207                     atlasf=$COMP_D/ATLAS/$atlas
208                 else # Ancienne version des scripts d'atlas :
209                     atlasf=$ROOTSTORAGE/$run/ATLAS/SE_$years/ATM/$atlas
210                 fi
211# ATTENTION A REFAIRE EN FONCTION DE LA MACHINE
212                 atlas_html=`echo $atlasf | sed -e 's:/prodigfs/ipslfs/dods/:http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/:'`
213                 echo atlas_html $atlas_html
214                 echo atlasf $atlasf
215                 if [ -f $atlasf ] ; then
216                    echo "<a href=\"$atlas_html\"> ${PROJ:0:1} </a>"
217                    echo "<a href=\"$atlas_html\"> ${PROJ:0:1} </a>" >> $htmlfile
218                 else
219                    echo "-" >> $htmlfile
220                    echo Le fichier $atlas_html n\'existe pas
221                 fi
222               done
223               echo '</td>' >> $htmlfile
224            done
225
226
227#--------------------------------------------------------------------------
228    else # Cas ou le fichier histmth.nc n est pas present
229#--------------------------------------------------------------------------
230        echo Le fichier $ROOTSTORAGE/"$run"/$D_SE/$NCFILE n\'existe pas >> $errfile
231        for i in 1 2 3 ; do
232            echo "$emptyelt" >> $htmlfile
233        done
234    fi
235
236# Parametres testes par rapport a la simulation de Ref
237    grep "^$sim "  $DEF_FILE | grep $years | sed -e 's/'$years'//' -e 's/'$sim'/<td>/' -e 's/$/<\/td>/' >> $htmlfile
238    echo '<td> '$years' </td>' >> $htmlfile
239
240    echo "<td><a href=\"$ROOTWEB_PROD/"$run"/catalog.html\"> "$sim" </a></td>" >> $htmlfile
241#--------------------------------------------------------------------------
242# Parametres globaux
243#--------------------------------------------------------------------------
244echo OK0
245   if [ $glob = 1 ] ; then
246     echo OK GGGGGGGGGGGGG $glob
247     listeval=""
248     echo LISTEVAR $listevar
249     for var in $listevar ; do
250     echo $ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob
251          if [ -f "$ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob" ] ; then 
252              val=`grep "^$var " $ROOTWORK/VLR/YEAR/${sim}_$years/METRICS/glob | awk ' { print $2 }' `
253            echo $val
254          else
255              val=.
256          fi
257          listeval="$listeval <td> $val </td>"
258     done
259     echo $listeval
260     echo $listeval >> $htmlfile
261   fi # glob
262echo LISTEVAL $listeval
263
264###########################################################################
265# FIN DE LA BOUCLE SUR LES SIMULATIONS
266###########################################################################
267    echo '</tr>' >> $htmlfile
268    (( ll = $ll + 1 ))
269done
270echo $htmlfile
271
272#############################################################################
273# Traitement eventuel des comparaisons
274#############################################################################
275
276echo '<tr>' >> $htmlfile
277
278if [ -f cmp.liste ] ; then
279
280 for cmp in `awk ' { print $1 } ' cmp.liste` ; do
281
282  descr=`grep "$cmp " cmp.liste | awk ' { print $2 } '`
283
284# Rajout des courbes de comparaison entre simulations
285 echo '<tr>' >> $htmlfile
286    echo "<td> $cmp </td>" >> $htmlfile
287    echo "<td><a href=\"$ROOTWEB/$cmp/ATLAS\"> X </a></td>" >> $htmlfile
288    echo "<td> X </td>" >> $htmlfile
289    echo "<td> X </td>" >> $htmlfile
290    echo "<td><a href=\"$ROOTWEB/$cmp/MoyZon/$years/catalog.html\"> "X" </a></td>" >> $htmlfile
291    echo "<td><a href=\"$ROOTWEB/$cmp/CRF/$years/catalog.html\"> "X" </a></td>" >> $htmlfile
292    echo "<td> X  </td>" >> $htmlfile
293    echo "<td> X  </td>" >> $htmlfile
294    echo "<td> X  </td>" >> $htmlfile
295    echo "<td> X  </td>" >> $htmlfile
296    echo "<td> X  </td>" >> $htmlfile
297    echo "<td> $descr </td>" >> $htmlfile
298  echo '</tr>' >> $htmlfile
299
300done
301fi
302
303echo '</table>' >> $htmlfile
304###########################################################################
305
306mkdir -p $HTML_D
307$put $htmlfile $HTML_D/Table_simulations_${comp}.html
308echo $put $htmlfile $HTML_D/Table_simulations_${comp}.html
309
Note: See TracBrowser for help on using the repository browser.