source: BOL/Multi_atlas/Utils/multi.sh @ 3915

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

Corrections pour la realisation et l'acceleration des cartes des multi-atlas
IM

  • Property svn:executable set to *
File size: 14.2 KB
Line 
1#set -vx
2
3local=`pwd -P`
4cd $local
5echo REPERTOIRE LOCAL :  $local
6
7echo '############################################################'
8echo  0/ gestion des options
9echo '############################################################'
10pcmdi_metrics=0
11tuning_metrics=1
12und=0
13zon=1
14html=1
15atlas=1
16newatlas=1
17atlas_cesmep=0
18get=0
19cmor=1
20regdyn=0
21lma=0
22trmm=0
23axe2=0
24axe4=0
25esmval2=0
26refld_histo=0
27vertcld_calipso=0
28stations_day=0
29stations_mth=0
30qsub=0
31mjo=0
32river=0
33dataref=1
34
35ref=OBS
36echo $ref
37# ./job_multi.sh -1D 0 -get 0 -atlas 0 -pcmdi 0 -tuning 0 -lma 0 -trmm 0
38runstxt=$local/runs.txt
39
40while test -n "${1}"; do
41   case $1 in
42      -1D) und=$2 ; shift ;;
43      -get) get=$2 ; shift ;;
44      -cmor) cmor=$2 ; shift ;;
45      -zon) zon=$2 ; shift ;;
46      -atlas) atlas=$2 ; shift ;;
47      -atlas_cesmep) atlas_cesmep=$2 ; shift ;;
48      -pcmdi) pcmdi_metrics=$2 ; shift ;;
49      -tuning) tuning_metrics=$2 ; shift ;;
50      -runstxt) runstxt=$2 ; shift ;;
51      -lma) lma=$2 ; shift ;;
52      -trmm) trmm=$2 ; shift ;;
53      -axe4) axe4=$2 ; shift ;;
54      -axe2) axe2=$2 ; shift ;;
55      -regdyn) regdyn=$2 ; shift ;;
56      -esmval2) esmval2=$2 ; shift ;; 
57      -stations_day) stations_day=$2 ; shift ;; 
58      -stations_mth) stations_mth=$2 ; shift ;; 
59      -refld_histo) refld_histo=$2 ; shift ;;
60      -vertcld_calipso) vertcld_calipso=$2 ; shift ;;
61      -mjo) mjo=$2 ; shift ;; 
62      -river) river=$2 ; shift ;;
63      -dataref) dataref=$2 ; shift ;;
64      *) comp=$1 ;;
65   esac
66   shift
67done
68
69rm -f out.com$$
70runstxt=$local/runs.txt
71echo runstxt= $runstxt
72
73echo DODSDIR : $DODSDIR
74MAIN_SE=$DODSDIR/$login/lmdz/SE
75TS_DA=$DODSDIR/$login/lmdz/TS_DA
76TS_MO=$DODSDIR/$login/lmdz/TS_MO
77MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu
78
79if [ ! -d $MULTIDIR ] ; then mkdir -p $MULTIDIR ; fi
80if [ ! -d $MAIN_SE ] ; then mkdir -p $MAIN_SE ; fi
81if [ ! -d $MAIN_MO ] ; then mkdir -p $MAIN_MO ; fi
82if [ ! -d $MAIN_DA ] ; then mkdir -p $MAIN_DA ; fi
83
84COMP_D=$MULTIDIR/$comp
85DEF_FILE=$COMP_D/def.txt ; if [ ! -f $DEF_FILE ] ; then echo renseigner $DEF_FILE ; exit ; fi
86
87listsims=""  ; for s  in `awk ' {print $1} ' $DEF_FILE | uniq`          ; do listsims="$listsims $s"    ; done
88echo listsims $listsims
89
90echo ### On supprime dans def.txt les lignes vides ########
91sed -i "/^[ \t]*$/d" $DEF_FILE
92
93echo ### On teste d abord la coherence des noms des simulations dans def.txt et $runstxt ################
94echo MULTI-ATLAS "$comp"
95for s in $listsims ; do
96srun=`grep -w "^$s "  $runstxt | awk ' { print $1 } '`
97echo 's='"$s" '    srun='  "$srun"
98if [ "$s" = "$srun" ] ; then
99   echo Meme nom de la simulation dans def.txt et $runstxt 's=' "$s" '    srun='  "$srun"
100else
101   echo ATTENTION : la simulation "$s" de votre def.txt n est pas repertoriee dans $runstxt 
102   echo             ou le meme nom est attribue a plusieures simulations
103   echo Il faut la rajouter dans $runstxt 
104   echo avec le chemin vers les SE et TS dans ciclad : /modfs/$login/IGCM_OUT
105   echo             ou renomer votre simulation
106exit
107fi
108done
109#exit
110listruns=""
111listrunss=""
112listrunse=""
113if [ ! -d $MAIN_SE/ORIG ] ; then mkdir -p $MAIN_SE/ORIG ; fi
114for s in $listsims ; do 
115simdir=`grep -w "^$s "  $runstxt | awk ' { print $2 } '`
116echo $simdir
117( cd $MAIN_SE/ORIG ; ln -sf $simdir/ATM/Analyse/SE/*mth*nc . ) > /dev/null 2>&1
118echo $simdir
119ss=`basename $simdir `
120listruns="$listruns $ss"
121for year in `grep -w "^$s" $DEF_FILE | awk ' { print $2 } '` ; do
122listrunss="$listrunss ${ss}_$year"
123listrune="$listrune ${ss}_SE_$year"
124done
125done
126echo listruns = $listruns
127echo listrunss= $listrunss
128echo listrune= $listrune 
129echo ================================================================
130echo la commande suivante
131echo ls -lrt $MAIN_SE/ORIG
132echo peut prendre beaucoup de temps lorsque
133echo l acces aux espaces du CCRT et/ou de l IDRIS thredds est lent ou si
134echo les espaces /thredds/tgcc et/ou /thredds/idris ne sont pas montes sur ciclad.
135echo On ne l utilise plus !!!
136echo ================================================================
137###ls -lrt $MAIN_SE/ORIG
138
139ns=0
140listsimss="" ; 
141for ss in `awk ' {print $1"_"$2 } ' $DEF_FILE`    ; do 
142if [ $dataref = 0 ] ; then
143   if [ ${ns} = 0 ] ; then
144      ref=$ss
145      echo ref=$ref
146   fi 
147fi
148let "ns = ${ns} + 1"
149listsimss="$listsimss $ss" ; 
150done
151echo ref=$ref
152
153listsimse="" ; for se in `awk ' {print $1"_SE_"$2 } ' $DEF_FILE` ; do listsimse="$listsimse $se" ; done
154echo listsims $listsims
155echo listsimss $listsimss
156echo listsimse $listsimse
157
158echo SIMULATIONS: $listsims
159
160RUNS=""
161RUNS=`awk ' {print $1"_"$2 } ' $DEF_FILE`
162echo $RUNS
163echo listrunss=$RUNS
164
165echo '########################################################################'
166echo  1/ Rapatriement des simulations manquantes
167echo '########################################################################'
168#### AI avril 2020 ################ Avant l acces directe aux simulations sur le dods du CCRT
169# Adresses web ne sont plus a jours
170# A commenter les adresses web CCRT
171# A mettre a jours les adress web IDRIS
172# Rajouter d'autres machines avec rsynk, wget ou ssh ...
173
174if [ $get = 1 ] ; then
175 cd $MAIN_SE
176 for sim in $listsimss ; do echo ./getun.sh ${sim} >> $local/out.com$$ ; ./getun.sh ${sim} ; done
177 cd $TS_DA ; pwd
178 for sim in $listsimss ; do echo ./getun.sh ${sim} >> $local/out.com$$ ; ./getun.sh ${sim} ; done
179 cd $TS_MO ; pwd
180 for sim in $listsimss ; do echo ./getun.sh ${sim} >> $local/out.com$$ ; ./getun.sh ${sim} ; done
181fi
182
183if [ $cmor = 1 ] ; then
184 cp cmor.sh $MAIN_SE/.
185 cp season.sh $MAIN_SE/.
186 cd $MAIN_SE
187 chmod +x cmor.sh
188 chmod +x season.sh
189#########################################################################
190# 1.2 "Cmorisation des fichiers mensuels : traduction au format CMIP
191#########################################################################
192# Deux lignes suivantes modif FH 2016/11/09
193# Files are taken from /modfs/ipslfs/dods/fabric/lmdz/SE/ORIG and
194# results are in /modfs/ipslfs/dods/fabric/lmdz/SE/CMOR
195#########################################################################
196 ./cmor.sh -runsfile $runstxt $comp
197if [ $? != 0 ] ; then exit ; fi # Probleme de histmth non present. On arrete tout
198
199#########################################################################
200# 1.3 Interpolate fields on a common horizontal grid (VLR) and
201#########################################################################
202#     average in time "YEAR", "JJA" ...
203#     Results are put on
204#     /modfs/ipslfs/dods/fabric/lmdz/VLR/YEAR/[SIMU_NAME]_[period]/NC
205#     If wanting to rerun season.sh for observations :
206#     ./season.sh -s OBS
207#########################################################################
208 ./season.sh -comp $comp
209 cd $local
210fi
211
212echo '########################################################################'
213echo  2/ Lancement des atlas manquant
214echo '########################################################################'
215natlas=`wc -l $COMP_D/atlas-def | awk ' { print $1 } '`
216count_atlas=0
217
218if [ $atlas = 1 ] ; then
219if [ $newatlas = 1 ]; then
220sed -e 's/COMPAR/'${comp}'/' ${local}/atlas/make_atlas.sh > ${local}/atlas/make_atlas_${comp}.sh
221$submit -v COMP=${comp},DATAREF=${dataref} ${local}/atlas/make_atlas_${comp}.sh
222
223else
224
225for sim in $listsimss ; do
226   il=1
227   if [ ! -f $COMP_D/atlas-def ] ; then
228      echo Definir les atlas a construire dans $COMP_D/atlas-def
229      echo Example :
230      cat $COMP_D/../CMIP5to6/atlas-def
231   fi
232   while [ $il -le $natlas ] ; do
233      line=`sed -n -e ${il}p $COMP_D/atlas-def`
234      seas=`echo $line | awk ' { print $1 } '`
235      proj=`echo $line | awk ' { print $2 } '`
236      vars=`echo $line | awk ' { print $3 } '`
237      atlas=${sim}+${seas}+${proj}+$vars
238      echo AAAAAAAAAAAAAAAAAAAAAAAA $atlas
239      #grep $atlas $COMP_D/ATLAS/atlas_OK
240      echo BBBBBB
241      #if [ "`grep $atlas $COMP_D/ATLAS/atlas_OK`" = "" ] ; then
242         cd $local/atlas ; pwd ; ls -l atlas.sh
243         varg=`echo $vars | sed -e 's/,/+/g'`
244         echo Atlas $atlas a creer
245         if [ $qsub = 0 ] ; then
246            #./atlas.sh RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=OBS,VARS="$varg",RUNSTXT=$runstxt
247            ./atlas.sh RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=$ref,VARS="$varg",RUNSTXT=$runstxt
248         else
249            #$submit -v RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=OBS,VARS="$varg",RUNSTXT=$runstxt atlas.sh
250            $submit -v RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=$ref,VARS="$varg",RUNSTXT=$runstxt atlas.sh
251         fi
252         #echo $submit -v RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=OBS,VARS="$varg" atlas.sh >> out.com$$
253         echo $submit -v RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=$ref,VARS="$varg" atlas.sh >> out.com$$
254         #echo $submit -v RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=OBS,VARS="$varg" atlas.sh
255         echo $submit -v RUN=$sim,SEASON=$seas,PROJ=$proj,OUTDIR=$COMP_D/ATLAS,REF=$ref,VARS="$varg" atlas.sh
256         (( count_atlas = $count_atlas + 1 ))
257      #else
258           #echo Atlas $atlas existant
259      #fi
260      (( il = $il + 1 ))
261   done
262done
263if [ $count_atlas != 0 ] ; then
264    echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
265    echo Les atlas manquant ont ete lances. Attendre leur
266    echo creation pour relancer job_multi.sh
267    echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
268#   exit
269fi
270
271fi #newatlas
272fi #atlas
273
274# atlas_cesmep : cles pour activer les nouveau atlas (C-ESM-EP)
275if [ $atlas_cesmep = 1 ] ; then
276   cd ~/LMDZ/C-ESM-EP
277   ./AtlasLMDZ.sh -runsfile $runstxt $comp 
278fi # atlas_cesmep
279
280echo '########################################################################'
281echo  3/ Calcul des moyennes zonales nco
282echo '########################################################################'
283
284
285#trace moy.zonale OBS + multi-simulations
286if [ $zon = 1 ] ; then
287   cd $local
288   mkdir -p $COMP_D/ZON
289   for sim in $listsimse OBS ; do
290      years=`echo $sim | sed -e 's/_SE_/ /' | awk ' { print $2 } '`
291      run=`echo $sim | sed -e 's/_SE_/ /' | awk ' { print $1 } '`
292      ./make_MOY.sh "$years" YEAR "$run" GLOB
293      ./make_MOY.sh "$years" YEAR "$run" ZON
294      ./make_MOY.sh "$years" JJA "$run"  ZON
295      ./make_MOY.sh "$years" DJF "$run"  ZON
296      ./make_MOY.sh "$years" JJAS "$run" AMMACROSS
297   done
298   cd $local
299### ajout nuages LMDZ dans la compa et doit faire des liens symbol. sur
300#### les OBS calipso toujurs pour le moment
301   ./mk_clouds_NOcalipso.sh YEAR ZON
302   ./mk_clouds_NOcalipso.sh DJF ZON
303   ./mk_clouds_NOcalipso.sh JJA ZON
304   ./mk_clouds_NOcalipso.sh JJAS AMMACROSS
305#
306   pwd
307   ./multi_ZONE.sh YEAR $comp ZON -runsfile $runstxt
308   ./multi_ZONE.sh JJA $comp ZON -runsfile $runstxt
309   ./multi_ZONE.sh DJF $comp ZON -runsfile $runstxt
310   ./multi_ZONE.sh JJAS $comp AMMACROSS -runsfile $runstxt
311
312fi
313
314echo '########################################################################'
315echo 4/ Lancement du 1D si necessaire
316echo '########################################################################'
317if [ ! -f $COMP_D/1D/1D.html -a $und = 1  ] ; then
318    cd $COMP_D
319    ~/LMDZ/1D/serie1d.sh $comp
320    cd $local
321fi
322
323echo '########################################################################'
324echo 5/ Métriques
325echo '########################################################################'
326if [ $tuning_metrics = 1 -a ! -d $COMP_D/METRICS ] ; then
327   echo metrics.sh
328   cd $local/METRICS
329   ./metrics.sh $comp
330fi
331
332if [ $regdyn = 1 ]; then
333   cd ~/users/musat/regdyn/clean_regdyn
334   ./mk_all_regdyn.sh $comp 0
335   cd $local
336fi
337
338if [ $esmval2 = 1 ]; then
339   cd $local
340   ./cvdp4atlas.sh $comp
341   ./perfm4atlas.sh $comp
342fi   
343
344if [ $mjo = 1 ]; then
345   cd ~/users/idelkadi/MJO
346   ./make_diagnosMJO.sh $comp
347fi
348
349if [ $river = 1 ]; then 
350   cd ~/users/idelkadi/AXE1/River
351   ./make_diagnoRiver.sh $comp
352fi 
353
354if [ $lma = 1 ]; then
355   cd $local
356   ./make_lma.sh $comp
357fi
358if [ $axe2 = 1 ]; then
359   cd $local
360   ./make_axe2.sh -runstxt $runstxt $comp
361fi
362if [ $trmm = 1 ]; then
363   cd ~/users/mbonaz/
364   ./Axe2_Marine.sh $comp
365   cd $local
366fi
367cd $local
368if [ $pcmdi_metrics = 1 ] ; then
369   ./make_pcmdi.sh $comp
370fi
371if [ $axe4 = 1 ]; then
372  cd $local
373   ./make_axe4.sh $comp
374fi
375
376if [ "$reflcld_histo" = "1" ] ; then
377   cd ~/users/idelkadi/AXE3/
378   ./make_scatReflCld.sh $comp
379   cd $local
380fi
381
382if [ $vertcld_calipso = 1 ] ; then
383   cd ~/users/idelkadi/AXE3/Calipso/CoupeVerticale/DJF
384   ./make_VerticalMzCldCalipso.sh $comp
385   cd ~/users/idelkadi/AXE3/Calipso/CoupeVerticale/JJA
386   ./make_VerticalMzCldCalipso.sh $comp
387   cd ~/users/idelkadi/AXE3/Calipso/Stratos
388   ./make_StratosCalipso.sh $comp
389fi
390
391
392echo '########################################################################'
393echo 6/ Stations
394echo '########################################################################'
395
396if [ $stations_day = 1 ] ; then
397   ~/users/Binta/bibi.sh $comp
398   ~/users/cheruy/bibi.sh $comp
399fi
400
401if [ $stations_mth = 1 ] ; then
402   ~/users/traore/SE_buoy.sh $comp
403fi
404
405echo '########################################################################'
406echo 7/ generation des pages html
407echo '########################################################################'
408
409if [ $html = 1 ] ; then
410   echo ./make_html_libigcm_ai.sh --comp $comp
411   ./make_html_libigcm.sh --comp $comp
412   cd $local
413   ./html_entete.sh ${comp} ${dataref}
414   ./make_index_html.sh ${comp} ${dataref}
415   ./html_tuning.sh  $comp
416   ./html_tuning_min.sh  $comp
417   ./html_accueil.sh  $comp
418   ./html_1D.sh  $comp
419   ./html_lma.sh $comp
420   ./html_pcmdi.sh $comp
421   ./html_all.sh >| $MULTIDIR/all.html
422
423   # html pour les métriques
424#   cat $COMP_D/entete.html doc_pcmdi.html >| $COMP_D/PCMDI.html
425#   ref=`echo $listsimss | awk ' { print $1 } '`
426#   echo "<h1> Metrics with respect to $ref </h1>" >>  $COMP_D/PCMDI.html
427#   cat $COMP_D/pcmdi_metrics.html >> $COMP_D/PCMDI.html
428#   echo "<h1> Metrics with respect to AR4.00 </h1>" >>  $COMP_D/PCMDI.html
429#   cat $COMP_D/metrics-AR4-as-ref.html >> $COMP_D/PCMDI.html
430#   echo "<h1> Metrics with respect to CMIP5/AMIP multi model </h1>" >>  $COMP_D/PCMDI.html
431#   cat $COMP_D/metrics-CMIP5-AMIP-as-ref.html >> $COMP_D/PCMDI.html
432   for i in 1 2 3 4 5 6 7 ; do
433        ./html_axe$i.sh  $comp
434   done
435   for proj in GLOB SH NH ; do
436   for bias in BIAS MAPS ; do
437       for season in YEAR DJF JJA ; do
438        echo ./multi_atlas.sh $comp $bias $season $proj $RUNS 
439        ./multi_atlas.sh $comp $bias $season $proj $RUNS  >> out.com$$
440       done
441   done
442   done
443#exit
444#   cd $COMP_D
445#   ln -sf BIASYEAR.html  $comp.html
446#   ln -sf ACCUEIL.html  $comp.html
447cd $local
448./webpage_multi.sh $comp
449
450fi
Note: See TracBrowser for help on using the repository browser.