source: trunk/src/post_plots.sh @ 257

Last change on this file since 257 was 257, checked in by htune, 5 years ago

Diagnostics
Fredho

  • Property svn:executable set to *
File size: 4.7 KB
Line 
1#!/bin/bash
2
3. env.sh
4
5
6wavemin=1
7wavemax=`ls Remaining_space_after_wave_* | cut -d _ -f5 | cut -d. -f1 | sort -n | tail -1`
8# wavemax can also be set manually
9#wavemax=22
10nwave=$(( $wavemax - $wavemin + 1))
11
12##################################################################
13# Controle of a sublist for the waves shading on profiles
14if [ $wavemax -le 3 ] ; then
15  ListWaves=" `seq 1 $wavemax` "
16else
17  ListWaves=" 1 3 $wavemax "
18fi
19# could be also set manually
20# ListWaves=" 1 3 6 "
21# wave_inc=1
22# ListWaves=$( seq $wavemin $wave_inc $wavemax )
23##################################################################
24
25if [ `python -V   2>&1 | awk ' { print $2 } ' | cut -c1` != 2 ] ; then
26        echo You should use python 2 and not 3 ; exit ; fi
27
28
29###############################################################################
30# Some preliminary computations
31#------------------------------
32#echo $wavemin $wavemax $(seq $wavemin $wavemax) ; exit
33for i in $(seq $wavemin $wavemax) ; do
34        echo $i
35        # Computing scores fore all the SCM simulations if not already done
36        if [ ! -f score$i.csv ] ; then echo Runing post_scores.sh first ; pause 10 ; ./post_scores.sh $wavemin $wavemax ; fi
37        # Compute the mean and max of the ensembles
38        for d in WAVE$i/*/* ; do
39            if [ -d $d ] ; then
40                cd $d
41                for stat in min max avg ; do if [ ! -f ens${stat}.nc ] ; then cdo ens${stat} SCM*nc ens${stat}.nc ; fi ; done
42                cd -
43           fi
44        done
45done
46
47##############################################################################
48# Ranking the SCM simulations according to scores
49#------------------------------------------------
50
51scores=""
52for i in $( seq $wavemin $wavemax ) ; do scores="$scores score$i.csv" ; done
53cat $scores | awk -F, ' { print  $(NF-1)","$0 } ' | sort >| opt_scores.csv
54simss=`head -10 opt_scores.csv | awk -F, ' { print $2 } '`
55echo $simss
56head -1 WAVE$wavemax/Par*asc >| params_opt.csv
57for sim in $simss ; do
58        grep $sim */Par*asc >> params_opt.csv
59done
60
61iname=0
62
63#############################################################################
64# Loop on the best 10 simulations according to the above ranking
65#---------------------------------------------------------------
66
67for sims in "$simss" $simss  ; do
68echo $sims
69
70set -vx
71cat <<eod>| simus.py
72#-*- coding:UTF-8 -*-
73# files that define the lists of the simulations you want to draw and also define information of the profiles
74# time of the profile, color/style of the lines, xmin/xmax, ymin/ymax ranges)
75from datetime import datetime
76
77DIRDATA='./'
78
79nomvar='theta'
80
81# couleurs des courbes
82#---------------------
83# cycle de couleurs
84listcoul=['black','red','green','fuchsia','blue','lime','darkviolet','cyan','darkorange','slateblue','brown','gold']
85
86# exemple dictionnaire de couleurs en fonction du nom de fichier (sans le prefixe time_ ou prof_)
87#black=reference; blue=bb; violet=turb, orange=pas de temps, Diffusion=vert, resolution=grey, advection=red, resv=brown,domain= microphysique=turquoise
88dicocoul={\\
89'SCM.nc' : 'black',\\
90'LES0.nc' : 'slateblue',\\
91'LES1.nc' : 'blue',\\
92'LES2.nc' : 'blue',\\
93'LES3.nc' : 'blue',\\
94'LES4.nc' : 'blue',\\
95'LES5.nc' : 'blue',\\
96'LES6.nc' : 'blue',\\
97'LES7.nc' : 'blue',\\
98'LES8.nc' : 'blue',\\
99eod
100
101cols=( red green fuchsia lime darkviolet cyan darkorange slateblue brown gold )
102ii=0
103for sim in $sims ; do
104cat <<eod>> simus.py
105'$sim.nc' : '${cols[$ii]}',\\
106eod
107(( ii = $ii + 1 ))
108done
109
110cat <<eod>> simus.py
111}
112
113dicostyl={\\
114'SCM.nc' : '-',\\
115'LES0.nc' : '-',\\
116'LES1.nc' : '-.',\\
117'LES2.nc' : '-.',\\
118'LES3.nc' : '-.',\\
119'LES4.nc' : '-.',\\
120'LES5.nc' : '-.',\\
121'LES6.nc' : '-.',\\
122'LES7.nc' : '-.',\\
123'LES8.nc' : '-.',\\
124eod
125
126for sim in $sims ; do
127cat <<eod>> simus.py
128'$sim.nc' : '-',\\
129eod
130done
131
132wave_ens=1
133cat <<eod>> simus.py
134}
135
136# listcoul ou dicocoul ou dicohightune ou ...
137#coul1d=listcoul
138styl1d=dicostyl
139coul1d=dicocoul
140
141# liste des fichiers sélectionnés
142listfic=[\\
143'LES/'+Case+'/'+SubCase+'/LES0.nc',\\
144'LES/'+Case+'/'+SubCase+'/LES1.nc',\\
145'LES/'+Case+'/'+SubCase+'/LES2.nc',\\
146'LES/'+Case+'/'+SubCase+'/LES3.nc',\\
147'LES/'+Case+'/'+SubCase+'/LES4.nc',\\
148'LES/'+Case+'/'+SubCase+'/LES6.nc',\\
149'LES/'+Case+'/'+SubCase+'/LES7.nc',\\
150'LES/'+Case+'/'+SubCase+'/LES8.nc',\\
151eod
152
153
154
155for sim in $sims ; do
156w=`echo $sim | cut -d\- -f2`
157echo $sim $w
158cat <<eod>> simus.py
159'WAVE$w/'+Case+'/'+SubCase+'/$sim.nc',\\
160eod
161done
162
163cat <<eod>> simus.py
164'CTRL/'+Case+'/'+SubCase+'/SCM.nc',\\
165]
166eod
167
168echo 'list_ens=[\'  >> simus.py
169for wave_ens in $ListWaves ; do
170cat <<eod>> simus.py
171'WAVE$wave_ens/'+Case+'/'+SubCase,\\
172eod
173done
174echo ']'  >> simus.py
175
176./post.sh
177mv t.pdf Prof$iname.pdf
178
179mkdir -p PROFILES/BEST$iname
180mv profil*  PROFILES/BEST$iname
181
182
183(( iname = $iname + 1 ))
184
185done
Note: See TracBrowser for help on using the repository browser.