source: BOL/Multi_atlas/Utils/atlas0.sh @ 4744

Last change on this file since 4744 was 4345, checked in by musat, 2 years ago

Plusieurs appels climaf et tracers moyennes
zonales par climaf commentes
IonelaMusat?

  • Property svn:executable set to *
File size: 8.0 KB
RevLine 
[4308]1###########################################################################
[3696]2# Environnement
[4308]3local=`pwd -P`
4
[4340]5source ~/env_Multi_atlas.sh
[4317]6
[4308]7module list
[4330]8python=`which python`
9echo PYTHON IS $python
10
[3696]11ulimit -s unlimited
[4308]12ATLAS_DIR=${DODSDIR}/${login}/lmdz/atlas/Atlas$$ ; mkdir -p $ATLAS_DIR
13STORAGE=${DODSDIR}/${login}/lmdz/STORE
14dirpng=${DODSDIR}/${login}/lmdz/VLR
15
[4330]16if [ 1 == 0 ]; then
[4308]17export PYTHONPATH=$PYTHONPATH:/home/fabric/users/denvil/climaf
[3696]18export PATH=$PATH:/home/fabric/users/denvil/climaf/bin
[4330]19fi
[3684]20
[4330]21#myCC=$DODSDIR/$login/IMclimafCache
22#if [ 1 == 0 ]; then
[4345]23#myCC=/scratchu/${login}/climafCache041122run
24myCC=/scratchu/${login}/climafCache$$
25\rm -rf ${myCC} 
[4330]26mkdir -p ${myCC}
27export CLIMAF_CACHE=${myCC}
28echo CLIMAF_CACHE ${CLIMAF_CACHE}
29mkdir -p ${CLIMAF_CACHE}/remote_data
30export CLIMAF_REMOTE_CACHE=${CLIMAF_CACHE}/remote_data
31#fi
32#exit
33#\rm -rf $DODSDIR/$login/climafCache$$
34#mkdir -p $DODSDIR/$login/climafCache$$
35#export CLIMAF_CACHE=$DODSDIR/$login/climafCache$$
36#echo CLIMAF_CACHE $DODSDIR/$login/climafCache$$
[4308]37###########################################################################
[3684]38vars=""
39vars="sst"
[4308]40#runstxt=/home/fabric/LMDZ/multi/runs.txt
[3684]41
42if [ $# = 1 ] ; then
43   opts="`echo $1 | sed -e 's/,/ /g'`"
44   for opt in $opts ; do
45       echo $opt
46       key=`echo $opt | cut -d= -f1`
47       val=`echo $opt | cut -d= -f2`
48       echo $key $val
49       if [ "$key" = "RUN" ] ; then sim=$val ; fi
50       if [ "$key" = "REF" ] ; then ref=$val ; fi
51       if [ "$key" = "SEASON" ] ; then seas=$val ; fi
52       if [ "$key" = "PROJ" ] ; then proj=$val ; fi
53       if [ "$key" = "OUTDIR" ] ; then OUT_D=$val ; fi
54       if [ "$key" = "RUNSTXT" ] ; then runstxt=$val ; fi
[4308]55       if [ "$key" = "VARS" ] ; then vars="`echo $val | sed -e 's/+/ /g'`" ; fi
56       if [ "$key" = "lonmin" ] ; then lonmin=$val ; fi
57       if [ "$key" = "lonmax" ] ; then lonmax=$val ; fi
58       if [ "$key" = "latmin" ] ; then latmin=$val ; fi
59       if [ "$key" = "latmax" ] ; then latmax=$val ; fi
60       if [ "$key" = "pmin" ] ; then pmin=$val ; fi
[3684]61   done
62elif [ $# = 0 ] ; then
63   sim=$RUN
[3885]64   ref=$REF
[3684]65   seas=$SEASON
66   proj=$PROJ
67   OUT_D=$OUTDIR
68   runstxt=$RUNSTXT
[4308]69   vars=`echo $VARS | sed -e 's/+/ /g'`
70   lonmin=$lonmin
71   lonmax=$lonmax
72   latmin=$latmin
73   latmax=$latmax
74   pmin=$pmin
75   echo lonmin=$lonmin lonmax=$lonmax
76   echo latmin=$latmin latmax=$latmax
77   echo pmin=$pmin
[3684]78else
79  echo USE
80  echo Job mode :
[4308]81  echo qsub -v RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas atlas.sh
[3684]82  echo interactif :
83  echo ./atlas.sh RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas
84  exit
85fi
86
87if [ "$vars" = "" ] ; then
[4308]88   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"
[3684]89fi
90
[4308]91if [ "$sim" != "OBS" ]; then
[3684]92echo sim $sim
93srun=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'`
94echo srun $srun
[4308]95simdir=`grep -w "^$srun " $runstxt | awk ' { print $2 } '`
[3684]96run=`basename $simdir `
97years=`echo $sim | sed -e 's/'$srun'//' | sed -e 's/_//'`
98sim=${run}_${years}
[4308]99
[3684]100echo $run $years $sim $ref
101echo ENTREES : $run, $years, $seas, $vars, $ref
102echo simdir $simdir
103
104echo run $run 
105echo sim $sim
106echo simdir $simdir
[4308]107fi
[3684]108
109keys_strgv=$sim$seas$proj$vars$ref
110keys_strg=$sim$seas$proj$ref
111
112mkdir -p $OUT_D
113if [ -f $OUT_D/$keys_strg.ENCOURS ] ; then 
114   echo $OUT_D/$keys_strg.ENCOURS
115   exit # Si le même atlas est deja en cours de realisation on sort
116else
117   touch $OUT_D/$keys_strg.ENCOURS
118fi
119
120if [ "$OUT_D" = "" ] ; then
121   $OUT_D=$STORAGE/NPV5LRL79/$run/ATLAS/SE_$years/ATM
122fi
123
124cd $ATLAS_DIR
125echo sim $sim seas $seas > atlas.sh.log
126
127case "$proj" in
128   "SH"|"NH") pyatlas="atlas_SH.py --projection $proj" ;;
129   "GLOB") Var3D=,ua,va,ta,hus,hur ; pyatlas=atlas_none.py ;;
[4308]130   *) Var3D=,ua,va,ta,hus,hur ; pyatlas=atlas_none.py ;;
[3684]131esac
132
133   html=index_example_"$seas"_"$sim".html
[3885]134   htmlopt=index_"${proj}"_"$seas"_"$sim".html
[4308]135   echo rm -f $htmlopt
136#
137   for var in $vars; do
138   datevar=`date`
139   echo Creation repertoires *MAP* et check variables 3D
140   mkdir -p ${dirpng}/${seas}/${sim}/MAP
141   mkdir -p ${dirpng}/${seas}/${sim}/MAP/${proj}
142#
143   mkdir -p ${dirpng}/${seas}/${ref}/MAP
144   mkdir -p ${dirpng}/${seas}/${ref}/MAP/${proj}
145#
146   mkdir -p ${dirpng}/${seas}/${sim}/DMAP_${ref}
147   mkdir -p ${dirpng}/${seas}/${sim}/DMAP_${ref}/${proj}
[3684]148
[4330]149   refok=${dirpng}/${seas}/${ref}/MAP/${proj}/${var}.pdf
[4308]150   mapok=${dirpng}/${seas}/${sim}/MAP/${proj}/${var}.pdf
151   dmapok=${dirpng}/${seas}/${sim}/DMAP_${ref}/${proj}/${var}.pdf
152#
153    datevar=`date`
154#
155# for var3D check if pres exist
156#   echo ~/LMDZ/check/make_check_var3D_SE.sh $dirpng $seas $sim $ref $var
157#   ~/LMDZ/check/make_check_var3D_SE.sh $dirpng $seas $sim $ref $var > out_check_var3D_SE.log
[3884]158
[4330]159if [ ! -f ${refok} ] || [ ! -f ${mapok} ] || [ ! -f ${dmapok} ]; then
160
161 echo Fabrication des cartes $var pour $ref $sim $sim-$ref
[4345]162###
163 echo 4 call to climaf instead of 1 to get rid of cache issue
164###
[4308]165 if [ "$var" == "ua" ] || [ "$var" == "va" ] || [ "$var" == "ta" ] || [ "$var" == "hur" ] || [ "$var" == "hus" ]; then
[4345]166###
[4330]167    echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} 
168    $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} 
[4345]169###
170    echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} 
171    $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} 
172#
173    echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} 
174    $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} 
175###
176    echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} 
177    $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} 
178
[4308]179 else
[4345]180    echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin}
181    $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin}
182#
183    echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin}
184    $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin}
185#
186    echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin}
187    $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin}
188#
189    echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin}
190    $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin}
191#
[4308]192 fi
193#
[4330]194else
195 echo Les images $refok
196 echo            $mapok et
197 echo            $dmapok 
198 echo existent deja
199fi
200#
[4308]201   echo Creation graphes png
[4317]202   ${local}/make_pdf2png.sh $dirpng $seas $proj $sim $ref $var > out_pdf2png.log
[4308]203#
204   done
[3884]205
[3885]206   if [ ! -f "$htmlopt"  -o "`wc -l $htmlopt | awk ' { print $1 } '`" = "0" ] ; then
[3915]207      echo ECHEC ATLAS : $htmlopt inexistant ou vide | tee >>  atlas.sh.log
208      echo ECHEC ATLAS : $htmlopt inexistant ou vide
[3684]209   else
210      pwd
211      \cp -f $htmlopt $OUT_D/
[4308]212      sed -i -e "s:thredds\/IPSLFS:thredds\/fileServer\/ipsl_thredds:g" $OUT_D/$htmlopt
213
[3684]214      echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml | tee >>  atlas.sh.log
215      echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml
216   fi
217
[4308]218\rm -f $OUT_D/$keys_strg.ENCOURS
[3684]219
[4330]220#IM041122 \rm -rf $DODSDIR/$login/climafCache$$
[4345]221\rm -rf ${myCC}
Note: See TracBrowser for help on using the repository browser.