1 | ########################################################################### |
---|
2 | # Environnement |
---|
3 | local=`pwd -P` |
---|
4 | |
---|
5 | source ~/env_Multi_atlas.sh |
---|
6 | |
---|
7 | module list |
---|
8 | python=`which python` |
---|
9 | echo PYTHON IS $python |
---|
10 | |
---|
11 | ulimit -s unlimited |
---|
12 | ATLAS_DIR=${DODSDIR}/${login}/lmdz/atlas/Atlas$$ ; mkdir -p $ATLAS_DIR |
---|
13 | STORAGE=${DODSDIR}/${login}/lmdz/STORE |
---|
14 | dirpng=${DODSDIR}/${login}/lmdz/VLR |
---|
15 | |
---|
16 | if [ 1 == 0 ]; then |
---|
17 | export PYTHONPATH=$PYTHONPATH:/home/fabric/users/denvil/climaf |
---|
18 | export PATH=$PATH:/home/fabric/users/denvil/climaf/bin |
---|
19 | fi |
---|
20 | |
---|
21 | #myCC=$DODSDIR/$login/IMclimafCache |
---|
22 | #if [ 1 == 0 ]; then |
---|
23 | #myCC=/scratchu/${login}/climafCache041122run |
---|
24 | myCC=/scratchu/${login}/climafCache$$ |
---|
25 | \rm -rf ${myCC} |
---|
26 | mkdir -p ${myCC} |
---|
27 | export CLIMAF_CACHE=${myCC} |
---|
28 | echo CLIMAF_CACHE ${CLIMAF_CACHE} |
---|
29 | mkdir -p ${CLIMAF_CACHE}/remote_data |
---|
30 | export 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$$ |
---|
37 | ########################################################################### |
---|
38 | vars="" |
---|
39 | vars="sst" |
---|
40 | #runstxt=/home/fabric/LMDZ/multi/runs.txt |
---|
41 | |
---|
42 | if [ $# = 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 |
---|
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 |
---|
61 | done |
---|
62 | elif [ $# = 0 ] ; then |
---|
63 | sim=$RUN |
---|
64 | ref=$REF |
---|
65 | seas=$SEASON |
---|
66 | proj=$PROJ |
---|
67 | OUT_D=$OUTDIR |
---|
68 | runstxt=$RUNSTXT |
---|
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 |
---|
78 | else |
---|
79 | echo USE |
---|
80 | echo Job mode : |
---|
81 | echo qsub -v RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas atlas.sh |
---|
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 |
---|
85 | fi |
---|
86 | |
---|
87 | if [ "$vars" = "" ] ; then |
---|
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" |
---|
89 | fi |
---|
90 | |
---|
91 | if [ "$sim" != "OBS" ]; then |
---|
92 | echo sim $sim |
---|
93 | srun=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
---|
94 | echo srun $srun |
---|
95 | simdir=`grep -w "^$srun " $runstxt | awk ' { print $2 } '` |
---|
96 | run=`basename $simdir ` |
---|
97 | years=`echo $sim | sed -e 's/'$srun'//' | sed -e 's/_//'` |
---|
98 | sim=${run}_${years} |
---|
99 | |
---|
100 | echo $run $years $sim $ref |
---|
101 | echo ENTREES : $run, $years, $seas, $vars, $ref |
---|
102 | echo simdir $simdir |
---|
103 | |
---|
104 | echo run $run |
---|
105 | echo sim $sim |
---|
106 | echo simdir $simdir |
---|
107 | fi |
---|
108 | |
---|
109 | keys_strgv=$sim$seas$proj$vars$ref |
---|
110 | keys_strg=$sim$seas$proj$ref |
---|
111 | |
---|
112 | mkdir -p $OUT_D |
---|
113 | if [ -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 |
---|
116 | else |
---|
117 | touch $OUT_D/$keys_strg.ENCOURS |
---|
118 | fi |
---|
119 | |
---|
120 | if [ "$OUT_D" = "" ] ; then |
---|
121 | $OUT_D=$STORAGE/NPV5LRL79/$run/ATLAS/SE_$years/ATM |
---|
122 | fi |
---|
123 | |
---|
124 | cd $ATLAS_DIR |
---|
125 | echo sim $sim seas $seas > atlas.sh.log |
---|
126 | |
---|
127 | case "$proj" in |
---|
128 | "SH"|"NH") pyatlas="atlas_SH.py --projection $proj" ;; |
---|
129 | "GLOB") Var3D=,ua,va,ta,hus,hur ; pyatlas=atlas_none.py ;; |
---|
130 | *) Var3D=,ua,va,ta,hus,hur ; pyatlas=atlas_none.py ;; |
---|
131 | esac |
---|
132 | |
---|
133 | html=index_example_"$seas"_"$sim".html |
---|
134 | htmlopt=index_"${proj}"_"$seas"_"$sim".html |
---|
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} |
---|
148 | |
---|
149 | refok=${dirpng}/${seas}/${ref}/MAP/${proj}/${var}.pdf |
---|
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 |
---|
158 | |
---|
159 | if [ ! -f ${refok} ] || [ ! -f ${mapok} ] || [ ! -f ${dmapok} ]; then |
---|
160 | |
---|
161 | echo Fabrication des cartes $var pour $ref $sim $sim-$ref |
---|
162 | ### |
---|
163 | echo 4 call to climaf instead of 1 to get rid of cache issue |
---|
164 | ### |
---|
165 | if [ "$var" == "ua" ] || [ "$var" == "va" ] || [ "$var" == "ta" ] || [ "$var" == "hur" ] || [ "$var" == "hus" ]; then |
---|
166 | ### |
---|
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} |
---|
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 | |
---|
179 | else |
---|
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 | # |
---|
192 | fi |
---|
193 | # |
---|
194 | else |
---|
195 | echo Les images $refok |
---|
196 | echo $mapok et |
---|
197 | echo $dmapok |
---|
198 | echo existent deja |
---|
199 | fi |
---|
200 | # |
---|
201 | echo Creation graphes png |
---|
202 | ${local}/make_pdf2png.sh $dirpng $seas $proj $sim $ref $var > out_pdf2png.log |
---|
203 | # |
---|
204 | done |
---|
205 | |
---|
206 | if [ ! -f "$htmlopt" -o "`wc -l $htmlopt | awk ' { print $1 } '`" = "0" ] ; then |
---|
207 | echo ECHEC ATLAS : $htmlopt inexistant ou vide | tee >> atlas.sh.log |
---|
208 | echo ECHEC ATLAS : $htmlopt inexistant ou vide |
---|
209 | else |
---|
210 | pwd |
---|
211 | \cp -f $htmlopt $OUT_D/ |
---|
212 | sed -i -e "s:thredds\/IPSLFS:thredds\/fileServer\/ipsl_thredds:g" $OUT_D/$htmlopt |
---|
213 | |
---|
214 | echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml | tee >> atlas.sh.log |
---|
215 | echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml |
---|
216 | fi |
---|
217 | |
---|
218 | \rm -f $OUT_D/$keys_strg.ENCOURS |
---|
219 | |
---|
220 | #IM041122 \rm -rf $DODSDIR/$login/climafCache$$ |
---|
221 | \rm -rf ${myCC} |
---|