| 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 | ########################################################################### |
|---|
| 20 | module load ferret |
|---|
| 21 | |
|---|
| 22 | #set -x |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | comp=COMP |
|---|
| 26 | |
|---|
| 27 | helptext=" |
|---|
| 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 | |
|---|
| 35 | while 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 |
|---|
| 50 | done |
|---|
| 51 | |
|---|
| 52 | local=`pwd -P` |
|---|
| 53 | |
|---|
| 54 | login=`whoami` |
|---|
| 55 | hostname=`hostname` |
|---|
| 56 | if [ ${hostname:0:5} = cicla ] ; then |
|---|
| 57 | DODSDIR=/prodigfs/ipslfs/dods |
|---|
| 58 | HTML=http://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/$login/lmdz/MultiSimu/$comp |
|---|
| 59 | machine=ciclad |
|---|
| 60 | fi |
|---|
| 61 | if [ ${hostname:0:5} = camel ] ; then |
|---|
| 62 | DODSDIR=/prodigfs/ipslfs/dods |
|---|
| 63 | fi |
|---|
| 64 | if [ ${hostname:0:5} = irene ] ; then |
|---|
| 65 | DODSDIR= |
|---|
| 66 | fi |
|---|
| 67 | if [ ${hostname:0:5} = jean- ] ; then |
|---|
| 68 | DODSDIR= |
|---|
| 69 | fi |
|---|
| 70 | |
|---|
| 71 | tmpdir=$DODSDIR/$login/lmdz |
|---|
| 72 | EXPNAME=B96x95x39/V20090611.dev/ |
|---|
| 73 | ROOTWORK=$tmpdir |
|---|
| 74 | ROOTWEBORIG="" |
|---|
| 75 | EXPNAME=IGCM_OUT/$CONFIGNAME/DEVT/clim |
|---|
| 76 | |
|---|
| 77 | STORAGE=$ARCHIVE |
|---|
| 78 | put=mfput |
|---|
| 79 | ROOTWEBatlas=http://dods.idris.fr/$LOGNAME/$EXPNAME |
|---|
| 80 | HTML_D=$ROOTSTORAGE/HTML |
|---|
| 81 | |
|---|
| 82 | if [ "$machine" = "ciclad" ] ; then |
|---|
| 83 | EXPNAME=NPV5LRL79 |
|---|
| 84 | put=cp |
|---|
| 85 | CICLAD=$DODSDIR/$login/lmdz |
|---|
| 86 | ARCHIVE=$CICLAD/STORE |
|---|
| 87 | workdir=$CICLAD/WORK |
|---|
| 88 | STORAGE=$CICLAD |
|---|
| 89 | ROOTWEBatlas=http://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/$login/lmdz/STORE/$EXPNAME |
|---|
| 90 | MULTIDIR=/prodigfs/ipslfs/dods/$login/lmdz/MultiSimu |
|---|
| 91 | COMP_D=$MULTIDIR/$comp |
|---|
| 92 | DEF_FILE=$COMP_D/def.txt |
|---|
| 93 | HTML_D=$COMP_D |
|---|
| 94 | runstxt=$local/runs.txt |
|---|
| 95 | fi |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | ROOTSTORAGE=$ARCHIVE/$EXPNAME |
|---|
| 99 | ROOTDODS=DODS/pub/$LOGNAME/$CONFIGNAME |
|---|
| 100 | ROOTWEB="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 |
|---|
| 103 | ROOTWEB_PROD=http://esgf.extra.cea.fr/thredds/catalog/work/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
|---|
| 104 | ROOTWEB_PROD=https://vesg.ipsl.upmc.fr/thredds/catalog/work/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
|---|
| 105 | ROOTWEB_PROD=https://vesg.ipsl.upmc.fr/thredds/catalog/store_thredds/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
|---|
| 106 | ROOTWEB_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 |
|---|
| 109 | STOREWEB_PROD=http://esgf.extra.cea.fr/thredds/catalog/store_thredds/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
|---|
| 110 | STOREWEB_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 |
|---|
| 112 | if [ "$ROOTWEBORIG" = "" ] ; then |
|---|
| 113 | ROOTWEBORIG=ROOTWEBlibigcm |
|---|
| 114 | fi |
|---|
| 115 | |
|---|
| 116 | echo ROOTSTORAGE $ROOTSTORAGE ROOTWEB $ROOTWEB |
|---|
| 117 | |
|---|
| 118 | glob=1 |
|---|
| 119 | |
|---|
| 120 | # Version Abderrahmane/centres de caclcul |
|---|
| 121 | listevar="bils fnet tops topl topl0 crfsw crflw crfnet eva pr prw " |
|---|
| 122 | # Version ciclad multi-atlas |
|---|
| 123 | listevar="bils rt rst rlut rlutcs crest crelt cret eva pr prw " |
|---|
| 124 | listevalvar="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 |
|---|
| 133 | longn=`wc -lc $DEF_FILE | awk ' { print int ( $2 / $1 / 2 ) } '` |
|---|
| 134 | longc="" ; i=0 ; while [ $i != $longn ] ; do (( i = $i + 1 )) ; longc="$longc"_ ; done |
|---|
| 135 | |
|---|
| 136 | htmlfile=$CICLAD/HTML/tmp.html ; rm -f $htmlfile ; touch $htmlfile |
|---|
| 137 | errfile=$CICLAD/HTML/tmphtml$$.err ; rm -f $errfile ; touch $errfile |
|---|
| 138 | D_work=$ROOTWORK/tmp_makehtml$$ ; rm -rf $D_work ; mkdir -p $D_work |
|---|
| 139 | emptyelt='<td> - </td>' |
|---|
| 140 | |
|---|
| 141 | cat <<eod>| $htmlfile |
|---|
| 142 | <table cellpadding="2" cellspacing="2" border="1" |
|---|
| 143 | style="text-align: left; width: 100px; margin-left: auto; |
|---|
| 144 | margin-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> |
|---|
| 153 | eod |
|---|
| 154 | |
|---|
| 155 | if [ $glob = 1 ] ; then |
|---|
| 156 | for var in $listevar ; do |
|---|
| 157 | echo '<td> '$var' </td>' >> $htmlfile |
|---|
| 158 | done |
|---|
| 159 | fi |
|---|
| 160 | |
|---|
| 161 | ################CLIMATOS################################################## |
|---|
| 162 | echo '<tr>' >> $htmlfile |
|---|
| 163 | echo "<td> CLIMATOS </td>" >> $htmlfile |
|---|
| 164 | echo "<td> </td>" >> $htmlfile |
|---|
| 165 | echo "<td> </td>" >> $htmlfile |
|---|
| 166 | echo "<td> </td>" >> $htmlfile |
|---|
| 167 | echo "<td> </td>" >> $htmlfile |
|---|
| 168 | echo "<td> </td>" >> $htmlfile |
|---|
| 169 | echo "<td> </td>" >> $htmlfile |
|---|
| 170 | if [ $glob = 1 ] ; then |
|---|
| 171 | for var in $listevalvar ; do |
|---|
| 172 | echo '<td> '$var' </td>' >> $htmlfile |
|---|
| 173 | done |
|---|
| 174 | fi |
|---|
| 175 | echo '<tr>' >> $htmlfile |
|---|
| 176 | |
|---|
| 177 | lc=`wc -l $DEF_FILE | awk ' { print $1 } '` |
|---|
| 178 | ll=1 |
|---|
| 179 | ########################################################################### |
|---|
| 180 | # DEBUT DE LA BOUCLE SUR LES SIMULATIONS |
|---|
| 181 | while [ $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 | |
|---|
| 196 | NCFILE=${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 | |
|---|
| 212 | D_SE=$run/ATM/Analyse/SE |
|---|
| 213 | |
|---|
| 214 | echo 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 | #-------------------------------------------------------------------------- |
|---|
| 262 | echo 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 |
|---|
| 283 | echo LISTEVAL $listeval |
|---|
| 284 | |
|---|
| 285 | |
|---|
| 286 | ########################################################################### |
|---|
| 287 | # FIN DE LA BOUCLE SUR LES SIMULATIONS |
|---|
| 288 | ########################################################################### |
|---|
| 289 | echo '</tr>' >> $htmlfile |
|---|
| 290 | (( ll = $ll + 1 )) |
|---|
| 291 | done |
|---|
| 292 | echo $htmlfile |
|---|
| 293 | |
|---|
| 294 | ############################################################################# |
|---|
| 295 | # Traitement eventuel des comparaisons |
|---|
| 296 | ############################################################################# |
|---|
| 297 | |
|---|
| 298 | echo '<tr>' >> $htmlfile |
|---|
| 299 | |
|---|
| 300 | if [ -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 | |
|---|
| 322 | done |
|---|
| 323 | fi |
|---|
| 324 | |
|---|
| 325 | echo '</table>' >> $htmlfile |
|---|
| 326 | ########################################################################### |
|---|
| 327 | |
|---|
| 328 | mkdir -p $HTML_D |
|---|
| 329 | $put $htmlfile $HTML_D/Table_simulations_$comp.html |
|---|
| 330 | echo $put $htmlfile $HTML_D/Table_simulations_$comp.html |
|---|
| 331 | |
|---|
| 332 | #$home/Diagnos_v6/dods_publi.sh $EXPNAME/HTML |
|---|