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