1 | #!/bin/bash |
---|
2 | |
---|
3 | #set -vx |
---|
4 | |
---|
5 | source ~/env_Multi_atlas.sh |
---|
6 | |
---|
7 | echo OBSDIR is defined in env.sh : $OBSDIR |
---|
8 | |
---|
9 | years=$1 |
---|
10 | SEAS=$2 |
---|
11 | run=$3 |
---|
12 | zone=$4 |
---|
13 | |
---|
14 | vars='pr rstt rlut rtt crelt crest crett hfns hfls eva hfss tas sst hurs tauu tauv psl zg500 rsts rsut rsutcs rlutcs rsds rsdscs rsus rsuscs rlds rldscs rlus rsdt albs albt cress crels crets rts rah rahcs rahcre rlah rlahcs rlahcre rsah rsahcs rsahcre prw rttcs rsttcs cllcalipso clmcalipso clhcalipso cll clm clh' |
---|
15 | |
---|
16 | if [ "$run" = "OBS" ]; then |
---|
17 | SIM="$run" |
---|
18 | else |
---|
19 | SIM="$run"_"$years" |
---|
20 | fi |
---|
21 | |
---|
22 | echo ferret is $ferret |
---|
23 | |
---|
24 | force_create=0 |
---|
25 | GR=VLR |
---|
26 | MAINDIR=$DODSDIR/$login/lmdz |
---|
27 | WRK=$MAINDIR/WORK/biais$$ |
---|
28 | orig=$MAINDIR/$GR/$SEAS |
---|
29 | |
---|
30 | if [ ! -d $orig ] ; then mkdir $orig ; fi |
---|
31 | if [ ! -f $orig/OBS/NC ] ; then |
---|
32 | ln -s $OBSDIR/$GR/$SEAS/OBS/NC $orig/OBS/. |
---|
33 | fi |
---|
34 | |
---|
35 | |
---|
36 | if [ -d $WRK ] ; then WRK=$WRK$$ ; fi |
---|
37 | if [ -d $WRK ] ; then echo $WRK existe deja ; exit ; fi |
---|
38 | |
---|
39 | mkdir -p $WRK |
---|
40 | |
---|
41 | cd $orig |
---|
42 | for sim in $SIM ; do |
---|
43 | |
---|
44 | echo $sim |
---|
45 | bad=0 |
---|
46 | |
---|
47 | for var in $vars ; do |
---|
48 | |
---|
49 | #echo $orig/$sim/$d |
---|
50 | for d in $zone ; do |
---|
51 | echo $orig/$sim/$d |
---|
52 | mkdir -p $orig/$sim/$d |
---|
53 | if [ $force_create = 1 ] ; then |
---|
54 | \rm -f $orig/$sim/$d/$var.nc $orig/$sim/$d/$var |
---|
55 | fi |
---|
56 | done |
---|
57 | |
---|
58 | cd $WRK |
---|
59 | \rm -rf tmp* ferret* |
---|
60 | varobs=$var |
---|
61 | varmod=$var |
---|
62 | obs=$var |
---|
63 | echo $pal |
---|
64 | |
---|
65 | # contour levels for biases |
---|
66 | case $var in |
---|
67 | pr) lev='(-INF)(0.5)(1,4,1)(6,14,2)(INF)' ; levd='(-Inf)(-5)(-2,2,1)(-0.5)(-0.2)(0.2)(0.5)(5)(Inf)'; pal=rain_cmyk ;; |
---|
68 | prl) lev='(-INF)(0.5)(1,4,1)(6,14,2)(INF)' ; levd='(-Inf)(-5)(-2,2,1)(-0.5)(-0.2)(0.2)(0.5)(5)(Inf)'; pal=rain_cmyk ; varmod=prl ; varobs=86400.*pr ;; |
---|
69 | prc) lev='(-INF)(0.5)(1,4,1)(6,14,2)(INF)' ; levd='(-Inf)(-5)(-2,2,1)(-0.5)(-0.2)(0.2)(0.5)(5)(Inf)'; pal=rain_cmyk ; varmod=prc ; varobs=86400.*pr ;; |
---|
70 | hfns) lev='(-INF)(-200,200,50)(-75)(-25)(25)(75)(INF)'; levd='(-Inf)(-80,80,20)(Inf)' ;; |
---|
71 | tas) lev='(-INF)(-60,20,10)(6,26,4)(24)(27)(28)(30)(INF)' ; levd='(-Inf)(-8,8)(-4,4)(-2,2,1)(Inf)' ; varmod=-273.15+tas ; varobs=-273.15+tas ;; |
---|
72 | sst) lev='(-INF)(-60,20,10)(6,26,4)(24)(27)(28)(30)(INF)' ; levd='(-Inf)(-8,8)(-4,4)(-2,2,1)(Inf)' ; varmod=-273.15+tas ; varobs=-273.15+sst ;; |
---|
73 | tasc) lev='(-INF)(-60,20,10)(6,26,4)(24)(27)(28)(30)(INF)' ; levd='(-Inf)(-8,8)(-4,4)(-2,2,1)(Inf)' ;; |
---|
74 | tauu) lev='(-INF)(-.16,.16,0.02)(INF)' ; levd='(-1.)(-0.16,0.16,0.02)(1.)' ;; |
---|
75 | tauv) lev='(-INF)(-0.16,0.16,0.02)(INF)' ; levd='(-1.)(-0.16,0.16,0.02)(1.)' ;; |
---|
76 | psl) lev='(-INF)(975,1030,5)(1040,1100,10)(INF)' ; levd='(-Inf)(-100,-60,10)(-20,20,2.5)(20,100,10)(Inf)' ;; |
---|
77 | zg500) lev='(-INF)(4900,5800,50)(INF)' ; levd='(-Inf)(-260,100,20)(Inf)' ;; |
---|
78 | sfcWind) levd='(-Inf)(-1.5,1.5,0.2)(Inf)' ;; |
---|
79 | hurs) levd='(-Inf)(-10,10,1)(Inf)' ;; |
---|
80 | ts) levd='(-Inf)(-3,3,0.5)(Inf)' ; varobs=tsk ;; |
---|
81 | deltat) levd='(-Inf)(-1,1,0.1)(Inf)' ; varmod=tsmtas ;; |
---|
82 | huss) levd='(-Inf)(-2.4,2.4,0.3)(Inf)' ; varmod=1000.*huss ;; |
---|
83 | prw) lev='(-Inf)(0.,65.,5)(Inf)' ; levd='(-Inf)(-30.,30.,5)(Inf)' ;; |
---|
84 | hfls) lev='(-Inf)(0,200,20)(Inf)' ; levd='(-Inf)(-50,-10,10)(-5,5,5)(5,50,10)(Inf)' ;; |
---|
85 | eva) lev='(-Inf)(0.5)(1,4,1)(6,14,2)(Inf)' ; levd='(-Inf)(-5)(-2,2,1)(-0.5)(-0.2)(0.2)(0.5)(5)(Inf)' ;; |
---|
86 | hfss) lev='(-Inf)(0,120,10)(Inf)' ; levd='(-Inf)(-50,-10,10)(-5,5,5)(5,50,10)(Inf)' ;; |
---|
87 | hfns) levd='(-Inf)(-50,-10,10)(-5,5,5)(5,50,10)(Inf)' ;; |
---|
88 | bils) levd='(-Inf)(-50,-10,10)(-5,5,5)(5,50,10)(Inf)' ; varobs=bils ;; |
---|
89 | cress) lev='(-Inf)(-120,-10,10)(Inf)' ; levd="$radd" ;; |
---|
90 | crels) lev='(-Inf)(0,100,10)(Inf)' ; levd="$radd" ;; |
---|
91 | crets) lev='(-Inf)(-60,60,10)(Inf)' ; levd="$radd" ;; |
---|
92 | crest) lev='(-Inf)(-120,-10,10)(Inf)' ; levd="$radd" ;; |
---|
93 | crelt) lev='(-Inf)(0,70,5)(Inf)' ; levd="$radd" ;; |
---|
94 | crett) lev='(-Inf)(-60,60,10)(Inf)' ; levd="$radd" ;; |
---|
95 | rts) lev='(-Inf)(-20,200,10)(Inf)' ; levd="$radd" ;; |
---|
96 | rtt) lev='(-Inf)(-100,100,10)(Inf)' ; levd="$radd" ;; |
---|
97 | rttcs) lev='(-Inf)(-100,100,10)(Inf)' ; levd="$radd" ;; |
---|
98 | rlut) lev='(-Inf)(150,320,10)(Inf)' ; levd="$radd" ;; |
---|
99 | rlutcs) lev='(-Inf)(150,350,10)(Inf)' ; levd="$radd" ;; |
---|
100 | rlus) lev='(-Inf)(120,400,20)(440)(480)(Inf)' ; levd="$radd" ;; |
---|
101 | rlds) lev='(-Inf)(100,420,20)(Inf)' ; levd="$radd" ;; |
---|
102 | rldscs) lev='(-Inf)(80,320,20)(Inf)' ; levd="$radd" ;; |
---|
103 | rsds) lev='(-Inf)(80,320,20)(Inf)' ; levd="$radd" ;; |
---|
104 | rsdscs) lev='(-Inf)(80,320,20)(Inf)' ; levd="$radd" ;; |
---|
105 | rsuscs) lev='(-Inf)(20,150,10)(Inf)' ; levd="$radd" ;; |
---|
106 | rsus) lev='(-Inf)(10,150,10)(Inf)' ; levd="$radd" ;; |
---|
107 | rsutcs) lev='(-Inf)(10)(30)(50,160,10)(180)(Inf)' ; levd="$radd" ;; |
---|
108 | rstt) lev='(-Inf)(0,330,10)(Inf)' ; levd="$radd" ;; |
---|
109 | rsttcs) lev='(-Inf)(0,330,10)(Inf)' ; levd="$radd" ;; |
---|
110 | rsts) lev='(-Inf)(0,330,10)(Inf)' ; levd="$radd" ;; |
---|
111 | rstscs) lev='(-Inf)(0,400,10)(Inf)' ; levd="$radd" ;; |
---|
112 | rsut) lev='(-Inf)(50,160,10)(Inf)' ; levd="$radd" ;; |
---|
113 | rsutcs) lev='(-Inf)(50,160,10)(Inf)' ; levd="$radd" ;; |
---|
114 | rsdt) lev='(-Inf)(0,700,10)(Inf)' ; levd="$radd" ;; |
---|
115 | albt|albs) lev='(-Inf)(0,100,5)(Inf)' ; levd='(-Inf)(-50,-10,10)(-5,5,5)(10,50,10)(Inf)' ;; |
---|
116 | cll) lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ; varobs=cllcalipso ;; |
---|
117 | clm) lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ; varobs=clmcalipso ;; |
---|
118 | clh) lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ; varobs=clhcalipso ;; |
---|
119 | clt) lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ; varobs=cltcalipso ;; |
---|
120 | cltcalipso|clhcalipso|clmcalipso|cllcalipso) lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ;; |
---|
121 | FO1cllcalipso|FO2cllcalipso|FO3cllcalipso) varmod=cllcalipso ; lev='(1)(2,24,2)(30,90,10)(INF)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ;; |
---|
122 | FO1clmcalipso|FO2clmcalipso|FO3clmcalipso) varmod=clmcalipso ; lev='(1)(2,24,2)(30,90,10)(INF)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ;; |
---|
123 | FO1clhcalipso|FO2clhcalipso|FO3clhcalipso) varmod=clhcalipso ; lev='(1)(2,24,2)(30,90,10)(INF)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ;; |
---|
124 | clcalipso) lev='(1,4,1)(4,32,2)(40,70,10)(Inf)' ; levd='(-Inf)(-30,30,5)(Inf)' ;; |
---|
125 | rah) lev='(-INF)(-180,0,10)(INF)'; levd="$rahd" ;; |
---|
126 | rahcs) lev='(-INF)(-180,0,10)(INF)'; levd="$rahd" ;; |
---|
127 | rahcre) lev='(-INF)(-40,70,5)(INF)' ; levd="$rahd" ;; |
---|
128 | rlah) lev='(-INF)(-280,-50,10)(INF)'; levd="$rahd" ;; |
---|
129 | rlahcs) lev='(-INF)(-280,-50,5)(INF)' ; levd="$rahd" ;; |
---|
130 | rlahcre) lev='(-INF)(-60,60,5)(INF)' ; levd="$rahd" ;; |
---|
131 | rsah) lev='(-INF)(0,150,10)(INF)'; levd="$rahd" ;; |
---|
132 | rsahcs) lev='(-INF)(0,150,10)(INF)' ; levd="$rahd" ;; |
---|
133 | rsahcre) lev='(-INF)(-20,20,5)(INF)' ; levd="$rahd" ;; |
---|
134 | cltoce|clhoce|clmoce|clloce) vlim=0:100 ; lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ;; |
---|
135 | cltter|clhter|clmter|cllter) vlim=0:100 ; lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ;; |
---|
136 | cltsic|clhsic|clmsic|cllsic) vlim=0:100 ; lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ;; |
---|
137 | cltlic|clhlic|clmlic|clllic) vlim=0:100 ; lev='(-Inf)(0,10,2)(0,100,10)(Inf)' ; levd='(-Inf)(-70)(-40,40,5)(70)(Inf)' ;; |
---|
138 | *) echo variable $var non prevue ; exit |
---|
139 | esac |
---|
140 | echo FIGURE FIGURE FIGURE $sim $title $var |
---|
141 | cat <<eod>| open.jnl |
---|
142 | use "$orig/$sim/NC/all.nc" |
---|
143 | eod |
---|
144 | |
---|
145 | cat <<eod>| vardef.jnl |
---|
146 | let cress=rsds-rsus-rsdscs+rsuscs |
---|
147 | let crels=rlds-rldscs |
---|
148 | let rstt=rsdt-rsut |
---|
149 | let rsttcs=rsdt-rsutcs |
---|
150 | let rsts=rsds-rsus |
---|
151 | let rtt=rstt-rlut |
---|
152 | let rttcs=rsttcs-rlutcs |
---|
153 | let albt=100*(rsut/rsdt) |
---|
154 | let albs=100*(rsus/rsds) |
---|
155 | let crets=cress+crels |
---|
156 | let crest=rsutcs-rsut |
---|
157 | let crelt=rlutcs-rlut |
---|
158 | let crett=crest+crelt |
---|
159 | let rts=rsds-rsus+rlds-rlus |
---|
160 | let bil=rts-hfls-hfss |
---|
161 | !let hfns=hfls+hfss+rts |
---|
162 | !let hfns=bils |
---|
163 | let eva=hfls*0.03456 |
---|
164 | let tsmtas=ts-tas |
---|
165 | let tsk=ts+273.15 |
---|
166 | ! let pslhPa=psl/100. |
---|
167 | let tasc=tas-273.15 |
---|
168 | |
---|
169 | let rlah=rlus-rlds-rlut |
---|
170 | let rlahcs=rlus-rldscs-rlutcs |
---|
171 | let rlahcre=rlah-rlahcs |
---|
172 | |
---|
173 | let rsah=rsdt-rsut+rsus-rsds |
---|
174 | let rsahcs=rsdt-rsutcs+rsuscs-rsdscs |
---|
175 | let rsahcre=rsah-rsahcs |
---|
176 | |
---|
177 | let rah=rsah+rlah |
---|
178 | let rahcs=rsahcs+rlahcs |
---|
179 | let rahcre=rah-rahcs |
---|
180 | |
---|
181 | let clloce = if oce[d=1] ge 99 then cllcalipso |
---|
182 | let cllter = if ter[d=1] ge 99 then cllcalipso |
---|
183 | let cllsic = if sic[d=1] ge 99 then cllcalipso |
---|
184 | let clllic = if lic[d=1] ge 99 then cllcalipso |
---|
185 | |
---|
186 | let clmoce = if oce[d=1] ge 99 then clmcalipso |
---|
187 | let clmter = if ter[d=1] ge 99 then clmcalipso |
---|
188 | let clmsic = if sic[d=1] ge 99 then clmcalipso |
---|
189 | let clmlic = if lic[d=1] ge 99 then clmcalipso |
---|
190 | |
---|
191 | let clhoce = if oce[d=1] ge 99 then clhcalipso |
---|
192 | let clhter = if ter[d=1] ge 99 then clhcalipso |
---|
193 | let clhsic = if sic[d=1] ge 99 then clhcalipso |
---|
194 | let clhlic = if lic[d=1] ge 99 then clhcalipso |
---|
195 | |
---|
196 | reg/x=-180.:180./l=1/y=-90:90 !globe |
---|
197 | eod |
---|
198 | |
---|
199 | cat <<eod>| ZON.jnl |
---|
200 | go open.jnl |
---|
201 | go vardef.jnl |
---|
202 | let vv=$varmod[i=@ave,d=1] |
---|
203 | list/format=(f15.3,f15.3) y*(0*vv+1.),vv |
---|
204 | !list/noh/file=$varmod.ASCII/format=(f15.3,e15.3,e15.3) y*(0*vv[d=1]+1.),vv[d=1],vv[d=2] |
---|
205 | eod |
---|
206 | |
---|
207 | cat <<eod>| AMMACROSS.jnl |
---|
208 | go open.jnl |
---|
209 | go vardef.jnl |
---|
210 | let vv=$varmod[i=@ave,d=1] |
---|
211 | list/x=-10.:10./y=-5.:25./format=(f15.3,f15.3) y*(0*vv+1.),vv |
---|
212 | !list/noh/file=$varmod.ASCII/format=(f15.3,e15.3,e15.3) y*(0*vv[d=1]+1.),vv[d=1],vv[d=2] |
---|
213 | eod |
---|
214 | |
---|
215 | cat <<eod>| GLOB.jnl |
---|
216 | go open.jnl |
---|
217 | go vardef.jnl |
---|
218 | list/format=(f15.3) $varmod[i=@ave,j=@ave,d=1] |
---|
219 | eod |
---|
220 | |
---|
221 | |
---|
222 | for d in $zone ; do |
---|
223 | outf=$orig/$sim/$d/$var |
---|
224 | echo $outf |
---|
225 | soutf=`wc -l ${outf} |awk '{print $1}'` |
---|
226 | if [ $force_create = 1 ] || [ "${soutf}" == "0" ]; then rm -f $outf ; fi |
---|
227 | if [ ! -f $outf ] ; then |
---|
228 | $ferret -batch tmp.ps -script $d.jnl | sed -e '/:/d' -e '/\*/d' >| $outf |
---|
229 | fi |
---|
230 | done |
---|
231 | |
---|
232 | done |
---|
233 | |
---|
234 | |
---|
235 | done |
---|