[3697] | 1 | #!/bin/bash |
---|
[3684] | 2 | |
---|
[4307] | 3 | |
---|
[3684] | 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 | ########################################################################### |
---|
| 18 | module load ferret |
---|
| 19 | |
---|
| 20 | #set -x |
---|
| 21 | |
---|
[4314] | 22 | login=`whoami` |
---|
[4307] | 23 | logname=aidel |
---|
[3684] | 24 | comp=COMP |
---|
| 25 | |
---|
| 26 | helptext=" |
---|
| 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 | |
---|
| 34 | while test -n "${1}"; do |
---|
| 35 | case "${1}" in |
---|
| 36 | --help) echo "$helptext"; |
---|
| 37 | exit 0;; |
---|
| 38 | --comp) comp="${2}" |
---|
| 39 | shift;; |
---|
[4307] | 40 | --runstxt) runstxt="${2}" |
---|
| 41 | shift ;; |
---|
[3684] | 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 |
---|
| 51 | done |
---|
| 52 | |
---|
[4307] | 53 | ###tmpdir=/thredds/ipsl/fabric/lmdz |
---|
[4314] | 54 | tmpdir=/thredds/ipsl/${login}/lmdz |
---|
[3684] | 55 | EXPNAME=B96x95x39/V20090611.dev/ |
---|
| 56 | ROOTWORK=$tmpdir |
---|
| 57 | ROOTWEBORIG="" |
---|
| 58 | EXPNAME=IGCM_OUT/$CONFIGNAME/DEVT/clim |
---|
[4307] | 59 | machine=ciclad |
---|
[3684] | 60 | |
---|
[4307] | 61 | |
---|
[3684] | 62 | STORAGE=$ARCHIVE |
---|
| 63 | put=mfput |
---|
| 64 | ROOTWEBatlas=http://dods.idris.fr/$LOGNAME/$EXPNAME |
---|
| 65 | HTML_D=$ROOTSTORAGE/HTML |
---|
| 66 | |
---|
[4307] | 67 | machine=ciclad |
---|
| 68 | |
---|
[3684] | 69 | if [ "$machine" = "ciclad" ] ; then |
---|
| 70 | EXPNAME=NPV5LRL79 |
---|
| 71 | put=cp |
---|
[4307] | 72 | ###CICLAD=/thredds/ipsl/fabric/lmdz |
---|
[4314] | 73 | CICLAD=/thredds/ipsl/${login}/lmdz |
---|
[3684] | 74 | ARCHIVE=$CICLAD/STORE |
---|
| 75 | workdir=$CICLAD/WORK |
---|
| 76 | STORAGE=$CICLAD |
---|
[4314] | 77 | ROOTWEBatlas=http://thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds/${logname}/lmdz/STORE/$EXPNAME |
---|
[4307] | 78 | ###MULTIDIR=/thredds/ipsl/fabric/lmdz/MultiSimu |
---|
[4314] | 79 | MULTIDIR=/thredds/ipsl/${login}/lmdz/MultiSimu |
---|
[3684] | 80 | COMP_D=$MULTIDIR/$comp |
---|
| 81 | DEF_FILE=$COMP_D/def.txt |
---|
| 82 | HTML_D=$COMP_D |
---|
[4307] | 83 | #runstxt=/home/fabric/LMDZ/MultiSimu/runs.txt |
---|
[3684] | 84 | fi |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | ROOTSTORAGE=$ARCHIVE/$EXPNAME |
---|
| 88 | ROOTDODS=DODS/pub/$LOGNAME/$CONFIGNAME |
---|
| 89 | ROOTWEB="http://dodsp.idris.fr/$LOGNAME/$EXPNAME" |
---|
[4307] | 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 |
---|
| 92 | ROOTWEB_PROD=http://esgf.extra.cea.fr/thredds/catalog/work/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
---|
| 93 | ROOTWEB_PROD=https://thredds-su.ipsl.fr/thredds/catalog/work/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
---|
| 94 | ROOTWEB_PROD=https://thredds-su.ipsl.fr/thredds/catalog/store_thredds/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
---|
| 95 | ROOTWEB_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 |
---|
[3684] | 98 | STOREWEB_PROD=http://esgf.extra.cea.fr/thredds/catalog/store_thredds/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
---|
| 99 | STOREWEB_PRODold=http://esgf.extra.cea.fr/thredds/catalog/store/aidel/IGCM_OUT/LMDZOR/DEVT/clim |
---|
[4307] | 100 | #ROOTWEBatlas=http://dods.idris.fr/$LOGNAME/$CONFIGNAME/DEVT/clim |
---|
[3684] | 101 | if [ "$ROOTWEBORIG" = "" ] ; then |
---|
| 102 | ROOTWEBORIG=ROOTWEBlibigcm |
---|
| 103 | fi |
---|
| 104 | |
---|
| 105 | echo ROOTSTORAGE $ROOTSTORAGE ROOTWEB $ROOTWEB |
---|
| 106 | |
---|
| 107 | glob=1 |
---|
| 108 | |
---|
| 109 | # Version Abderrahmane/centres de caclcul |
---|
| 110 | listevar="bils fnet tops topl topl0 crfsw crflw crfnet eva pr prw " |
---|
| 111 | # Version ciclad multi-atlas |
---|
| 112 | listevar="bils rt rst rlut rlutcs crest crelt cret eva pr prw " |
---|
| 113 | listevalvar="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 |
---|
| 122 | longn=`wc -lc $DEF_FILE | awk ' { print int ( $2 / $1 / 2 ) } '` |
---|
| 123 | longc="" ; i=0 ; while [ $i != $longn ] ; do (( i = $i + 1 )) ; longc="$longc"_ ; done |
---|
| 124 | |
---|
[4307] | 125 | htmlfile=$CICLAD/HTML/tmp.html ; rm -f $htmlfile ; touch $htmlfile |
---|
| 126 | errfile=$CICLAD/HTML/tmphtml$$.err ; rm -f $errfile ; touch $errfile |
---|
[3684] | 127 | D_work=$ROOTWORK/tmp_makehtml$$ ; rm -rf $D_work ; mkdir -p $D_work |
---|
| 128 | emptyelt='<td> - </td>' |
---|
[4307] | 129 | |
---|
[3684] | 130 | cat <<eod>| $htmlfile |
---|
| 131 | <table cellpadding="2" cellspacing="2" border="1" |
---|
| 132 | style="text-align: left; width: 100px; margin-left: auto; |
---|
| 133 | margin-right: auto;"> |
---|
| 134 | <tr> |
---|
[4314] | 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> |
---|
[3684] | 136 | <td> Atlas YEAR</td> |
---|
| 137 | <td> Atlas --DJF-- </td> |
---|
| 138 | <td> Atlas --JJA-- </td> |
---|
[4307] | 139 | <td> Atlas --MAM-- </td> |
---|
| 140 | <td> Atlas --SON-- </td> |
---|
[3684] | 141 | <td> Description of the simulation $longc </td> |
---|
| 142 | <td> Period </td> |
---|
| 143 | <td> Name (link to parameters) </td> |
---|
| 144 | eod |
---|
| 145 | |
---|
| 146 | if [ $glob = 1 ] ; then |
---|
| 147 | for var in $listevar ; do |
---|
| 148 | echo '<td> '$var' </td>' >> $htmlfile |
---|
| 149 | done |
---|
| 150 | fi |
---|
| 151 | |
---|
| 152 | ################CLIMATOS################################################## |
---|
| 153 | echo '<tr>' >> $htmlfile |
---|
| 154 | echo "<td> CLIMATOS </td>" >> $htmlfile |
---|
| 155 | echo "<td> </td>" >> $htmlfile |
---|
| 156 | echo "<td> </td>" >> $htmlfile |
---|
| 157 | echo "<td> </td>" >> $htmlfile |
---|
| 158 | echo "<td> </td>" >> $htmlfile |
---|
| 159 | echo "<td> </td>" >> $htmlfile |
---|
| 160 | echo "<td> </td>" >> $htmlfile |
---|
[4307] | 161 | echo "<td> </td>" >> $htmlfile |
---|
| 162 | echo "<td> </td>" >> $htmlfile |
---|
[3684] | 163 | if [ $glob = 1 ] ; then |
---|
| 164 | for var in $listevalvar ; do |
---|
| 165 | echo '<td> '$var' </td>' >> $htmlfile |
---|
| 166 | done |
---|
| 167 | fi |
---|
| 168 | echo '<tr>' >> $htmlfile |
---|
| 169 | |
---|
| 170 | lc=`wc -l $DEF_FILE | awk ' { print $1 } '` |
---|
| 171 | ll=1 |
---|
| 172 | ########################################################################### |
---|
| 173 | # DEBUT DE LA BOUCLE SUR LES SIMULATIONS |
---|
| 174 | while [ $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 } '` |
---|
[4307] | 179 | echo simdir $simdir |
---|
[3684] | 180 | run=`basename $simdir ` |
---|
| 181 | years=`echo $line | awk ' { print $2 } '` |
---|
[4307] | 182 | # years=`grep '^'$run' ' $DEF_FILE | awk ' { print $2 }'` |
---|
[3684] | 183 | yearsb=`echo $years | sed -e 's/_/-/'` |
---|
| 184 | echo run $run |
---|
| 185 | echo '<tr>' >> $htmlfile |
---|
| 186 | ########################################################################### |
---|
| 187 | |
---|
| 188 | |
---|
| 189 | |
---|
| 190 | NCFILE=${run}_SE_${years}_1M_histmth.nc |
---|
| 191 | |
---|
[4307] | 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 | |
---|
[3684] | 200 | #-------------------------------------------------------------------------- |
---|
| 201 | # Liens vers les fichiers, monitoring et atlas |
---|
| 202 | #-------------------------------------------------------------------------- |
---|
[4307] | 203 | # echo "<td><a href=\"$ROOTWEBatlas/"$run"\"> "$run" </a></td>" >> $htmlfile |
---|
[3684] | 204 | echo "<td><a href=\"$ROOTWEB_PRODout/"$run"/catalog.html\"> "$sim" </a></td>" >> $htmlfile |
---|
| 205 | |
---|
| 206 | D_SE=$run/ATM/Analyse/SE |
---|
| 207 | |
---|
| 208 | echo OK0 |
---|
| 209 | # if [ -f "$ROOTSTORAGE/$D_SE/$NCFILE" ] ; then |
---|
| 210 | if [ 1 = 1 ] ; then |
---|
| 211 | |
---|
[4307] | 212 | for SEAS in YEAR DJF JJA MAM SON ; do |
---|
[3684] | 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 |
---|
[4307] | 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/:'` |
---|
[3684] | 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 | #-------------------------------------------------------------------------- |
---|
| 256 | echo OK0 |
---|
| 257 | if [ $glob = 1 ] ; then |
---|
[4307] | 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 |
---|
[3684] | 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 |
---|
| 277 | echo LISTEVAL $listeval |
---|
| 278 | |
---|
[4307] | 279 | |
---|
[3684] | 280 | ########################################################################### |
---|
| 281 | # FIN DE LA BOUCLE SUR LES SIMULATIONS |
---|
| 282 | ########################################################################### |
---|
| 283 | echo '</tr>' >> $htmlfile |
---|
| 284 | (( ll = $ll + 1 )) |
---|
| 285 | done |
---|
| 286 | echo $htmlfile |
---|
| 287 | |
---|
| 288 | ############################################################################# |
---|
| 289 | # Traitement eventuel des comparaisons |
---|
| 290 | ############################################################################# |
---|
| 291 | |
---|
| 292 | echo '<tr>' >> $htmlfile |
---|
| 293 | |
---|
| 294 | if [ -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 | |
---|
| 316 | done |
---|
| 317 | fi |
---|
| 318 | |
---|
| 319 | echo '</table>' >> $htmlfile |
---|
| 320 | ########################################################################### |
---|
| 321 | |
---|
| 322 | mkdir -p $HTML_D |
---|
[4307] | 323 | $put $htmlfile $HTML_D/Table_simulations_$comp.html |
---|
| 324 | echo $put $htmlfile $HTML_D/Table_simulations_$comp.html |
---|
[3684] | 325 | |
---|
[4307] | 326 | #$home/Diagnos_v6/dods_publi.sh $EXPNAME/HTML |
---|