source: BOL/Multi_atlas/multi_ZONE.sh @ 3684

Last change on this file since 3684 was 3684, checked in by idelkadi, 4 years ago

Repository under svn of a first version of Multiatlas diagnostics for LMDZ. This version is adapted to be able to run a LMDZ multiatlas on an individual account on the ciclad machine of the IPSL. In this version, the parts to be modified are identified so as to subsequently adapt it to other machines.
This version is still under development.

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