comp=$1 local=`pwd` season=YEAR force_create=0 MAIN_SE=/prodigfs/ipslfs/dods/fabric/lmdz/SE GR=VLR/YEAR MULTIDIR=/prodigfs/ipslfs/dods/fabric/lmdz/MultiSimu COMP_D=$MULTIDIR/$comp ############################################### # Liste des simulations de la comparasion $comp listsims="" DEF_FILE=$COMP_D/def.txt ; if [ ! -f $DEF_FILE ] ; then renseigner $DEF_FILE ; exit ; fi for s in `awk ' {print $1} ' $DEF_FILE` ; do listsims="$listsims $s" ; done ############################################### echo $listsims ici=`pwd` for sim in OBS $listsims ; do if [ "$sim" = "OBS" ] ; then years="" else years=_`grep '^'$sim' ' $DEF_FILE | awk ' { print $2 }'` fi SIM_DIR=/prodigfs/ipslfs/dods/fabric/lmdz/$GR/$sim$years ETOA_DIR=$SIM_DIR/METRICS for mask in otrop glob eto otrop weak conv subs ; do xmgr=$ETOA_DIR/$mask mkdir -p $ETOA_DIR if [ ! -f $xmgr -o "$force_create" = "1" ] ; then \rm -f $xmgr ; touch $xmgr if [ ! -d $SIM_DIR ] ; then echo $SIM_DIR absent ; exit ; fi \rm resu$sim for var in clhcalipso cllcalipso clmcalipso cltcalipso clt hfls hfss hurs huss pr psl rldscs rlds rlus rlutcs rlut rsdscs rsds rsdt rsuscs rsus rsutcs rsut ; do if [ "$mask" = "glob" ] ; then val=`cdo output -fldmean $SIM_DIR/NC/$var.nc` elif [ ! -f mask$mask.nc ] ; then echo Le fichier mask$mask.nc n existe pas ; exit else cdo remapcon,mask$mask.nc $SIM_DIR/NC/$var.nc tmp.nc val=`cdo output -fldmean -mul tmp.nc mask$mask.nc` echo cdo output -fldmean -mul $tmp.nc mask$mask.nc fi echo $mask $sim $var $val echo $var $val >> $xmgr done rsut=`grep '^rsut ' $xmgr | awk ' { print $2 } '` rsutcs=`grep '^rsutcs ' $xmgr | awk ' { print $2 } '` rlut=`grep '^rlut ' $xmgr | awk ' { print $2 } '` rlutcs=`grep '^rlutcs ' $xmgr | awk ' { print $2 } '` hfls=`grep '^hfls ' $xmgr | awk ' { print $2 } '` hfss=`grep '^hfss ' $xmgr | awk ' { print $2 } '` rlds=`grep '^rlds ' $xmgr | awk ' { print $2 } '` rsds=`grep '^rsds ' $xmgr | awk ' { print $2 } '` rlus=`grep '^rlus ' $xmgr | awk ' { print $2 } '` rsus=`grep '^rsus ' $xmgr | awk ' { print $2 } '` rsdt=`grep '^rsdt ' $xmgr | awk ' { print $2 } '` echo $rsut $rsutcs $xmgr | awk ' { print "crest" , $2 - $1 } ' >> $xmgr echo $rlut $rlutcs $xmgr | awk ' { print "crelt" , $2 - $1 } ' >> $xmgr echo $rsut $rsutcs $rlut $rlutcs $xmgr | awk ' { print "cret" , $2 - $1 +$4 -$3 } ' >> $xmgr echo $rsdt $rsut $xmgr | awk ' { print "rst" , $1 - $2 } ' >> $xmgr echo $rsdt $rsut $rlut $xmgr | awk ' { print "rt" , $1 - $2 -$3 } ' >> $xmgr echo $hfls $hfss $xmgr | awk ' { print "trbs" , $1 + $2 } ' >> $xmgr echo $rlds $rlus $xmgr | awk ' { print "rls" , $1 - $2 } ' >> $xmgr echo $rsds $rsus $xmgr | awk ' { print "rss" , $1 - $2 } ' >> $xmgr echo $rlds $rlus $rsds $rsus $xmgr | awk ' { print "rs" , $1 - $2 +$3 - $4 } ' >> $xmgr echo $rlds $rlus $rsds $rsus $hfls $hfss $xmgr | awk ' { print "bils" , $1 - $2 + $3 - $4 - $5 - $6 } ' >> $xmgr fi done # Masques combinés paste $ETOA_DIR/otrop $ETOA_DIR/eto | awk ' { print $1 , $4 - $2 } ' >| $ETOA_DIR/etoa done ######################################################################################### # Tracers ######################################################################################### cat <| descr clhcalipso 1 High Clouds cllcalipso 1 Low Clouds clmcalipso 1 Mid Clouds cltcalipso 1 Total Clouds clt hfls -1 -LE hfss -1 -H hurs 1 RHsrf huss pr 10 PR*10 psl 1 SLP rlds 1 LWdn srf rldscs 1 LWdn srf Clr rlus -1 LWup Srf rlutcs -1 LW TOA Clr rlut -1 LW TOA rsdscs 1 SWdn srf Clr rsds 1 SWdn srf rsdt 1 SWdn TOA rsuscs -1 SWup srf Clr rsus -1 SWup srf rsutcs -1 SW TOA Clr rsut -1 SW TOA crest 1 SW CRE TOA crelt 1 LW CRE TOA cret 1 CRE TOA rst 1 SW TOA rt 1 SW+LW TOA trbs -1 -(LE+H) rls 1 LW srf rss 1 SW srf rs 1 SW+LW srf bils 1 Srf budget eod for mask in glob etoa conv weak subs ; do case $mask in etoa) listevars="bils rss crest rt hfls trbs cllcalipso clmcalipso clhcalipso pr" ;; glob|conv|weak|subs) listevars="bils rt rlutcs crelt rsutcs crest cllcalipso clmcalipso clhcalipso pr" ;; *) echo cas non prevu ; exit esac nvars=`echo $listevars | wc -w | awk ' { print $1 } '` case $mask in glob) yax="Global " ;; etoa) yax="ETOA " ;; conv) yax="Convective regimes " ;; weak) yax="Weak convection " ;; subs) yax="Subsidences " esac cat <<...eod>| tmp.param g0 type Chart world -0.5, -25, $nvars, 25 yaxis label "$yax, Fluxes (W/m2) " xaxis ticklabel font 0 xaxis ticklabel color 1 xaxis tick place both xaxis tick spec type both xaxis tick spec 11 legend 1.20, 0.8 xaxis ticklabel char size 1.3 xaxis ticklabel angle 90 ...eod ii=0 for var in $listevars ; do fact=`grep "^$var " descr | awk ' { print $2 } '` titre=`grep "^$var " descr | sed -e 's/'$var'//' -e 's/'$fact'//'` cat <<......eod>> tmp.param xaxis tick major $ii, $ii xaxis ticklabel $ii, "$titre" ......eod (( ii = $ii + 1 )) done for sim in $listsims ; do echo $sim years=_`grep '^'$sim' ' $DEF_FILE | awk ' { print $2 }'` SIM_DIR=/prodigfs/ipslfs/dods/fabric/lmdz/$GR/$sim$years/METRICS ls $SIM_DIR OBS_DIR=/prodigfs/ipslfs/dods/fabric/lmdz/$GR/OBS/METRICS mkdir -p XMGR$$/$mask xmgr=XMGR$$/$mask/$sim ; rm -f $xmgr ; touch $xmgr for var in $listevars ; do echo var $var fact=`grep "^$var " descr | awk ' { print $2 } '` paste $OBS_DIR/$mask $SIM_DIR/$mask | grep "^$var " | awk ' { print '$fact' * ( $4 -$2 ) } ' >> $xmgr done done size=`echo $listsims | wc -w | awk ' { print 3. / $1 } '` for ii in 0 1 2 3 4 5 6 7 8 9 10 11 12 ; do echo "s$ii type bar" >> tmp.param echo "s$ii symbol fill pattern 1" >> tmp.param echo "s$ii symbol size $size" >> tmp.param echo "s$ii line linestyle 0" >> tmp.param done cd XMGR$$/$mask xmgrace * -param ../../tmp.param -legend load -hardcopy -hdevice EPS -printfile tmp.eps epstopdf tmp.eps OUT_D=$COMP_D/METRICS ; mkdir -p $OUT_D \mv -f tmp.pdf $OUT_D/$mask.pdf ; convert -density 144 $OUT_D/$mask.pdf $OUT_D/$mask.png cd ../.. done cp mask*png $OUT_D