1 | #!/bin/bash |
---|
2 | |
---|
3 | source ~/env_Multi_atlas.sh |
---|
4 | |
---|
5 | ################################################### |
---|
6 | # remplace l'ancien multi_ZON.sh |
---|
7 | # Trace les moyennes zonales multi-simulations |
---|
8 | # a partir de fichiers ascii deja traités. |
---|
9 | ################################################### |
---|
10 | |
---|
11 | SEAS=$1 |
---|
12 | comp=$2 |
---|
13 | ZONE=$3 |
---|
14 | |
---|
15 | MAINDIR=$DODSDIR/$login/lmdz |
---|
16 | |
---|
17 | runstxt=`pwd`/runs.txt |
---|
18 | |
---|
19 | while test -n "${1}"; do |
---|
20 | case $1 in |
---|
21 | "-runsfile") runstxt=$2 ; shift ;; |
---|
22 | esac |
---|
23 | shift |
---|
24 | done |
---|
25 | |
---|
26 | |
---|
27 | GR=VLR |
---|
28 | force_create=1 |
---|
29 | |
---|
30 | local=`pwd` |
---|
31 | |
---|
32 | latmin=-90. |
---|
33 | latmax=90. |
---|
34 | if [ $ZONE = AMMACROSS ] ; then |
---|
35 | latmin=-5. |
---|
36 | latmax=25. |
---|
37 | fi |
---|
38 | |
---|
39 | COMP_D=$MAINDIR/MultiSimu/$comp |
---|
40 | outd=$COMP_D/$ZONE/$SEAS |
---|
41 | |
---|
42 | DEF_FILE=$COMP_D/def.txt |
---|
43 | echo $COMP_D |
---|
44 | |
---|
45 | listsims="" ; for s in `awk ' {print $1} ' $DEF_FILE` ; do listsims="$listsims $s" ; done |
---|
46 | echo listsims $listsims |
---|
47 | |
---|
48 | sims="OBS " |
---|
49 | |
---|
50 | echo listsims= $listsims |
---|
51 | |
---|
52 | for s in $listsims ; do |
---|
53 | simdir=`grep -w "^$s " $runstxt | awk ' { print $2 } '` |
---|
54 | ss=`basename $simdir ` |
---|
55 | year=`grep -w "^$s" $DEF_FILE | awk ' { print $2 } '` |
---|
56 | sims="$sims ${s}_$year" |
---|
57 | done |
---|
58 | |
---|
59 | echo $SEAS $outd "$sims" |
---|
60 | |
---|
61 | vars="pr prw rstt rlut rtt crelt crest crett hfns hfls eva tas sst tauu tauv psl zg500 rsts rsut rlutcs albs albt cress crels crets rts rah rahcs rahcre rlah rlahcs rlahcre rsah rsahcs rsahcre hurs hfss rldscs rlds rlus rsdscs rsds rsus rsuscs rsutcs prw rttcs rsttcs cllcalipso clmcalipso clhcalipso cll clm clh rsdt" |
---|
62 | echo $vars |
---|
63 | |
---|
64 | for var in $vars; do |
---|
65 | |
---|
66 | echo TRAITEMENT DE LA VARIABLE $var |
---|
67 | |
---|
68 | if [ $force_create = 1 ] ; then \rm -f $outd/${var}zon.p* ; fi |
---|
69 | |
---|
70 | if [ ! -f $outd/${var}zon.pdf -o ! -f $outd/${var}zon.png ] ; then |
---|
71 | |
---|
72 | echo zon var=$var |
---|
73 | echo zon GR=$GR |
---|
74 | echo zon SEAS=$SEAS |
---|
75 | echo zon sims=$sims |
---|
76 | |
---|
77 | nsims=$# |
---|
78 | echo NSIMS $nsims |
---|
79 | |
---|
80 | |
---|
81 | line=`grep "$var," $local/description${SEAS}.zon` |
---|
82 | if [ "$line" = "" ] ; then echo $var non prevue dans description ; exit ; fi |
---|
83 | name=`echo $line | awk -F, ' { print $2 } '` |
---|
84 | unit=`echo $line | awk -F, ' { print $3 } '` |
---|
85 | min=`echo $line | awk -F, ' { print $4 } '` |
---|
86 | max=`echo $line | awk -F, ' { print $5 } '` |
---|
87 | |
---|
88 | echo $line $name $unit $min $max |
---|
89 | GR=VLR |
---|
90 | |
---|
91 | |
---|
92 | WRK=`pwd`/WORK/XMGR$$/$var |
---|
93 | |
---|
94 | mkdir -p $outd |
---|
95 | cd $outd |
---|
96 | pwd |
---|
97 | |
---|
98 | echo OK0 $sims |
---|
99 | for sim in $sims ; do |
---|
100 | MAINDIR=$DODSDIR/$login/lmdz |
---|
101 | if [ "$sim" = "OBS" ] ; then |
---|
102 | MAINDIR=$DODSDIR/fabric/lmdz ; |
---|
103 | fi |
---|
104 | echo sim is= $sim |
---|
105 | ZONDIR=$MAINDIR/$GR/$SEAS/$sim/$ZONE |
---|
106 | echo $ZONDIR |
---|
107 | file=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
---|
108 | echo ln -sf $ZONDIR/$var $file |
---|
109 | ln -sf $ZONDIR/$var $file |
---|
110 | done |
---|
111 | |
---|
112 | if [ $var == "prl" ] || [ $var == "prc" ] ; then |
---|
113 | legend="0.72,0.7" |
---|
114 | elif [ $var == "pr" ] || [ $var == "clmcalipso" ] || [ $var == "eva" ] ; then |
---|
115 | legend="0.72,0.7" |
---|
116 | elif [ $var == "clhcalipso" ] || [ $var == "crelt" ] ; then |
---|
117 | legend="0.72,0.7" |
---|
118 | elif [ $var == "crest" ] ; then |
---|
119 | view="0.15, 0.15, 1, 0.6" |
---|
120 | legend="0.25,0.25" |
---|
121 | elif [ $var == "hfls" ] || [ $var == "prw" ] ; then |
---|
122 | view="0.15, 0.15, 1, 0.6" |
---|
123 | legend="0.72,0.7" |
---|
124 | elif [ $var == "hfns" ] ; then |
---|
125 | view="0.15, 0.15, 1, 0.6" |
---|
126 | legend="0.72,0.7" |
---|
127 | elif [ $var == "rstt" ] && [ $SEAS == "YEAR" ]; then |
---|
128 | legend="0.42,0.45" |
---|
129 | else |
---|
130 | #view="0.15, 0.15, 0.7, 0.45" |
---|
131 | #legend="0.72,0.45" |
---|
132 | legend="0.72,0.25" |
---|
133 | fi |
---|
134 | view="0.15, 0.15, 1, 0.6" |
---|
135 | legend="1.02,0.6" |
---|
136 | |
---|
137 | |
---|
138 | \rm tmp.param |
---|
139 | cat <<eod>| tmp.param |
---|
140 | world $latmin, $min, $latmax, $max |
---|
141 | stack world 0, 0, 0, 0 |
---|
142 | xaxis label "Latitude" |
---|
143 | yaxis label "$name ($unit)" |
---|
144 | view $view |
---|
145 | legend $legend |
---|
146 | s0 linewidth 10 |
---|
147 | s0 color 7 |
---|
148 | eod |
---|
149 | |
---|
150 | ii=0 |
---|
151 | for style in 1 3 2 ; do |
---|
152 | for color in 1 2 3 4 9 8 10 11 12 5 6 ; do |
---|
153 | (( ii = $ii + 1 )) |
---|
154 | cat <<eod>> tmp.param |
---|
155 | s$ii linewidth 2 |
---|
156 | s$ii color $color |
---|
157 | s$ii linestyle $style |
---|
158 | eod |
---|
159 | done |
---|
160 | done |
---|
161 | |
---|
162 | #cat tmp.param |
---|
163 | pwd |
---|
164 | |
---|
165 | if [ $var == "rstt" -o 0 = 0 ] ; then |
---|
166 | xmgrace `echo $sims | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//g'` -param tmp.param -legend load -hardcopy -hdevice EPS -printfile tmp.eps |
---|
167 | else |
---|
168 | xmgrace `echo $sims | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//g'` -param tmp.param -hardcopy -hdevice EPS -printfile tmp.eps |
---|
169 | fi |
---|
170 | |
---|
171 | echo xmgrace `echo $sims | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//g'` -param tmp.param -legend load -hardcopy -hdevice EPS -printfile tmp.eps |
---|
172 | |
---|
173 | echo xmgrace $sims -param tmp.param -legend load -hardcopy -hdevice EPS -printfile tmp.eps |
---|
174 | |
---|
175 | epstopdf tmp.eps |
---|
176 | mv -f tmp.pdf ${var}zon.pdf |
---|
177 | convert ${var}zon.pdf ${var}zon.png |
---|
178 | |
---|
179 | fi # sur existence de ${var}zon.p* |
---|
180 | |
---|
181 | done |
---|
182 | |
---|
183 | pwd |
---|