1 | |
---|
2 | dirpng=${DODSDIR}/${login}/lmdz/VLR |
---|
3 | |
---|
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 | \rm -rf $DODSDIR/$login/climafCache$$ |
---|
14 | mkdir -p $DODSDIR/$login/climafCache$$ |
---|
15 | export CLIMAF_CACHE=$DODSDIR/$login/climafCache$$ |
---|
16 | echo CLIMAF_CACHE $DODSDIR/$login/climafCache$$ |
---|
17 | MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu |
---|
18 | DIRATLAS=$DODSDIR/$login/lmdz/atlas |
---|
19 | ######################################################################################################## |
---|
20 | ATLAS_DIR=$DODSDIR/$login/lmdz/atlas/Atlas$$ |
---|
21 | if [ ! -d $DODSDIR/$login/lmdz/atlas/Atlas$$ ] ; then mkdir -p $DODSDIR/$login/lmdz/atlas/Atlas$$ ; fi |
---|
22 | fi |
---|
23 | |
---|
24 | if [ $# = 0 ] ; then |
---|
25 | echo ARG=0 |
---|
26 | comp=$COMP |
---|
27 | dataref=$DATAREF |
---|
28 | fi |
---|
29 | |
---|
30 | echo comp=$comp |
---|
31 | echo dataref=$dataref |
---|
32 | |
---|
33 | Dhtml=/thredds/ipsl/${login}/lmdz/MultiSimu/${comp}/ATLAS |
---|
34 | mkdir -p ${Dhtml} |
---|
35 | |
---|
36 | local=`pwd -P` |
---|
37 | runstxt=$local/runs.txt |
---|
38 | |
---|
39 | login=${login} |
---|
40 | DODSDIR=/thredds/ipsl |
---|
41 | |
---|
42 | echo DODSDIR : $DODSDIR |
---|
43 | MAIN_SE=$DODSDIR/$login/lmdz/SE |
---|
44 | TS_DA=$DODSDIR/$login/lmdz/TS_DA |
---|
45 | TS_MO=$DODSDIR/$login/lmdz/TS_MO |
---|
46 | MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu |
---|
47 | |
---|
48 | COMP_D=$MULTIDIR/$comp |
---|
49 | |
---|
50 | ### |
---|
51 | DEF_FILE=$COMP_D/def.txt ; if [ ! -f $DEF_FILE ] ; then echo renseigner $DEF_FILE ; exit ; fi |
---|
52 | RUNS="" |
---|
53 | RUNS=`awk ' {print $1"_"$2 } ' $DEF_FILE` |
---|
54 | echo $RUNS |
---|
55 | |
---|
56 | ### definir la reference par rapport au flag |
---|
57 | if [ $dataref = 1 ]; then |
---|
58 | ref=OBS |
---|
59 | fi |
---|
60 | echo ref is $ref |
---|
61 | |
---|
62 | ns=0 |
---|
63 | listsimss="" ; |
---|
64 | for ss in `awk ' {print $1"_"$2 } ' $DEF_FILE` ; do |
---|
65 | if [ $dataref = 0 ] ; then |
---|
66 | if [ ${ns} = 0 ] ; then |
---|
67 | ref=$ss |
---|
68 | echo ref is $ref |
---|
69 | fi |
---|
70 | fi |
---|
71 | let "ns = ${ns} + 1" |
---|
72 | listsimss="$listsimss $ss" ; |
---|
73 | done |
---|
74 | |
---|
75 | for sim in $RUNS; do |
---|
76 | echo sim=$sim |
---|
77 | echo sim $sim |
---|
78 | srun=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
---|
79 | echo srun $srun |
---|
80 | simdir=`grep -w "^$srun " $runstxt | awk ' { print $2 } '` |
---|
81 | echo $sim $srun $simdir |
---|
82 | run=`basename $simdir ` |
---|
83 | years=`echo $sim | sed -e 's/'$srun'//' | sed -e 's/_//'` |
---|
84 | sim=${run}_${years} |
---|
85 | echo ================================================================ |
---|
86 | echo la commande suivante |
---|
87 | echo ls -l $MAIN_SE/ORIG/${run}_SE_${years}_1M_histmth.nc |
---|
88 | echo peut prendre beaucoup de temps lorsque |
---|
89 | echo l acces aux espaces du CCRT et/ou de l IDRIS thredds est lent ou si |
---|
90 | echo les espaces /thredds/tgcc et/ou /thredds/idris ne sont pas montes sur ciclad. |
---|
91 | echo On ne l utilise plus !!! |
---|
92 | echo ================================================================ |
---|
93 | ###ls -l ${MAIN_SE}/ORIG/${run}_SE_${years}_1M_histmth.nc |
---|
94 | |
---|
95 | cd $ATLAS_DIR |
---|
96 | |
---|
97 | qsub=qsub |
---|
98 | submit=${qsub} |
---|
99 | |
---|
100 | natlas=`wc -l $COMP_D/atlas-def | awk ' { print $1 } '` |
---|
101 | echo $natlas |
---|
102 | count_atlas=0 |
---|
103 | |
---|
104 | atlas=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 |
---|
203 | done |
---|
204 | |
---|
205 | exit |
---|