[4615] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | #set -vx |
---|
| 4 | |
---|
| 5 | module load cdo |
---|
| 6 | |
---|
| 7 | sim=$1 |
---|
| 8 | MAINDIR=`basename \`pwd\`` |
---|
| 9 | PRE=FH$MAINDIR |
---|
| 10 | echo $PRE |
---|
| 11 | STORED=$STORE |
---|
| 12 | WORKD=$WORK |
---|
| 13 | |
---|
| 14 | se=1 |
---|
| 15 | cosp=0 |
---|
| 16 | da=0 |
---|
| 17 | |
---|
| 18 | if [ ! -d $sim ] ; then echo la simulation $sim n existe pas ; exit ; fi |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | yri=2001 |
---|
| 22 | yrf=2003 |
---|
| 23 | |
---|
| 24 | yr=$yri |
---|
| 25 | |
---|
| 26 | cd $sim |
---|
| 27 | pwd |
---|
| 28 | #mkdir -p Analyse/SE Analyse/TS_DA |
---|
| 29 | listemth="" |
---|
| 30 | listecosp="" |
---|
| 31 | listeday="" |
---|
| 32 | while [ $yr -le $yrf ] ; do |
---|
| 33 | for suf in day mth ; do |
---|
| 34 | echo Utilisation de hist$suf.${yr}.nc |
---|
| 35 | if [ ! -f hist$suf.${yr}.nc ] ; then |
---|
| 36 | 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 |
---|
| 37 | echo cdo mergetime hist$suf.${yr}??.nc hist$suf.${yr}.nc |
---|
| 38 | cdo mergetime hist$suf.${yr}??.nc hist$suf.${yr}.nc |
---|
| 39 | fi |
---|
| 40 | done |
---|
| 41 | listemth="$listemth `ls histmth.${yr}.nc`" |
---|
| 42 | listecosp="$listecosp `ls histmthCOSP.${yr}.nc`" |
---|
| 43 | listeday="$listeday `ls histday.${yr}.nc`" |
---|
| 44 | (( yr = $yr + 1 )) |
---|
| 45 | done |
---|
| 46 | |
---|
| 47 | # liste des variables reconstruite a partir de |
---|
| 48 | # grep calias ~fabric/LMDZ/atlas/lmdz_SE.py | cut -d\' -f6 | sort | uniq | sed -e '/psl/d' |
---|
| 49 | |
---|
| 50 | 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" |
---|
| 51 | |
---|
| 52 | 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" |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | varcosp="cllcalipso,clhcalipso,clmcalipso,cltcalipso,clcalipso" |
---|
| 56 | |
---|
| 57 | #========================================================================== |
---|
| 58 | # Correction eventuelle pour des versions definissant mal le calendrier |
---|
| 59 | # 360d au lieu de 360_day. Corrige en avril 2017 |
---|
| 60 | listetout="" |
---|
| 61 | if [ $se = 1 ] ; then listetout="$listetout $listemth" ; fi |
---|
| 62 | if [ $da = 1 ] ; then listetout="$listetout $listeday" ; fi |
---|
| 63 | if [ 1 = 0 ] ; then |
---|
| 64 | for file in $listetout ; do |
---|
| 65 | cal=`ncdump -h $file | grep time_counter | grep calendar | cut -d\" -f2` |
---|
| 66 | if [ "$cal" = "360d" ] ; then |
---|
| 67 | echo Correction axe des temps $file |
---|
| 68 | ncatted -a calendar,"time_counter",o,c,"360_day" -O $file |
---|
| 69 | else |
---|
| 70 | echo $file correct |
---|
| 71 | fi |
---|
| 72 | done |
---|
| 73 | fi |
---|
| 74 | #========================================================================== |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | POST=$SCRATCH/$MAINDIR/POST/$sim |
---|
| 78 | mkdir -p $POST |
---|
| 79 | cd $POST |
---|
| 80 | |
---|
| 81 | echo BIBBBBBB |
---|
| 82 | cat <<eod>| post_$sim |
---|
| 83 | #!/bin/bash |
---|
| 84 | #SBATCH --job-name=se_$sim |
---|
| 85 | #SBATCH -A gzi@cpu |
---|
| 86 | #SBATCH --nodes=1 |
---|
| 87 | #SBATCH --ntasks-per-node=1 |
---|
| 88 | #SBATCH --time=01:00:00 # Temps d’exécution maximum demandé (HH:MM:SS) |
---|
| 89 | #SBATCH --output=se_$sim%j # Nom du fichier de sortie |
---|
| 90 | #SBATCH --error=se_$sim%j |
---|
| 91 | |
---|
| 92 | module purge |
---|
| 93 | module load intel-compilers/19.0.4 |
---|
| 94 | module load nco |
---|
| 95 | module load cdo |
---|
| 96 | |
---|
| 97 | cd $POST |
---|
| 98 | ulimit -s unlimited |
---|
| 99 | MAINDIR=$MAINDIR |
---|
| 100 | sim=$sim |
---|
| 101 | |
---|
| 102 | mkdir -p $WORKD/$MAINDIR/$sim/Analyse/SE $WORKD/$MAINDIR/$sim/Analyse/TS_DA |
---|
| 103 | |
---|
| 104 | if [ $se = 1 ] ; then |
---|
| 105 | for mth in $listemth ; do |
---|
| 106 | ln -s $STORED/$MAINDIR/$sim/\$mth |
---|
| 107 | done |
---|
| 108 | ncrcat -v $varse $listemth -O tmp.nc |
---|
| 109 | out=$PRE${sim}_SE_${yri}_${yrf}_1M_histmth.nc |
---|
| 110 | if [ ! -f \$out ] ; then |
---|
| 111 | cdo ymonmean tmp.nc \$out |
---|
| 112 | mv \$out $WORKD/$MAINDIR/$sim/Analyse/SE/\$out |
---|
| 113 | cd $WORKD ; mfthredds -d $MAINDIR/$sim/Analyse/SE $MAINDIR/$sim/Analyse/SE/\$out ; cd - |
---|
| 114 | fi |
---|
| 115 | fi |
---|
| 116 | |
---|
| 117 | if [ $cosp = 1 ] ; then |
---|
| 118 | for cosp in $listecosp ; do |
---|
| 119 | ln -s $STORED/$MAINDIR/$sim/\$cosp |
---|
| 120 | done |
---|
| 121 | ncrcat -v $varcosp $listecosp -O tmp.nc |
---|
| 122 | out=$PRE${sim}_SE_${yri}_${yrf}_1M_histmthCOSP.nc |
---|
| 123 | if [ ! -f \$out ] ; then |
---|
| 124 | cdo ymonmean tmp.nc \$out |
---|
| 125 | mv \$out $WORKD/$MAINDIR/$sim/Analyse/SE/\$out |
---|
| 126 | cd $WORKD ; mfthredds -d $MAINDIR/$sim/Analyse/SE $MAINDIR/$sim/Analyse/SE/\$out ; cd - |
---|
| 127 | fi |
---|
| 128 | fi |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | if [ $da = 1 ] ; then |
---|
| 132 | for day in $listeday ; do |
---|
| 133 | if [ ! -f \$day ] ; then ln -s $STORED/$MAINDIR/$sim/\$day ; fi |
---|
| 134 | done |
---|
| 135 | for var in $vars1d ; do |
---|
| 136 | out=$PRE${sim}_${yri}0101_${yrf}1231_1D_\$var.nc |
---|
| 137 | if [ ! -f \$out ] ; then |
---|
| 138 | echo ncrcat -v \$var $listeday \$out |
---|
| 139 | ncrcat -v \$var $listeday \$out |
---|
| 140 | mv \$out $WORKD/$MAINDIR/$sim/Analyse/TS_DA/\$out |
---|
| 141 | cd $WORKD ; mfthredds -d $MAINDIR/$sim/Analyse/TS_DA $MAINDIR/$sim/Analyse/TS_DA/\$out ; cd - |
---|
| 142 | fi |
---|
| 143 | done |
---|
| 144 | fi |
---|
| 145 | eod |
---|
| 146 | |
---|
| 147 | |
---|
| 148 | sbatch post_$sim |
---|