source: BOL/Multi_atlas/Utils/make_atlas0.sh @ 4999

Last change on this file since 4999 was 3916, checked in by musat, 3 years ago

Ajout scripts pour la realisation/l'acceleration des multi-atlas
IM

  • Property svn:executable set to *
File size: 7.4 KB
Line 
1
2dirpng=${DODSDIR}/${login}/lmdz/VLR
3
4if [ ${hostname:0:5} = cicla ] ; then
5########################################################################################################
6# Environnement
7module purge
8module load netcdf4/4.3.3.1-ifort cdo/1.6.8 nco/4.5.2  ncl/6.3.0
9ulimit -s unlimited
10export 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
11export PATH=$PATH:/home/fabric/users/denvil/climaf/bin
12STORAGE=$DODSDIR/$login/lmdz/STORE
13\rm -rf $DODSDIR/$login/climafCache$$
14mkdir -p $DODSDIR/$login/climafCache$$
15export CLIMAF_CACHE=$DODSDIR/$login/climafCache$$
16echo CLIMAF_CACHE $DODSDIR/$login/climafCache$$
17MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu
18DIRATLAS=$DODSDIR/$login/lmdz/atlas
19########################################################################################################
20ATLAS_DIR=$DODSDIR/$login/lmdz/atlas/Atlas$$
21if [ ! -d $DODSDIR/$login/lmdz/atlas/Atlas$$ ] ; then mkdir -p $DODSDIR/$login/lmdz/atlas/Atlas$$ ; fi
22fi
23
24if [ $# = 0 ] ; then
25 echo ARG=0
26   comp=$COMP
27   dataref=$DATAREF
28fi
29
30echo comp=$comp
31echo dataref=$dataref
32
33Dhtml=/thredds/ipsl/${login}/lmdz/MultiSimu/${comp}/ATLAS
34mkdir -p ${Dhtml}
35
36local=`pwd -P`
37runstxt=$local/runs.txt
38
39login=${login}
40DODSDIR=/thredds/ipsl
41
42echo DODSDIR : $DODSDIR
43MAIN_SE=$DODSDIR/$login/lmdz/SE
44TS_DA=$DODSDIR/$login/lmdz/TS_DA
45TS_MO=$DODSDIR/$login/lmdz/TS_MO
46MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu
47
48COMP_D=$MULTIDIR/$comp
49
50###
51DEF_FILE=$COMP_D/def.txt ; if [ ! -f $DEF_FILE ] ; then echo renseigner $DEF_FILE ; exit ; fi
52RUNS="" 
53RUNS=`awk ' {print $1"_"$2 } ' $DEF_FILE`
54echo $RUNS
55
56### definir la reference par rapport au flag
57if [ $dataref = 1 ]; then
58ref=OBS
59fi
60echo ref is $ref
61
62ns=0
63listsimss="" ;
64for ss in `awk ' {print $1"_"$2 } ' $DEF_FILE`    ; do
65if [ $dataref = 0 ] ; then
66   if [ ${ns} = 0 ] ; then
67      ref=$ss
68      echo ref is $ref
69   fi
70fi
71let "ns = ${ns} + 1"
72listsimss="$listsimss $ss" ;
73done
74
75for sim in $RUNS; do
76echo sim=$sim
77echo sim $sim
78srun=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'`
79echo srun $srun
80simdir=`grep -w "^$srun " $runstxt | awk ' { print $2 } '`
81echo $sim $srun $simdir
82run=`basename $simdir `
83years=`echo $sim | sed -e 's/'$srun'//' | sed -e 's/_//'`
84sim=${run}_${years}
85echo ================================================================
86echo la commande suivante
87echo ls -l $MAIN_SE/ORIG/${run}_SE_${years}_1M_histmth.nc
88echo peut prendre beaucoup de temps lorsque
89echo l acces aux espaces du CCRT et/ou de l IDRIS thredds est lent ou si
90echo les espaces /thredds/tgcc et/ou /thredds/idris ne sont pas montes sur ciclad.
91echo On ne l utilise plus !!!
92echo ================================================================
93###ls -l ${MAIN_SE}/ORIG/${run}_SE_${years}_1M_histmth.nc
94
95cd $ATLAS_DIR
96
97qsub=qsub
98submit=${qsub}
99
100natlas=`wc -l $COMP_D/atlas-def | awk ' { print $1 } '`
101echo $natlas
102count_atlas=0
103
104atlas=1
105   il=1
106   if [ ! -f $COMP_D/atlas-def ] ; then
107      echo Definir les atlas a construire dans $COMP_D/atlas-def
108      echo Example :
109      cat $COMP_D/../CMIP5to6/atlas-def
110   fi
111   while [ $il -le $natlas ] ; do
112      line=`sed -n -e ${il}p $COMP_D/atlas-def`
113      seas=`echo $line | awk ' { print $1 } '`
114      proj=`echo $line | awk ' { print $2 } '`
115      vars=`echo $line | awk ' { print $3 } '`
116      atlas=${sim}+${seas}+${proj}+$vars
117      varg=`echo $vars | sed -e 's/,/ /g'`
118         if [ $qsub = 0 ] ; then
119            ./atlas.sh RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=$ref,VARS="$varg",RUNSTXT=$runstxt
120         else
121          for var in $varg; do
122           mkdir -p ${dirpng}/${seas}/${ref}/MAP
123           if [ "${sim}" != "OBS" ]; then
124            mkdir -p ${dirpng}/${seas}/${sim}/MAP
125            mkdir -p ${dirpng}/${seas}/${sim}/DMAP_${ref}
126            mapok=${dirpng}/${seas}/${sim}/MAP/${var}.pdf
127            dmapok=${dirpng}/${seas}/${sim}/DMAP_${ref}/${var}.pdf
128           if [ ! -f ${mapok} ] || [ ! -f ${dmapok} ]; then
129            \rm -rf $DODSDIR/$login/climafCache$$
130            if [ ! -d $DODSDIR/$login/climafCache$$ ] ; then 
131             mkdir -p $DODSDIR/$login/climafCache$$ ; 
132            fi
133            export CLIMAF_CACHE=$DODSDIR/$login/climafCache$$
134            datevar=`date`
135            echo before python var=$var $datevar
136            echo python /data/${login}/Multi_atlas/atlas/atlas_none.py -v ${var} -s ${sim} -t ${ref} -p ${seas} --dirpng ${dirpng}
137#IM : test si pres existe pour l interpolation des vars. 3D s/ des niveaux de pression
138            if [ $var == ua ] || [ $var == va ] || [ $var == ta ] || [ $var == hur ] || [ $var == hus ]; then
139             run=`basename $simdir `
140             echo sim=$sim
141             echo sim $sim
142             srun=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'`
143             echo srun $srun
144             simdir=`grep -w "^$srun " $runstxt | awk ' { print $2 } '`
145             echo $sim $srun $simdir
146             run=`basename $simdir `
147             years=`echo $sim | sed -e 's/'$srun'//' | sed -e 's/_//'`
148             sim=${run}_${years}
149
150             if [ -f ${MAIN_SE}/ORIG/${run}_SE_${years}_1M_histmth.nc ]; then
151              CheckPres=`ncdump -c ${MAIN_SE}/ORIG/${run}_SE_${years}_1M_histmth.nc|grep -i 'float pres('`
152              echo MAIN_SE/ORIG
153              ls -l ${MAIN_SE}/ORIG/${run}_SE_${years}_1M_histmth.nc
154
155             elif [ -f ${simdir}/ATM/Analyse/SE/${run}_SE_${years}_1M_histmth.nc]; then
156              CheckPres=`ncdump -c ${simdir}/ATM/Analyse/SE/${run}_SE_${years}_1M_histmth.nc|grep -i 'float pres('`
157              echo ATM/Analyse/SE
158              ls -l ${MAIN_SE}/ORIG/${run}_SE_${years}_1M_histmth.nc
159
160             else
161              \rm years.txt
162              echo $years > years.txt
163              sed -i -e 's/_/ /' years.txt
164              yrbegin=`more years | awk '{print $1}'`
165              yrend=`more years | awk '{print $2}'`
166              CheckPres=`ncdump -c ${simdir}/ATM/Output/MO/${run}_${yrbegin}*_${yrend}*_1M_histmth.nc|grep -i 'float pres('`
167              echo ls -l ATM/Output/MO
168              ls -l ${simdir}/ATM/Output/MO/${run}_${yrbegin}*_${yrend}*_1M_histmth.nc
169             fi
170
171             if [ $CheckPres == ""]; then
172               echo pres is not available in the input file, stop here!
173               echo Modify atlas-def and launch multi-comparaison $comp again!
174               exit
175             fi 
176            fi 
177              python /data/${login}/Multi_atlas/atlas/atlas_none.py -v ${var} -s ${sim} -t ${ref} -p ${seas} --dirpng ${dirpng}
178            datevar=`date`
179            echo after python var=$var $datevar
180            mv index_GLOB_${seas}_${sim}.html $Dhtml/.
181
182            din=${dirpng}/${seas}/${sim}/MAP
183            cd ${din}
184            convert ${var}.pdf ${var}.png
185            convert -size 1500x1000 xc:white ${var}.png -geometry 1440x890+30+30 -composite -trim -gravity North ${var}.png
186
187            din=${dirpng}/${seas}/${sim}/DMAP_${ref}
188            cd ${din}
189            convert ${var}.pdf ${var}.png
190            convert -size 1500x1000 xc:white ${var}.png -geometry 1440x890+30+30 -composite -trim -gravity North ${var}.png
191
192            convert dmapzon${var}.pdf dmapzon${var}.png
193            convert -size 1500x1000 xc:white dmapzon${var}.png -geometry 1440x890+30+30 -composite -trim -gravity North dmapzon${var}.png
194
195            cd ${local}
196           fi
197           fi
198          done
199         fi
200         (( count_atlas = $count_atlas + 1 ))
201      (( il = $il + 1 ))
202   done
203done
204
205exit
Note: See TracBrowser for help on using the repository browser.