source: BOL/Multi_atlas/make_MOY.sh @ 4112

Last change on this file since 4112 was 3881, checked in by musat, 4 years ago

Changement des PATHS sur ciclad

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