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