source: BOL/Multi_atlas/multi_ZONE.sh @ 4695

Last change on this file since 4695 was 4340, checked in by musat, 2 years ago

Inclut environnement spirit et dernieres corrections (1/3)
IonelaMusat?

  • Property svn:executable set to *
File size: 4.2 KB
Line 
1#!/bin/bash
2
3source ~/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
15MAINDIR=$DODSDIR/$login/lmdz
16
17runstxt=`pwd`/runs.txt
18
19while test -n "${1}"; do
20    case $1 in
21       "-runsfile") runstxt=$2 ; shift ;;
22    esac
23    shift
24done
25
26
27GR=VLR
28force_create=1
29
30local=`pwd`
31
32latmin=-90.
33latmax=90.
34if [ $ZONE = AMMACROSS ] ; then
35   latmin=-5.
36   latmax=25.
37fi
38
39COMP_D=$MAINDIR/MultiSimu/$comp
40outd=$COMP_D/$ZONE/$SEAS
41
42DEF_FILE=$COMP_D/def.txt
43echo $COMP_D
44
45listsims=""  ; for s  in `awk ' {print $1} ' $DEF_FILE`          ; do listsims="$listsims $s"    ; done
46echo listsims $listsims
47
48sims="OBS "
49
50echo listsims= $listsims
51
52for s in $listsims ; do
53simdir=`grep -w "^$s "  $runstxt | awk ' { print $2 } '`
54ss=`basename $simdir `
55year=`grep -w "^$s" $DEF_FILE | awk ' { print $2 } '`
56sims="$sims ${s}_$year"
57done
58
59echo $SEAS $outd "$sims"
60
61vars="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"
62echo $vars
63
64for var in $vars; do 
65
66echo TRAITEMENT DE LA VARIABLE $var
67
68if [ $force_create = 1 ] ; then \rm -f $outd/${var}zon.p* ; fi
69
70if [ ! -f $outd/${var}zon.pdf -o ! -f $outd/${var}zon.png ] ; then
71
72echo zon var=$var
73echo zon GR=$GR 
74echo zon SEAS=$SEAS
75echo zon sims=$sims
76
77nsims=$#
78echo NSIMS $nsims
79
80
81line=`grep  "$var," $local/description${SEAS}.zon`
82if [ "$line" = "" ] ; then echo $var non prevue dans description ; exit ; fi
83name=`echo $line | awk -F, ' { print $2 } '`
84unit=`echo $line | awk -F, ' { print $3 } '`
85 min=`echo $line | awk -F, ' { print $4 } '`
86 max=`echo $line | awk -F, ' { print $5 } '`
87
88echo $line $name $unit $min $max
89GR=VLR
90
91
92WRK=`pwd`/WORK/XMGR$$/$var
93
94mkdir -p $outd
95cd $outd
96pwd
97
98echo OK0 $sims
99for 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
110done
111
112if [ $var == "prl" ] || [ $var == "prc" ] ; then
113    legend="0.72,0.7"
114elif [ $var == "pr" ] || [ $var == "clmcalipso" ] || [ $var == "eva" ] ; then
115    legend="0.72,0.7"
116elif [ $var == "clhcalipso" ] || [ $var == "crelt" ] ; then
117    legend="0.72,0.7"
118elif [ $var == "crest" ] ; then
119    view="0.15, 0.15, 1, 0.6"
120    legend="0.25,0.25"
121elif [ $var == "hfls" ] || [ $var == "prw" ] ; then
122    view="0.15, 0.15, 1, 0.6"
123    legend="0.72,0.7"
124elif [ $var == "hfns" ] ; then
125    view="0.15, 0.15, 1, 0.6"
126    legend="0.72,0.7"
127elif [ $var == "rstt" ] && [ $SEAS == "YEAR" ]; then
128    legend="0.42,0.45"
129else
130    #view="0.15, 0.15, 0.7, 0.45"
131    #legend="0.72,0.45"
132    legend="0.72,0.25"
133fi
134view="0.15, 0.15, 1, 0.6"
135legend="1.02,0.6"
136
137
138\rm tmp.param
139cat <<eod>| tmp.param
140world $latmin, $min, $latmax, $max
141stack world 0, 0, 0, 0
142xaxis label "Latitude"
143yaxis label "$name ($unit)"
144view $view
145legend $legend
146s0 linewidth 10
147s0 color 7
148eod
149
150ii=0
151for style in 1 3 2 ; do
152for color in 1 2 3 4 9 8 10 11 12 5 6 ; do
153(( ii = $ii + 1 ))
154cat <<eod>> tmp.param
155s$ii linewidth 2
156s$ii color $color
157s$ii linestyle $style
158eod
159done
160done
161
162#cat tmp.param
163pwd
164
165if [ $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
167else
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
169fi
170
171echo 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
173echo xmgrace $sims -param tmp.param -legend load  -hardcopy -hdevice EPS -printfile tmp.eps
174
175epstopdf tmp.eps
176mv -f tmp.pdf ${var}zon.pdf
177convert ${var}zon.pdf ${var}zon.png
178
179fi # sur existence de ${var}zon.p*
180
181done
182
183pwd
Note: See TracBrowser for help on using the repository browser.