1 | #!/bin/bash |
---|
2 | |
---|
3 | echo Ce script est obsolete |
---|
4 | echo Si vous en voyez encore utilite, envoyer un courriel a frederic.hourdin@lmd.ipsl.fr |
---|
5 | echo pour le signaler |
---|
6 | exit |
---|
7 | |
---|
8 | #set -vx |
---|
9 | local_d=$PWD |
---|
10 | |
---|
11 | if [ ! -f lmdz_env.sh ] ; then echo This script requires lmdz_env.sh script for configuration ; exit 1 ; fi |
---|
12 | # . lmdz_env.sh $local_d |
---|
13 | . lmdz_env.sh |
---|
14 | |
---|
15 | sim=$1 |
---|
16 | MAINDIR=`basename \`pwd\`` |
---|
17 | PRE=FH$MAINDIR |
---|
18 | echo $PRE |
---|
19 | STORED=$root_dir |
---|
20 | WORKD=$SIMRUNBASEDIR |
---|
21 | POST=$SIMRUNBASEDIR/$MAINDIR/POST/$sim |
---|
22 | OUT_D=$WORKD/$MAINDIR/$sim/Analyse |
---|
23 | |
---|
24 | se=1 |
---|
25 | cosp=0 |
---|
26 | da=0 |
---|
27 | cmor=1 |
---|
28 | |
---|
29 | liste_suf="" |
---|
30 | if [ $se = 1 ] ; then liste_suf="$liste_suf mth" ; fi |
---|
31 | if [ $cosp = 1 ] ; then liste_suf="$liste_suf mthCOSP" ; fi |
---|
32 | if [ $da = 1 ] ; then liste_suf="$liste_suf day" ; fi |
---|
33 | |
---|
34 | if [ ! -d $sim ] ; then echo la simulation $sim n existe pas ; exit ; fi |
---|
35 | |
---|
36 | |
---|
37 | yri=2001 |
---|
38 | yrf=2004 |
---|
39 | |
---|
40 | yr=$yri |
---|
41 | |
---|
42 | cd $sim |
---|
43 | pwd |
---|
44 | #mkdir -p Analyse/SE Analyse/TS_DA |
---|
45 | listemth="" |
---|
46 | listecosp="" |
---|
47 | listeday="" |
---|
48 | while [ $yr -le $yrf ] ; do |
---|
49 | for suf in $liste_suf ; do |
---|
50 | echo Utilisation de hist$suf.${yr}.nc |
---|
51 | if [ ! -f hist$suf.${yr}.nc ] ; then |
---|
52 | if [ ! -f "hist$suf.${yr}01.nc" -o ! -f "hist$suf.${yr}12.nc" ] ; then echo fichiers hist$suf.${yr}01.nc -f hist$suf.${yr}12.nc manquants ; exit ; fi |
---|
53 | echo cdo mergetime hist$suf.${yr}??.nc hist$suf.${yr}.nc |
---|
54 | cdo mergetime hist$suf.${yr}??.nc hist$suf.${yr}.nc |
---|
55 | fi |
---|
56 | done |
---|
57 | listemth="$listemth `ls histmth.${yr}.nc`" |
---|
58 | listecosp="$listecosp `ls histmthCOSP.${yr}.nc`" |
---|
59 | listeday="$listeday `ls histday.${yr}.nc`" |
---|
60 | (( yr = $yr + 1 )) |
---|
61 | done |
---|
62 | |
---|
63 | # liste des variables reconstruite a partir de |
---|
64 | # grep calias ~fabric/LMDZ/atlas/lmdz_SE.py | cut -d\' -f6 | sort | uniq | sed -e '/psl/d' |
---|
65 | |
---|
66 | varse="pourc_ter,pourc_oce,pourc_lic,pourc_sic,bils,cldt,flat,LWdnSFC,LWdnSFCclr,LWupSFC,ovap,precip,q2m,rh2m,rhum,sens,slp,SWdnSFC,SWdnSFCclr,SWdnTOA,SWupSFC,SWupSFCclr,SWupTOA,SWupTOAclr,t2m,taux_oce,tauy_oce,temp,topl,topl0,tsol,tsol_oce,vitu,vitv,vitw,wind10m,z500,snow,pr_lsc_i,pr_lsc_l,geop,phis,prw,cldl,cldm,cldh,cldt,w500,tops,tops0,sols,sols0,soll,soll0" |
---|
67 | varse="pourc_ter,pourc_oce,pourc_lic,pourc_sic,bils,cldt,flat,LWdnSFC,LWdnSFCclr,LWupSFC,ovap,precip,q2m,rh2m,rhum,sens,slp,SWdnSFC,SWdnSFCclr,SWdnTOA,SWupSFC,SWupSFCclr,SWupTOA,SWupTOAclr,t2m,temp,topl,topl0,tsol,vitu,vitv,vitw,wind10m,snow,pr_lsc_i,pr_lsc_l,geop,phis,prw,cldl,cldm,cldh,cldt,tops,tops0,sols,sols0,soll,soll0" |
---|
68 | # variables enlevees taux_oce, tauy_oce, tsol_oce, z500 |
---|
69 | |
---|
70 | vars1d="bils cldh cldl cldm cldq cldt evap flat pluc plul precip prw psol q2m q700 sens sicf slp soll sols SWdnSFC max min t2m t700 topl tops tsol u10m u700 u850 v10m v700 w700 wind10max wind10m" |
---|
71 | |
---|
72 | |
---|
73 | varcosp="cllcalipso,clhcalipso,clmcalipso,cltcalipso,clcalipso" |
---|
74 | |
---|
75 | #========================================================================== |
---|
76 | # Correction eventuelle pour des versions definissant mal le calendrier |
---|
77 | # 360d au lieu de 360_day. Corrige en avril 2017 |
---|
78 | listetout="" |
---|
79 | if [ $se = 1 ] ; then listetout="$listetout $listemth" ; fi |
---|
80 | if [ $da = 1 ] ; then listetout="$listetout $listeday" ; fi |
---|
81 | if [ 1 = 0 ] ; then |
---|
82 | for file in $listetout ; do |
---|
83 | cal=`ncdump -h $file | grep time_counter | grep calendar | cut -d\" -f2` |
---|
84 | if [ "$cal" = "360d" ] ; then |
---|
85 | echo Correction axe des temps $file |
---|
86 | ncatted -a calendar,"time_counter",o,c,"360_day" -O $file |
---|
87 | else |
---|
88 | echo $file correct |
---|
89 | fi |
---|
90 | done |
---|
91 | fi |
---|
92 | #========================================================================== |
---|
93 | |
---|
94 | |
---|
95 | mkdir -p $POST |
---|
96 | echo Running seasonal.sh on $POST |
---|
97 | cd $POST |
---|
98 | |
---|
99 | echo BIBBBBBB |
---|
100 | cat <<eod>| post_$sim |
---|
101 | #!/bin/bash |
---|
102 | #SBATCH --job-name=se_$sim |
---|
103 | #SBATCH -A gzi@cpu |
---|
104 | #SBATCH --nodes=1 |
---|
105 | #SBATCH --ntasks-per-node=1 |
---|
106 | #SBATCH --time=01:00:00 # Temps d’exécution maximum demandé (HH:MM:SS) |
---|
107 | #SBATCH --output=se_$sim%j # Nom du fichier de sortie |
---|
108 | #SBATCH --error=se_$sim%j |
---|
109 | |
---|
110 | . $local_d/lmdz_env.sh |
---|
111 | |
---|
112 | cd $POST |
---|
113 | ulimit -s unlimited |
---|
114 | MAINDIR=$MAINDIR |
---|
115 | OUT_D=$OUT_D |
---|
116 | sim=$sim |
---|
117 | |
---|
118 | mkdir -p $OUT_D/SE $OUT_D/TS_DA |
---|
119 | |
---|
120 | if [ $se = 1 ] ; then |
---|
121 | for mth in $listemth ; do |
---|
122 | ln -s $STORED/$sim/\$mth |
---|
123 | done |
---|
124 | ncrcat -v $varse $listemth -O tmp.nc |
---|
125 | out=$PRE${sim}_SE_${yri}_${yrf}_1M_histmth.nc |
---|
126 | if [ ! -f \$out ] ; then |
---|
127 | cdo ymonmean tmp.nc \$out |
---|
128 | fi |
---|
129 | if [ $cmor = 1 ] ; then |
---|
130 | for var in $( echo $varse | sed -e 's/,/ /g' ) ; do |
---|
131 | ncks -v \$var \$out -O $OUT_D/SE/\$var.nc |
---|
132 | done |
---|
133 | else |
---|
134 | mv \$out $OUT_D/SE/\$out |
---|
135 | fi |
---|
136 | fi |
---|
137 | |
---|
138 | if [ $cosp = 1 ] ; then |
---|
139 | for cosp in $listecosp ; do |
---|
140 | ln -s $STORED/$sim/\$cosp |
---|
141 | done |
---|
142 | ncrcat -v $varcosp $listecosp -O tmp.nc |
---|
143 | out=$PRE${sim}_SE_${yri}_${yrf}_1M_histmthCOSP.nc |
---|
144 | if [ ! -f \$out ] ; then |
---|
145 | cdo ymonmean tmp.nc \$out |
---|
146 | mv \$out $OUT_D/SE/\$out |
---|
147 | fi |
---|
148 | fi |
---|
149 | |
---|
150 | |
---|
151 | if [ $da = 1 ] ; then |
---|
152 | for day in $listeday ; do |
---|
153 | if [ ! -f \$day ] ; then ln -s $STORED/$sim/\$day ; fi |
---|
154 | done |
---|
155 | for var in $vars1d ; do |
---|
156 | out=$PRE${sim}_${yri}0101_${yrf}1231_1D_\$var.nc |
---|
157 | if [ ! -f \$out ] ; then |
---|
158 | echo ncrcat -v \$var $listeday \$out |
---|
159 | ncrcat -v \$var $listeday \$out |
---|
160 | mv \$out $OUT_D/TS_DA/\$out |
---|
161 | fi |
---|
162 | done |
---|
163 | fi |
---|
164 | eod |
---|
165 | |
---|
166 | |
---|
167 | submitcmd post_$sim |
---|