Skip to content

Commit 9cf134a

Browse files
GDAS Init utility - consolidate the copy of coldstart files (#773)
Place the copy of the coldstart files in a common script called copy_coldstart_files.sh. Fixes #772.
1 parent 26167e3 commit 9cf134a

8 files changed

+95
-156
lines changed

util/gdas_init/config

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ OUTDIR=/lfs/h2/emc/stmp/$USER/gdas.init/output
7979
#---------------------------------------------------------
8080
# Dont touch anything below here.
8181
#---------------------------------------------------------
82+
83+
GDAS_INIT_DIR=$UFS_DIR/util/gdas_init
84+
EXEC_DIR=$UFS_DIR/exec
85+
8286
if [ "$use_v16retro" = "yes" ]; then
8387

8488
gfs_ver=v16retro
@@ -113,4 +117,4 @@ else
113117
fi
114118

115119
export EXTRACT_DIR yy mm dd hh UFS_DIR OUTDIR CRES_HIRES CRES_ENKF FRAC_ORO
116-
export LEVS gfs_ver
120+
export LEVS gfs_ver EXEC_DIR GDAS_INIT_DIR
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
# Copy files from the working directory to the
4+
# output directory.
5+
6+
copy_data()
7+
{
8+
9+
set -x
10+
11+
mkdir -p $SAVEDIR
12+
cp gfs_ctrl.nc $SAVEDIR
13+
14+
for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
15+
do
16+
cp out.atm.${tile}.nc ${SAVEDIR}/gfs_data.${tile}.nc
17+
cp out.sfc.${tile}.nc ${SAVEDIR}/sfc_data.${tile}.nc
18+
done
19+
}
20+
21+
set -x
22+
23+
MEMBER=$1
24+
OUTDIR=$2
25+
yy=$3
26+
mm=$4
27+
dd=$5
28+
hh=$6
29+
INPUT_DATA_DIR=$7
30+
31+
if [ ${MEMBER} == 'hires' ]; then
32+
MEMBER='gdas'
33+
fi
34+
35+
set +x
36+
echo 'COPY DATA TO OUTPUT DIRECTORY'
37+
set -x
38+
39+
if [ ${MEMBER} == 'gdas' ] || [ ${MEMBER} == 'gfs' ]; then
40+
SUBDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}
41+
rm -fr $SUBDIR
42+
SAVEDIR=$SUBDIR/atmos/INPUT
43+
copy_data
44+
if [ ${MEMBER} == 'gdas' ]; then
45+
cp ${INPUT_DATA_DIR}/*abias* $SAVEDIR/..
46+
cp ${INPUT_DATA_DIR}/*radstat $SAVEDIR/..
47+
fi
48+
touch $SAVEDIR/../${MEMBER}.t${hh}z.loginc.txt
49+
elif [ ${MEMBER} == 'enkf' ]; then # v16 retro data only.
50+
MEMBER=1
51+
while [ $MEMBER -le 80 ]; do
52+
if [ $MEMBER -lt 10 ]; then
53+
MEMBER_CH="00${MEMBER}"
54+
else
55+
MEMBER_CH="0${MEMBER}"
56+
fi
57+
SUBDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER_CH}
58+
rm -fr $SUBDIR
59+
SAVEDIR=$SUBDIR/atmos/INPUT
60+
copy_data
61+
touch $SAVEDIR/../enkfgdas.t${hh}z.loginc.txt
62+
MEMBER=$(( $MEMBER + 1 ))
63+
done
64+
else
65+
SUBDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}
66+
rm -fr $SUBDIR
67+
SAVEDIR=$SUBDIR/atmos/INPUT
68+
copy_data
69+
touch $SAVEDIR/../enkfgdas.t${hh}z.loginc.txt
70+
fi
71+
72+
exit 0

util/gdas_init/run_pre-v14.chgres.sh

+3-27
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ WORKDIR=${WORKDIR:-$OUTDIR/work.${MEMBER}}
1818
if [ "${MEMBER}" = "gdas" ] || [ "${MEMBER}" = "gfs" ]; then
1919
CTAR=${CRES_HIRES}
2020
INPUT_DATA_DIR="${EXTRACT_DIR}/${MEMBER}.${yy}${mm}${dd}/${hh}"
21-
RADSTAT_DATA_DIR="${EXTRACT_DIR}/${MEMBER}.${yy}${mm}${dd}/${hh}"
22-
OUTDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}/atmos
2321
if [ "${MEMBER}" = "gdas" ]; then
2422
ATMFILE="gdas1.t${hh}z.sanl"
2523
SFCFILE="gdas1.t${hh}z.sfcanl"
@@ -30,8 +28,6 @@ if [ "${MEMBER}" = "gdas" ] || [ "${MEMBER}" = "gfs" ]; then
3028
else
3129
CTAR=${CRES_ENKF}
3230
INPUT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
33-
RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
34-
OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}/atmos
3531
ATMFILE="siganl_${yy}${mm}${dd}${hh}_mem${MEMBER}"
3632
SFCFILE="sfcanl_${yy}${mm}${dd}${hh}_mem${MEMBER}"
3733
fi
@@ -40,11 +36,7 @@ rm -fr $WORKDIR
4036
mkdir -p $WORKDIR
4137
cd $WORKDIR
4238

43-
rm -fr $OUTDIR
44-
mkdir -p $OUTDIR
45-
mkdir -p $OUTDIR/INPUT
46-
47-
source $UFS_DIR/util/gdas_init/set_fixed_files.sh
39+
source $GDAS_INIT_DIR/set_fixed_files.sh
4840

4941
cat << EOF > fort.41
5042
@@ -69,30 +61,14 @@ cat << EOF > fort.41
6961
/
7062
EOF
7163

72-
$APRUN $UFS_DIR/exec/chgres_cube
64+
$APRUN $EXEC_DIR/chgres_cube
7365
rc=$?
7466

7567
if [ $rc != 0 ]; then
7668
exit $rc
7769
fi
7870

79-
mv gfs_ctrl.nc ${OUTDIR}/INPUT
80-
81-
for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
82-
do
83-
mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc
84-
mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc
85-
done
86-
87-
if [ "${MEMBER}" = "gdas" ]; then
88-
cp ${RADSTAT_DATA_DIR}/*radstat* $OUTDIR
89-
cp ${RADSTAT_DATA_DIR}/*abias* $OUTDIR
90-
touch $OUTDIR/gdas.t${hh}z.loginc.txt
91-
elif [ "${MEMBER}" = "gfs" ]; then
92-
touch $OUTDIR/gfs.t${hh}z.loginc.txt
93-
else
94-
touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt
95-
fi
71+
$GDAS_INIT_DIR/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $INPUT_DATA_DIR
9672

9773
rm -fr $WORKDIR
9874

util/gdas_init/run_v14.chgres.sh

+3-27
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ WORKDIR=${WORKDIR:-$OUTDIR/work.${MEMBER}}
1717
if [ "${MEMBER}" = "gdas" ] || [ "${MEMBER}" = "gfs" ]; then
1818
CTAR=${CRES_HIRES}
1919
INPUT_DATA_DIR="${EXTRACT_DIR}/${MEMBER}.${yy}${mm}${dd}/${hh}"
20-
RADSTAT_DATA_DIR="${EXTRACT_DIR}/${MEMBER}.${yy}${mm}${dd}/${hh}"
21-
OUTDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}/atmos
2220
ATMFILE="${MEMBER}.t${hh}z.atmanl.nemsio"
2321
SFCFILE="${MEMBER}.t${hh}z.sfcanl.nemsio"
2422
NSTFILE="${MEMBER}.t${hh}z.nstanl.nemsio"
2523
else
2624
CTAR=${CRES_ENKF}
2725
INPUT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
28-
RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
29-
OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}/atmos
3026
ATMFILE="gdas.t${hh}z.ratmanl.mem${MEMBER}.nemsio"
3127
SFCFILE="gdas.t${hh}z.sfcanl.mem${MEMBER}.nemsio"
3228
NSTFILE="gdas.t${hh}z.nstanl.mem${MEMBER}.nemsio"
@@ -36,11 +32,7 @@ rm -fr $WORKDIR
3632
mkdir -p $WORKDIR
3733
cd $WORKDIR
3834

39-
rm -fr $OUTDIR
40-
mkdir -p $OUTDIR
41-
mkdir -p $OUTDIR/INPUT
42-
43-
source $UFS_DIR/util/gdas_init/set_fixed_files.sh
35+
source $GDAS_INIT_DIR/set_fixed_files.sh
4436

4537
cat << EOF > fort.41
4638
@@ -66,30 +58,14 @@ cat << EOF > fort.41
6658
/
6759
EOF
6860

69-
$APRUN $UFS_DIR/exec/chgres_cube
61+
$APRUN $EXEC_DIR/chgres_cube
7062
rc=$?
7163

7264
if [ $rc != 0 ]; then
7365
exit $rc
7466
fi
7567

76-
mv gfs_ctrl.nc ${OUTDIR}/INPUT
77-
78-
for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
79-
do
80-
mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc
81-
mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc
82-
done
83-
84-
if [ "${MEMBER}" = "gdas" ]; then
85-
cp ${RADSTAT_DATA_DIR}/*radstat* $OUTDIR
86-
cp ${RADSTAT_DATA_DIR}/*abias* $OUTDIR
87-
touch $OUTDIR/gdas.t${hh}z.loginc.txt
88-
elif [ "${MEMBER}" = "gfs" ]; then
89-
touch $OUTDIR/gfs.t${hh}z.loginc.txt
90-
else
91-
touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt
92-
fi
68+
$GDAS_INIT_DIR/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $INPUT_DATA_DIR
9369

9470
rm -fr $WORKDIR
9571

util/gdas_init/run_v15.chgres.gfs.sh

+3-16
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,14 @@ WORKDIR=${WORKDIR:-$OUTDIR/work.gfs}
1515

1616
CTAR=${CRES_HIRES}
1717
INPUT_DATA_DIR="${EXTRACT_DIR}/gfs.${yy}${mm}${dd}/${hh}"
18-
OUTDIR=$OUTDIR/gfs.${yy}${mm}${dd}/${hh}/atmos
1918
ATMFILE="gfs.t${hh}z.atmanl.nemsio"
2019
SFCFILE="gfs.t${hh}z.sfcanl.nemsio"
2120

2221
rm -fr $WORKDIR
2322
mkdir -p $WORKDIR
2423
cd $WORKDIR
2524

26-
rm -fr $OUTDIR
27-
mkdir -p $OUTDIR
28-
mkdir -p $OUTDIR/INPUT
29-
30-
source $UFS_DIR/util/gdas_init/set_fixed_files.sh
25+
source $GDAS_INIT_DIR/set_fixed_files.sh
3126

3227
cat << EOF > fort.41
3328
@@ -52,22 +47,14 @@ cat << EOF > fort.41
5247
/
5348
EOF
5449

55-
$APRUN $UFS_DIR/exec/chgres_cube
50+
$APRUN $EXEC_DIR/chgres_cube
5651
rc=$?
5752

5853
if [ $rc != 0 ]; then
5954
exit $rc
6055
fi
6156

62-
mv gfs_ctrl.nc ${OUTDIR}/INPUT
63-
64-
for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
65-
do
66-
mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc
67-
mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc
68-
done
69-
70-
touch $OUTDIR/gfs.t${hh}z.loginc.txt
57+
$GDAS_INIT_DIR/copy_coldstart_files.sh gfs $OUTDIR $yy $mm $dd $hh $INPUT_DATA_DIR
7158

7259
rm -fr $WORKDIR
7360

util/gdas_init/run_v15.chgres.sh

+3-22
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,18 @@ if [ ${MEMBER} == 'gdas' ]; then
2727
CTAR=${CRES_HIRES}
2828
INPUT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy_d}${mm_d}${dd_d}/${hh_d}/RESTART"
2929
RADSTAT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}"
30-
OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh}/atmos
3130
else
3231
CINP=${CINP:-"C384"}
3332
CTAR=${CRES_ENKF}
3433
INPUT_DATA_DIR="${EXTRACT_DIR}/enkfgdas.${yy_d}${mm_d}${dd_d}/${hh_d}/mem${MEMBER}/RESTART"
3534
RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
36-
OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}/atmos
3735
fi
3836

3937
rm -fr $WORKDIR
4038
mkdir -p $WORKDIR
4139
cd $WORKDIR
4240

43-
rm -fr $OUTDIR
44-
mkdir -p $OUTDIR
45-
mkdir -p $OUTDIR/INPUT
46-
47-
source $UFS_DIR/util/gdas_init/set_fixed_files.sh
41+
source $GDAS_INIT_DIR/set_fixed_files.sh
4842

4943
cat << EOF > fort.41
5044
@@ -72,27 +66,14 @@ cat << EOF > fort.41
7266
/
7367
EOF
7468

75-
$APRUN $UFS_DIR/exec/chgres_cube
69+
$APRUN $EXEC_DIR/chgres_cube
7670
rc=$?
7771

7872
if [ $rc != 0 ]; then
7973
exit $rc
8074
fi
8175

82-
mv gfs_ctrl.nc ${OUTDIR}/INPUT
83-
84-
for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
85-
do
86-
mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc
87-
mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc
88-
done
89-
90-
if [ ${MEMBER} == 'gdas' ]; then
91-
cp ${RADSTAT_DATA_DIR}/* $OUTDIR
92-
touch $OUTDIR/gdas.t${hh}z.loginc.txt
93-
else
94-
touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt
95-
fi
76+
$GDAS_INIT_DIR/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $RADSTAT_DATA_DIR
9677

9778
rm -fr $WORKDIR
9879

util/gdas_init/run_v16.chgres.sh

+3-28
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
#!/bin/bash
22

3-
copy_data()
4-
{
5-
6-
mkdir -p $SAVEDIR
7-
cp gfs_ctrl.nc $SAVEDIR
8-
9-
for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
10-
do
11-
cp out.atm.${tile}.nc ${SAVEDIR}/gfs_data.${tile}.nc
12-
cp out.sfc.${tile}.nc ${SAVEDIR}/sfc_data.${tile}.nc
13-
done
14-
}
15-
163
#---------------------------------------------------------------------------
174
# Run chgres using v16 netcdf history data as input. These history
185
# files are part of the OPS v16 gfs/gdas/enkf tarballs, and the
@@ -59,7 +46,7 @@ rm -fr $WORKDIR
5946
mkdir -p $WORKDIR
6047
cd $WORKDIR
6148

62-
source $UFS_DIR/util/gdas_init/set_fixed_files.sh
49+
source $GDAS_INIT_DIR/set_fixed_files.sh
6350

6451
cat << EOF > fort.41
6552
@@ -84,26 +71,14 @@ cat << EOF > fort.41
8471
/
8572
EOF
8673

87-
$APRUN $UFS_DIR/exec/chgres_cube
74+
$APRUN $EXEC_DIR/chgres_cube
8875
rc=$?
8976

9077
if [ $rc != 0 ]; then
9178
exit $rc
9279
fi
9380

94-
if [ ${MEMBER} == 'gdas' ] || [ ${MEMBER} == 'gfs' ]; then
95-
SAVEDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}/atmos/INPUT
96-
copy_data
97-
touch $SAVEDIR/../${MEMBER}.t${hh}z.loginc.txt
98-
if [ ${MEMBER} == 'gdas' ]; then
99-
cp ${INPUT_DATA_DIR}/*abias* $SAVEDIR/..
100-
cp ${INPUT_DATA_DIR}/*radstat $SAVEDIR/..
101-
fi
102-
else
103-
SAVEDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}/atmos/INPUT
104-
copy_data
105-
touch $SAVEDIR/../enkfgdas.t${hh}z.loginc.txt
106-
fi
81+
$GDAS_INIT_DIR/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $INPUT_DATA_DIR
10782

10883
rm -fr $WORKDIR
10984

0 commit comments

Comments
 (0)