[3684] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | RUN=$1 |
---|
| 4 | SEASON=$2 |
---|
| 5 | PROJ=$3 |
---|
| 6 | OUTDIR=$4 |
---|
| 7 | REF=$5 |
---|
| 8 | VARS=$6 |
---|
| 9 | |
---|
| 10 | set -vx |
---|
| 11 | |
---|
| 12 | date |
---|
| 13 | ########################################################################### |
---|
| 14 | # Environnement |
---|
| 15 | module list |
---|
| 16 | which python |
---|
| 17 | ulimit -s unlimited |
---|
| 18 | ATLAS_DIR=/prodigfs/ipslfs/dods/fabric/lmdz/atlas/Atlas$$ ; mkdir -p $ATLAS_DIR |
---|
| 19 | export PYTHONPATH=$PYTHONPATH:/home/fabric/users/denvil/climaf |
---|
| 20 | export PATH=$PATH:/home/fabric/users/denvil/climaf/bin |
---|
| 21 | STORAGE=/prodigfs/ipslfs/dods/fabric/lmdz/STORE |
---|
| 22 | ########################################################################### |
---|
| 23 | vars="" |
---|
| 24 | vars="sst" |
---|
| 25 | |
---|
| 26 | if [ $# = 1 ] ; then |
---|
| 27 | opts="`echo $1 | sed -e 's/,/ /g'`" |
---|
| 28 | for opt in $opts ; do |
---|
| 29 | echo $opt |
---|
| 30 | key=`echo $opt | cut -d= -f1` |
---|
| 31 | val=`echo $opt | cut -d= -f2` |
---|
| 32 | echo $key $val |
---|
| 33 | if [ "$key" = "RUN" ] ; then sim=$val ; fi |
---|
| 34 | if [ "$key" = "REF" ] ; then ref=$val ; fi |
---|
| 35 | if [ "$key" = "SEASON" ] ; then seas=$val ; fi |
---|
| 36 | if [ "$key" = "PROJ" ] ; then proj=$val ; fi |
---|
| 37 | if [ "$key" = "OUTDIR" ] ; then OUT_D=$val ; fi |
---|
| 38 | if [ "$key" = "VARS" ] ; then vars="`echo $val | sed -e 's/+/,/g'`" ; fi |
---|
| 39 | done |
---|
| 40 | elif [ $# = 0 ] ; then |
---|
| 41 | sim=$RUN |
---|
| 42 | ref=$REF |
---|
| 43 | seas=$SEASON |
---|
| 44 | proj=$PROJ |
---|
| 45 | OUT_D=$OUTDIR |
---|
| 46 | vars=`echo $VARS | sed -e 's/+/,/g'` |
---|
| 47 | else |
---|
| 48 | echo USE |
---|
| 49 | echo Job mode : |
---|
| 50 | echo qsub -v RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=/prodigfs/ipslfs/dods/fabric/lmdz/MultiSimu/V5/ATLAS,VARS=pr+tas atlas.sh |
---|
| 51 | echo interactif : |
---|
| 52 | echo ./atlas.sh RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=/prodigfs/ipslfs/dods/fabric/lmdz/MultiSimu/V5/ATLAS,VARS=pr+tas |
---|
| 53 | exit |
---|
| 54 | fi |
---|
| 55 | |
---|
| 56 | if [ "$vars" = "" ] ; then |
---|
| 57 | vars=pr,tas,hurs,hfls,hfss,albt,albtcs,albs,rldscs,rlds,rlus,rsdscs,rsds,rsuscs,rsus,rsutcs,rsut,rlut,rlutcs,psl,prw |
---|
| 58 | fi |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | run=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
---|
| 62 | years=`echo $sim | sed -e 's/'$run'//' | sed -e 's/_//'` |
---|
| 63 | sim=${run}_$years |
---|
| 64 | echo $run $years $sim $ref |
---|
| 65 | echo ENTREES : $run, $years, $seas, $vars, $ref |
---|
| 66 | #exit |
---|
| 67 | |
---|
| 68 | keys_strg=$sim$seas$proj$vars$ref |
---|
| 69 | |
---|
| 70 | if [ -f $keys_strg.ENCOURS ] ; then |
---|
| 71 | exit # Si le même atlas est deja en cours de realisation on sort |
---|
| 72 | else |
---|
| 73 | touch $OUT_D/$keys_strg.ENCOURS |
---|
| 74 | fi |
---|
| 75 | |
---|
| 76 | if [ "$OUT_D" = "" ] ; then |
---|
| 77 | $OUT_D=$STORAGE/NPV5LRL79/$run/ATLAS/SE_$years/ATM |
---|
| 78 | fi |
---|
| 79 | mkdir -p $OUT_D |
---|
| 80 | |
---|
| 81 | cd $ATLAS_DIR |
---|
| 82 | echo sim $sim seas $seas > atlas.sh.log |
---|
| 83 | |
---|
| 84 | ########################################################################### |
---|
| 85 | # Boucle pour construire l'atlas en plusieurs passages |
---|
| 86 | echo IL FAUT FAIRE L ATLAS EN PLUSIEURS PASSAGE SINON CA PLANTE ... |
---|
| 87 | ########################################################################### |
---|
| 88 | |
---|
| 89 | case "$proj" in |
---|
| 90 | "SH"|"NH") pyatlas="atlas_SH.py --projection $proj" ;; |
---|
| 91 | "GLOB") Var3D=,ua,va,ta,hus ; pyatlas=atlas.py ;; |
---|
| 92 | esac |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | npass=5 |
---|
| 96 | ipass=1 |
---|
| 97 | |
---|
| 98 | while [ $ipass -le $npass ] ; do |
---|
| 99 | |
---|
| 100 | echo Nettoyage des fichiers corrompus du cache |
---|
| 101 | ~/LMDZ/atlas/clean_cache.sh |
---|
| 102 | echo passage $ipass >> atlas.sh.log |
---|
| 103 | html=index_example_"$seas"_"$sim".html |
---|
| 104 | htmlopt=index_${proj}_"$seas"_"$sim".html |
---|
| 105 | rm -f $html |
---|
| 106 | |
---|
| 107 | python /home/fabric/LMDZ/atlas/$pyatlas --force -v $vars -s $sim -t $ref -p $seas |
---|
| 108 | |
---|
| 109 | if [ ! -f "$html" -o "`wc -l $html | awk ' { print $1 } '`" = "0" ] ; then |
---|
| 110 | echo ECHEC ATLAS : $html inexistant ou vide | tee >> atlas.sh.log |
---|
| 111 | echo ECHEC ATLAS : $html inexistant ou vide |
---|
| 112 | else |
---|
| 113 | echo cp -f $html tmp$$.$passage |
---|
| 114 | cp -f $html tmp$$.$passage |
---|
| 115 | pwd |
---|
| 116 | echo tmp$$.$passage |
---|
| 117 | echo LS LS |
---|
| 118 | ls -lrt | tail |
---|
| 119 | sed -e "s:/prodigfs/ipslfs/dods/:/thredds/fileServer/IPSLFS/:g" tmp$$.$passage >| $htmlopt |
---|
| 120 | \cp -f $htmlopt $OUT_D/ |
---|
| 121 | PathHtml=`echo $OUT_D/$htmlopt | sed -e 's:/prodigfs/ipslfs/dods/:http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/:'` |
---|
| 122 | echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml | tee >> atlas.sh.log |
---|
| 123 | echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml |
---|
| 124 | echo $keys_strg >> $OUT_D/atlas_OK |
---|
| 125 | echo ${sim}+${seas}+${proj}+$vars >> $OUT_D/atlas_OK |
---|
| 126 | fi |
---|
| 127 | (( ipass = $ipass + 1 )) |
---|
| 128 | |
---|
| 129 | done |
---|
| 130 | |
---|
| 131 | #\rm -f $OUT_D/$keys_strg.ENCOURS |
---|