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=/thredds/ipsl |
---|
17 | fi |
---|
18 | if [ ${hostname:0:5} = camel ] ; then |
---|
19 | DODSDIR=/thredds/ipsl |
---|
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=`pwd`/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 | listsims="" ; for s in `awk ' {print $1} ' $DEF_FILE` ; do listsims="$listsims $s" ; done |
---|
59 | echo listsims $listsims |
---|
60 | |
---|
61 | sims="OBS " |
---|
62 | |
---|
63 | echo listsims= $listsims |
---|
64 | |
---|
65 | for s in $listsims ; do |
---|
66 | simdir=`grep -w "^$s " $runstxt | awk ' { print $2 } '` |
---|
67 | ss=`basename $simdir ` |
---|
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="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" |
---|
75 | echo $vars |
---|
76 | |
---|
77 | for var in $vars; do |
---|
78 | |
---|
79 | echo TRAITEMENT DE LA VARIABLE $var |
---|
80 | |
---|
81 | if [ $force_create = 1 ] ; then \rm -f $outd/${var}zon.p* ; fi |
---|
82 | |
---|
83 | if [ ! -f $outd/${var}zon.pdf -o ! -f $outd/${var}zon.png ] ; then |
---|
84 | |
---|
85 | echo zon var=$var |
---|
86 | echo zon GR=$GR |
---|
87 | echo zon SEAS=$SEAS |
---|
88 | echo zon sims=$sims |
---|
89 | |
---|
90 | nsims=$# |
---|
91 | echo NSIMS $nsims |
---|
92 | |
---|
93 | |
---|
94 | line=`grep "$var," $local/description${SEAS}.zon` |
---|
95 | if [ "$line" = "" ] ; then echo $var non prevue dans description ; exit ; fi |
---|
96 | name=`echo $line | awk -F, ' { print $2 } '` |
---|
97 | unit=`echo $line | awk -F, ' { print $3 } '` |
---|
98 | min=`echo $line | awk -F, ' { print $4 } '` |
---|
99 | max=`echo $line | awk -F, ' { print $5 } '` |
---|
100 | |
---|
101 | echo $line $name $unit $min $max |
---|
102 | GR=VLR |
---|
103 | |
---|
104 | |
---|
105 | WRK=`pwd`/WORK/XMGR$$/$var |
---|
106 | |
---|
107 | mkdir -p $outd |
---|
108 | cd $outd |
---|
109 | pwd |
---|
110 | |
---|
111 | pwd |
---|
112 | echo OK0 $sims |
---|
113 | for sim in $sims ; do |
---|
114 | MAINDIR=$DODSDIR/$login/lmdz |
---|
115 | if [ "$sim" = "OBS" ] ; then |
---|
116 | MAINDIR=$DODSDIR/fabric/lmdz ; |
---|
117 | fi |
---|
118 | echo sim is= $sim |
---|
119 | ZONDIR=$MAINDIR/$GR/$SEAS/$sim/$ZONE |
---|
120 | echo $ZONDIR |
---|
121 | pwd |
---|
122 | file=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
---|
123 | echo ln -sf $ZONDIR/$var $file |
---|
124 | ln -sf $ZONDIR/$var $file |
---|
125 | done |
---|
126 | |
---|
127 | if [ $var == "prl" ] || [ $var == "prc" ] ; then |
---|
128 | legend="0.72,0.7" |
---|
129 | elif [ $var == "pr" ] || [ $var == "clmcalipso" ] || [ $var == "eva" ] ; then |
---|
130 | legend="0.72,0.7" |
---|
131 | elif [ $var == "clhcalipso" ] || [ $var == "crelt" ] ; then |
---|
132 | legend="0.72,0.7" |
---|
133 | elif [ $var == "crest" ] ; then |
---|
134 | view="0.15, 0.15, 1, 0.6" |
---|
135 | legend="0.25,0.25" |
---|
136 | elif [ $var == "hfls" ] || [ $var == "prw" ] ; then |
---|
137 | view="0.15, 0.15, 1, 0.6" |
---|
138 | legend="0.72,0.7" |
---|
139 | elif [ $var == "hfns" ] ; then |
---|
140 | view="0.15, 0.15, 1, 0.6" |
---|
141 | legend="0.72,0.7" |
---|
142 | elif [ $var == "rstt" ] && [ $SEAS == "YEAR" ]; then |
---|
143 | legend="0.42,0.45" |
---|
144 | else |
---|
145 | #view="0.15, 0.15, 0.7, 0.45" |
---|
146 | #legend="0.72,0.45" |
---|
147 | legend="0.72,0.25" |
---|
148 | fi |
---|
149 | view="0.15, 0.15, 1, 0.6" |
---|
150 | legend="1.02,0.6" |
---|
151 | |
---|
152 | |
---|
153 | \rm tmp.param |
---|
154 | cat <<eod>| tmp.param |
---|
155 | world $latmin, $min, $latmax, $max |
---|
156 | stack world 0, 0, 0, 0 |
---|
157 | xaxis label "Latitude" |
---|
158 | yaxis label "$name ($unit)" |
---|
159 | view $view |
---|
160 | legend $legend |
---|
161 | s0 linewidth 10 |
---|
162 | s0 color 7 |
---|
163 | eod |
---|
164 | |
---|
165 | ii=0 |
---|
166 | for style in 1 3 2 ; do |
---|
167 | for color in 1 2 3 4 9 8 10 11 12 5 6 ; do |
---|
168 | (( ii = $ii + 1 )) |
---|
169 | cat <<eod>> tmp.param |
---|
170 | s$ii linewidth 2 |
---|
171 | s$ii color $color |
---|
172 | s$ii linestyle $style |
---|
173 | eod |
---|
174 | done |
---|
175 | done |
---|
176 | |
---|
177 | #cat tmp.param |
---|
178 | pwd |
---|
179 | |
---|
180 | if [ $var == "rstt" -o 0 = 0 ] ; then |
---|
181 | 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 |
---|
182 | else |
---|
183 | 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 |
---|
184 | fi |
---|
185 | |
---|
186 | 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 |
---|
187 | |
---|
188 | echo xmgrace $sims -param tmp.param -legend load -hardcopy -hdevice EPS -printfile tmp.eps |
---|
189 | |
---|
190 | epstopdf tmp.eps |
---|
191 | mv -f tmp.pdf ${var}zon.pdf |
---|
192 | convert ${var}zon.pdf ${var}zon.png |
---|
193 | |
---|
194 | fi # sur existence de ${var}zon.p* |
---|
195 | |
---|
196 | done |
---|
197 | |
---|
198 | pwd |
---|
199 | ls |
---|