-
Notifications
You must be signed in to change notification settings - Fork 2
/
main_ensemble.sh
executable file
·89 lines (75 loc) · 2.09 KB
/
main_ensemble.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# File: main_ensemble.sh
# Author : Jiping XIE
# Date: April in 2022
#
# Description:
# This is the top level script for data assimilation cycle
# in TOPAZ5 reanalysis.
#STARTASSIM=1 # 1 is default, enter 0 to skip the very first assimilation
STARTASSIM=0 # 1 is default, enter 0 to skip the very first assimilation
#JULDAYSTART0=18938
JULDAYSTART0=24000
set -e # exit on error
set -u # exit on unset variables
set -p # nothing is inherited from the shell
#set -x # for debuging
#source /nird/home/xiejp/bash_profile_enkf-default
. common_specs.sh
./SCRIPTS/check_directories.sh
JULDAYSTART=`cat JULDAY.txt`
((JULDAYEND = 26000)) # 31 December 2013
echo " JULDAYSTART = ${JULDAYSTART}"
echo " JULDAYEND = ${JULDAYEND}"
for (( day = ${JULDAYSTART}; day <= ${JULDAYEND}; day += 15 ))
do
#if (( ${STARTASSIM} || ${day} > ${JULDAYSTART} ))
if (( ${STARTASSIM} && ${day} > ${JULDAYSTART} ))
then
echo
echo "Starting assimilation for day ${day} since 1 Jan 1950"
echo
cd ASSIM
echo "JULDAY=${day}" > assimilation_specs.sh
cat ../common_specs.sh >> assimilation_specs.sh
cat assimilation_specs.in >> assimilation_specs.sh
echo "JULDAYSTART=${JULDAYSTART}" >> assimilation_specs.sh
echo "CWD="`pwd` >> assimilation_specs.sh
(( ncycle = ( ${day} - ${JULDAYSTART0} ) / 7 ))
if (( $ncycle <= 20 ))
then
(( RFACTOR = 8 ))
elif (( $ncycle <= 35 ))
then
(( RFACTOR = 4 ))
elif (( $ncycle <= 45 ))
then
(( RFACTOR = 2 ))
else
(( RFACTOR = 1 ))
fi
cat ./FILES/enkf.in |\
awk -f SCRIPTS/setparameter.awk -v PRM=rfactor1 -v VAL=${RFACTOR} |\
awk -f SCRIPTS/setparameter.awk -v PRM=enssize -v VAL=${ENSSIZE} \
> enkf.prm
./SCRIPTS/assimilate.sh
cd ..
if [ -f STOP ]
then
exit
fi
fi
echo
echo "Starting propagation for day ${day} since 1 Jan 1950"
echo
cd PROP
cp -f ../common_specs.sh propagation_specs.sh
cat propagation_specs.in >> propagation_specs.sh
echo "JULDAY=${day}" >> propagation_specs.sh
./SCRIPTS/propagate_sr.sh
cd ..
if [ -f STOP ]
then
exit
fi
done