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