source: BOL/LMDZ_Setup/seasonal.sh @ 5226

Last change on this file since 5226 was 4615, checked in by asima, 17 months ago

Initial import of LMDZ_Setup environment
(former TEST_PROD which was distributed as tutorial_prod.tar).

See also related doc LMDZ_Setup_HowTo (former tutorial_prod_FAQ) :
https://docs.google.com/document/d/1OLZG6e-86NiXuv5-aALxKIh-QPkp4BdCwWtiBFot-6c

This initial import corresponds to TEST_PROD from
https://lmdz.lmd.jussieu.fr/pub/Training/Archive/tutorial_prod.tar_v20230707.

Previous versions of tutorial_prod.tar are available at
https://lmdz.lmd.jussieu.fr/pub/Training/Archive

File size: 4.2 KB
Line 
1#!/bin/bash
2
3#set -vx
4
5module load cdo
6
7sim=$1
8MAINDIR=`basename \`pwd\``
9PRE=FH$MAINDIR
10echo $PRE
11STORED=$STORE
12WORKD=$WORK
13
14se=1
15cosp=0
16da=0
17
18if [ ! -d $sim ] ; then echo la simulation $sim n existe pas ; exit ; fi
19
20
21yri=2001
22yrf=2003
23
24yr=$yri
25
26cd $sim
27pwd
28#mkdir -p Analyse/SE Analyse/TS_DA
29listemth=""
30listecosp=""
31listeday=""
32while [ $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 ))
45done
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
50varse="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
52vars1d="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
55varcosp="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
60listetout=""
61if [ $se = 1 ] ; then listetout="$listetout $listemth" ; fi
62if [ $da = 1 ] ; then listetout="$listetout $listeday" ; fi
63if [ 1 = 0 ] ; then
64for 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
72done
73fi
74#==========================================================================
75
76
77POST=$SCRATCH/$MAINDIR/POST/$sim
78mkdir -p $POST
79cd $POST
80
81echo BIBBBBBB
82cat <<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
92module purge
93module load intel-compilers/19.0.4
94module load nco
95module load cdo
96
97cd $POST
98ulimit -s unlimited
99MAINDIR=$MAINDIR
100sim=$sim
101
102mkdir -p $WORKD/$MAINDIR/$sim/Analyse/SE $WORKD/$MAINDIR/$sim/Analyse/TS_DA
103
104if [ $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
115fi
116
117if [ $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
128fi
129
130
131if [ $da = 1 ] ; then
132for day in $listeday ; do
133   if [ ! -f \$day ] ; then ln -s $STORED/$MAINDIR/$sim/\$day ; fi
134done
135for 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
143done
144fi
145eod
146
147
148sbatch post_$sim
Note: See TracBrowser for help on using the repository browser.