forked from NOAA-EMC/global-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforecast_det.sh
executable file
·87 lines (76 loc) · 2.67 KB
/
forecast_det.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
#! /usr/bin/env bash
#####
## "forecast_det.sh"
## This script sets value of all variables
##
## This is the child script of ex-global forecast,
## This script is a definition of functions.
#####
# For all non-evironment variables
# Cycling and forecast hour specific parameters
FV3_GFS_det(){
#-------------------------------------------------------
# warm start?
warm_start=${EXP_WARM_START:-".false."}
read_increment=${read_increment:-".false."}
res_latlon_dynamics="''"
# Determine if this is a warm start or cold start
if [[ -f "${gmemdir}/RESTART/${sPDY}.${scyc}0000.coupler.res" ]]; then
export warm_start=".true."
fi
# turn IAU off for cold start
DOIAU_coldstart=${DOIAU_coldstart:-"NO"}
if [ ${DOIAU} = "YES" -a ${warm_start} = ".false." ] || [ ${DOIAU_coldstart} = "YES" -a ${warm_start} = ".true." ]; then
export DOIAU="NO"
echo "turning off IAU since warm_start = ${warm_start}"
DOIAU_coldstart="YES"
IAU_OFFSET=0
sCDATE=${CDATE}
sPDY=${PDY}
scyc=${cyc}
tPDY=${sPDY}
tcyc=${cyc}
fi
#-------------------------------------------------------
# determine if restart IC exists to continue from a previous forecast
RERUN=${RERUN:-"NO"}
filecount=$(find "${RSTDIR_ATM:-/dev/null}" -type f | wc -l)
if [[ ( ${CDUMP} = "gfs" || ( ${RUN} = "gefs" && ${CDATE_RST} = "" )) && ${rst_invt1} -gt 0 && ${FHMAX} -gt ${rst_invt1} && ${filecount} -gt 10 ]]; then
reverse=$(echo "${restart_interval[@]} " | tac -s ' ')
for xfh in ${reverse} ; do
yfh=$((xfh-(IAU_OFFSET/2)))
SDATE=$(${NDATE} +${yfh} "${CDATE}")
PDYS=$(echo "${SDATE}" | cut -c1-8)
cycs=$(echo "${SDATE}" | cut -c9-10)
flag1=${RSTDIR_ATM}/${PDYS}.${cycs}0000.coupler.res
flag2=${RSTDIR_ATM}/coupler.res
#make sure that the wave restart files also exist if cplwav=true
waverstok=".true."
if [[ "${cplwav}" = ".true." ]]; then
for wavGRD in ${waveGRD} ; do
if [[ ! -f "${RSTDIR_WAVE}/${PDYS}.${cycs}0000.restart.${wavGRD}" ]]; then
waverstok=".false."
fi
done
fi
if [[ -s "${flag1}" ]] && [[ ${waverstok} = ".true." ]]; then
CDATE_RST=${SDATE}
[[ ${RERUN} = "YES" ]] && break
mv "${flag1}" "${flag1}.old"
if [[ -s "${flag2}" ]]; then mv "${flag2}" "${flag2}.old" ;fi
RERUN="YES"
[[ ${xfh} = ${rst_invt1} ]] && RERUN="NO"
fi
done
fi
#-------------------------------------------------------
}
WW3_det(){
echo "SUB ${FUNCNAME[0]}: Run type determination for WW3"
}
CICE_det(){
echo "SUB ${FUNCNAME[0]}: Run type determination for CICE"
}
MOM6_det(){
echo "SUB ${FUNCNAME[0]}: Run type determination for MOM6"
}