[3696] | 1 | # Definitions en fonction de la machine |
---|
| 2 | # CICLAD |
---|
[3701] | 3 | hostname=`hostname` |
---|
[3696] | 4 | if [ ${hostname:0:5} = cicla ] ; then |
---|
| 5 | ######################################################################################################## |
---|
| 6 | # Environnement |
---|
| 7 | module purge |
---|
| 8 | module load netcdf4/4.3.3.1-ifort cdo/1.6.8 nco/4.5.2 ncl/6.3.0 |
---|
| 9 | ulimit -s unlimited |
---|
| 10 | export PYTHONPATH=:/opt/canopy-1.3.0/Canopy_64bit/User/bin/python:/home/igcmg/prodiguer-client:/home/fabric/users/denvil/climaf:/home/fabric/users/denvil/climaf |
---|
| 11 | export PATH=$PATH:/home/fabric/users/denvil/climaf/bin |
---|
| 12 | STORAGE=$DODSDIR/$login/lmdz/STORE |
---|
| 13 | if [ ! -d $DODSDIR/$login/climafCache ] ; then mkdir -p $DODSDIR/$login/climafCache ; fi |
---|
| 14 | export CLIMAF_CACHE=$DODSDIR/$login/climafCache |
---|
| 15 | echo CLIMAF_CACHE $DODSDIR/$login/climafCache |
---|
| 16 | MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu |
---|
| 17 | DIRATLAS=$DODSDIR/$login/lmdz/atlas |
---|
| 18 | ######################################################################################################## |
---|
| 19 | ATLAS_DIR=$DODSDIR/$login/lmdz/atlas/Atlas$$ |
---|
| 20 | if [ ! -d $DODSDIR/$login/lmdz/atlas/Atlas$$ ] ; then mkdir -p $DODSDIR/$login/lmdz/atlas/Atlas$$ ; fi |
---|
| 21 | fi |
---|
[3684] | 22 | local=`pwd -P` |
---|
| 23 | |
---|
| 24 | date |
---|
| 25 | |
---|
| 26 | vars="" |
---|
| 27 | vars="sst" |
---|
| 28 | #runstxt=$local/../runs.txt |
---|
| 29 | |
---|
| 30 | if [ $# = 1 ] ; then |
---|
| 31 | opts="`echo $1 | sed -e 's/,/ /g'`" |
---|
| 32 | for opt in $opts ; do |
---|
| 33 | echo $opt |
---|
| 34 | key=`echo $opt | cut -d= -f1` |
---|
| 35 | val=`echo $opt | cut -d= -f2` |
---|
| 36 | echo $key $val |
---|
| 37 | if [ "$key" = "RUN" ] ; then sim=$val ; fi |
---|
| 38 | if [ "$key" = "REF" ] ; then ref=$val ; fi |
---|
| 39 | if [ "$key" = "SEASON" ] ; then seas=$val ; fi |
---|
| 40 | if [ "$key" = "PROJ" ] ; then proj=$val ; fi |
---|
| 41 | if [ "$key" = "OUTDIR" ] ; then OUT_D=$val ; fi |
---|
| 42 | if [ "$key" = "RUNSTXT" ] ; then runstxt=$val ; fi |
---|
| 43 | if [ "$key" = "VARS" ] ; then vars="`echo $val | sed -e 's/+/,/g'`" ; fi |
---|
| 44 | done |
---|
| 45 | elif [ $# = 0 ] ; then |
---|
| 46 | sim=$RUN |
---|
| 47 | ref=OBS |
---|
| 48 | seas=$SEASON |
---|
| 49 | proj=$PROJ |
---|
| 50 | OUT_D=$OUTDIR |
---|
| 51 | runstxt=$RUNSTXT |
---|
| 52 | vars=`echo $VARS | sed -e 's/+/,/g'` |
---|
| 53 | else |
---|
| 54 | echo USE |
---|
| 55 | echo Job mode : |
---|
| 56 | echo $submit -v RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas atlas.sh |
---|
| 57 | echo interactif : |
---|
| 58 | echo ./atlas.sh RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas |
---|
| 59 | exit |
---|
| 60 | fi |
---|
| 61 | |
---|
| 62 | if [ "$vars" = "" ] ; then |
---|
| 63 | vars=pr,tas,hurs,hfls,hfss,albt,albtcs,albs,rldscs,rlds,rlus,rsdscs,rsds,rsuscs,rsus,rsutcs,rsut,rlut,rlutcs,psl,prw,sst,pme,tasmax,tasmin |
---|
| 64 | fi |
---|
| 65 | |
---|
| 66 | #,ua850,va850,ta850,ua500,va500,ta500,ua200,va200,ta200 |
---|
| 67 | echo sim $sim |
---|
| 68 | srun=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
---|
| 69 | echo srun $srun |
---|
| 70 | simdir=`grep -w "^$srun" $runstxt | awk ' { print $2 } '` |
---|
| 71 | run=`basename $simdir ` |
---|
| 72 | years=`echo $sim | sed -e 's/'$srun'//' | sed -e 's/_//'` |
---|
| 73 | sim=${run}_${years} |
---|
| 74 | echo $run $years $sim $ref |
---|
| 75 | echo ENTREES : $run, $years, $seas, $vars, $ref |
---|
| 76 | echo simdir $simdir |
---|
| 77 | |
---|
| 78 | echo run $run |
---|
| 79 | echo sim $sim |
---|
| 80 | echo simdir $simdir |
---|
| 81 | |
---|
| 82 | keys_strgv=$sim$seas$proj$vars$ref |
---|
| 83 | keys_strg=$sim$seas$proj$ref |
---|
| 84 | |
---|
| 85 | mkdir -p $OUT_D |
---|
| 86 | if [ -f $OUT_D/$keys_strg.ENCOURS ] ; then |
---|
| 87 | echo $OUT_D/$keys_strg.ENCOURS |
---|
| 88 | exit # Si le même atlas est deja en cours de realisation on sort |
---|
| 89 | else |
---|
| 90 | touch $OUT_D/$keys_strg.ENCOURS |
---|
| 91 | fi |
---|
| 92 | |
---|
| 93 | if [ "$OUT_D" = "" ] ; then |
---|
| 94 | $OUT_D=$STORAGE/NPV5LRL79/$run/ATLAS/SE_$years/ATM |
---|
| 95 | fi |
---|
| 96 | |
---|
| 97 | cd $ATLAS_DIR |
---|
| 98 | echo sim $sim seas $seas > atlas.sh.log |
---|
| 99 | |
---|
| 100 | ########################################################################### |
---|
| 101 | # Boucle pour construire l'atlas en plusieurs passages |
---|
| 102 | echo IL FAUT FAIRE L ATLAS EN PLUSIEURS PASSAGE SINON CA PLANTE ... |
---|
| 103 | ########################################################################### |
---|
| 104 | |
---|
| 105 | case "$proj" in |
---|
| 106 | "SH"|"NH") pyatlas="atlas_SH.py --projection $proj" ;; |
---|
| 107 | "GLOB") Var3D=,ua,va,ta,hus,hur ; pyatlas=atlas_none.py ;; |
---|
| 108 | esac |
---|
| 109 | |
---|
| 110 | |
---|
| 111 | npass=5 |
---|
| 112 | ipass=1 |
---|
| 113 | |
---|
| 114 | while [ $ipass -le $npass ] ; do |
---|
| 115 | |
---|
| 116 | echo Nettoyage des fichiers corrompus du cache |
---|
[3694] | 117 | $local/clean_cache.sh $DIRATLAS |
---|
[3684] | 118 | echo passage $ipass >> atlas.sh.log |
---|
| 119 | html=index_example_"$seas"_"$sim".html |
---|
| 120 | htmlopt=index_${proj}_"$seas"_"$sim".html |
---|
| 121 | rm -f $html |
---|
| 122 | echo python $local/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas --root $simdir/ATM/Analyse/SE |
---|
| 123 | python $local/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas --root $simdir/ATM/Analyse/SE |
---|
| 124 | |
---|
| 125 | if [ ! -f "$html" -o "`wc -l $html | awk ' { print $1 } '`" = "0" ] ; then |
---|
| 126 | echo ECHEC ATLAS : $html inexistant ou vide | tee >> atlas.sh.log |
---|
| 127 | echo ECHEC ATLAS : $html inexistant ou vide |
---|
| 128 | else |
---|
| 129 | echo cp -f $html tmp$$.$passage |
---|
| 130 | cp -f $html tmp$$.$passage |
---|
| 131 | pwd |
---|
| 132 | echo tmp$$.$passage |
---|
| 133 | echo LS LS |
---|
| 134 | ls -lrt | tail |
---|
| 135 | # A ADAPTER en fonction de la machine |
---|
| 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 |
---|