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

Last change on this file since 3695 was 3695, checked in by idelkadi, 4 years ago

epository under svn of a first version of Multiatlas diagnostics for LMDZ. This version is adapted to be able to run a LMDZ multiatlas on an individual account on the ciclad machine of the IPSL. In this version, the parts to be modified are identified so as to subsequently adapt it to other machines.
Corrections.

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