Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDAS Init utility - consolidate the copy of coldstart files #773

Merged
69 changes: 69 additions & 0 deletions util/gdas_init/copy_coldstart_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

copy_data()
{

set -x

mkdir -p $SAVEDIR
cp gfs_ctrl.nc $SAVEDIR

for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
do
cp out.atm.${tile}.nc ${SAVEDIR}/gfs_data.${tile}.nc
cp out.sfc.${tile}.nc ${SAVEDIR}/sfc_data.${tile}.nc
done
}

set -x

MEMBER=$1
OUTDIR=$2
yy=$3
mm=$4
dd=$5
hh=$6
INPUT_DATA_DIR=$7

if [ ${MEMBER} == 'hires' ]; then
MEMBER='gdas'
fi

set +x
echo 'COPY DATA TO OUTPUT DIRECTORY'
set -x

if [ ${MEMBER} == 'gdas' ] || [ ${MEMBER} == 'gfs' ]; then
SUBDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}
rm -fr $SUBDIR
SAVEDIR=$SUBDIR/atmos/INPUT
copy_data
if [ ${MEMBER} == 'gdas' ]; then
cp ${INPUT_DATA_DIR}/*abias* $SAVEDIR/..
cp ${INPUT_DATA_DIR}/*radstat $SAVEDIR/..
fi
touch $SAVEDIR/../${MEMBER}.t${hh}z.loginc.txt
elif [ ${MEMBER} == 'enkf' ]; then # v16 retro data only.
MEMBER=1
while [ $MEMBER -le 80 ]; do
if [ $MEMBER -lt 10 ]; then
MEMBER_CH="00${MEMBER}"
else
MEMBER_CH="0${MEMBER}"
fi
SUBDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER_CH}
rm -fr $SUBDIR
SAVEDIR=$SUBDIR/atmos/INPUT
copy_data
touch $SAVEDIR/../enkfgdas.t${hh}z.loginc.txt
MEMBER=$(( $MEMBER + 1 ))
done
else
SUBDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}
rm -fr $SUBDIR
SAVEDIR=$SUBDIR/atmos/INPUT
copy_data
touch $SAVEDIR/../enkfgdas.t${hh}z.loginc.txt
fi

exit 0
26 changes: 1 addition & 25 deletions util/gdas_init/run_pre-v14.chgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ WORKDIR=${WORKDIR:-$OUTDIR/work.${MEMBER}}
if [ "${MEMBER}" = "gdas" ] || [ "${MEMBER}" = "gfs" ]; then
CTAR=${CRES_HIRES}
INPUT_DATA_DIR="${EXTRACT_DIR}/${MEMBER}.${yy}${mm}${dd}/${hh}"
RADSTAT_DATA_DIR="${EXTRACT_DIR}/${MEMBER}.${yy}${mm}${dd}/${hh}"
OUTDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}/atmos
if [ "${MEMBER}" = "gdas" ]; then
ATMFILE="gdas1.t${hh}z.sanl"
SFCFILE="gdas1.t${hh}z.sfcanl"
Expand All @@ -30,8 +28,6 @@ if [ "${MEMBER}" = "gdas" ] || [ "${MEMBER}" = "gfs" ]; then
else
CTAR=${CRES_ENKF}
INPUT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}/atmos
ATMFILE="siganl_${yy}${mm}${dd}${hh}_mem${MEMBER}"
SFCFILE="sfcanl_${yy}${mm}${dd}${hh}_mem${MEMBER}"
fi
Expand All @@ -40,10 +36,6 @@ rm -fr $WORKDIR
mkdir -p $WORKDIR
cd $WORKDIR

rm -fr $OUTDIR
mkdir -p $OUTDIR
mkdir -p $OUTDIR/INPUT

cat << EOF > fort.41

&config
Expand Down Expand Up @@ -74,23 +66,7 @@ if [ $rc != 0 ]; then
exit $rc
fi

mv gfs_ctrl.nc ${OUTDIR}/INPUT

for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
do
mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc
mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc
done

if [ "${MEMBER}" = "gdas" ]; then
cp ${RADSTAT_DATA_DIR}/*radstat* $OUTDIR
cp ${RADSTAT_DATA_DIR}/*abias* $OUTDIR
touch $OUTDIR/gdas.t${hh}z.loginc.txt
elif [ "${MEMBER}" = "gfs" ]; then
touch $OUTDIR/gfs.t${hh}z.loginc.txt
else
touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt
fi
$UFS_DIR/util/gdas_init/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $INPUT_DATA_DIR

rm -fr $WORKDIR

Expand Down
26 changes: 1 addition & 25 deletions util/gdas_init/run_v14.chgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ WORKDIR=${WORKDIR:-$OUTDIR/work.${MEMBER}}
if [ "${MEMBER}" = "gdas" ] || [ "${MEMBER}" = "gfs" ]; then
CTAR=${CRES_HIRES}
INPUT_DATA_DIR="${EXTRACT_DIR}/${MEMBER}.${yy}${mm}${dd}/${hh}"
RADSTAT_DATA_DIR="${EXTRACT_DIR}/${MEMBER}.${yy}${mm}${dd}/${hh}"
OUTDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}/atmos
ATMFILE="${MEMBER}.t${hh}z.atmanl.nemsio"
SFCFILE="${MEMBER}.t${hh}z.sfcanl.nemsio"
NSTFILE="${MEMBER}.t${hh}z.nstanl.nemsio"
else
CTAR=${CRES_ENKF}
INPUT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}/atmos
ATMFILE="gdas.t${hh}z.ratmanl.mem${MEMBER}.nemsio"
SFCFILE="gdas.t${hh}z.sfcanl.mem${MEMBER}.nemsio"
NSTFILE="gdas.t${hh}z.nstanl.mem${MEMBER}.nemsio"
Expand All @@ -36,10 +32,6 @@ rm -fr $WORKDIR
mkdir -p $WORKDIR
cd $WORKDIR

rm -fr $OUTDIR
mkdir -p $OUTDIR
mkdir -p $OUTDIR/INPUT

cat << EOF > fort.41

&config
Expand Down Expand Up @@ -71,23 +63,7 @@ if [ $rc != 0 ]; then
exit $rc
fi

mv gfs_ctrl.nc ${OUTDIR}/INPUT

for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
do
mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc
mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc
done

if [ "${MEMBER}" = "gdas" ]; then
cp ${RADSTAT_DATA_DIR}/*radstat* $OUTDIR
cp ${RADSTAT_DATA_DIR}/*abias* $OUTDIR
touch $OUTDIR/gdas.t${hh}z.loginc.txt
elif [ "${MEMBER}" = "gfs" ]; then
touch $OUTDIR/gfs.t${hh}z.loginc.txt
else
touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt
fi
$UFS_DIR/util/gdas_init/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $INPUT_DATA_DIR

rm -fr $WORKDIR

Expand Down
15 changes: 1 addition & 14 deletions util/gdas_init/run_v15.chgres.gfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@ WORKDIR=${WORKDIR:-$OUTDIR/work.gfs}

CTAR=${CRES_HIRES}
INPUT_DATA_DIR="${EXTRACT_DIR}/gfs.${yy}${mm}${dd}/${hh}"
OUTDIR=$OUTDIR/gfs.${yy}${mm}${dd}/${hh}/atmos
ATMFILE="gfs.t${hh}z.atmanl.nemsio"
SFCFILE="gfs.t${hh}z.sfcanl.nemsio"

rm -fr $WORKDIR
mkdir -p $WORKDIR
cd $WORKDIR

rm -fr $OUTDIR
mkdir -p $OUTDIR
mkdir -p $OUTDIR/INPUT

cat << EOF > fort.41

&config
Expand Down Expand Up @@ -57,15 +52,7 @@ if [ $rc != 0 ]; then
exit $rc
fi

mv gfs_ctrl.nc ${OUTDIR}/INPUT

for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
do
mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc
mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc
done

touch $OUTDIR/gfs.t${hh}z.loginc.txt
$UFS_DIR/util/gdas_init/copy_coldstart_files.sh gfs $OUTDIR $yy $mm $dd $hh $INPUT_DATA_DIR

rm -fr $WORKDIR

Expand Down
21 changes: 1 addition & 20 deletions util/gdas_init/run_v15.chgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,17 @@ if [ ${MEMBER} == 'gdas' ]; then
CTAR=${CRES_HIRES}
INPUT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy_d}${mm_d}${dd_d}/${hh_d}/RESTART"
RADSTAT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}"
OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh}/atmos
else
CINP=${CINP:-"C384"}
CTAR=${CRES_ENKF}
INPUT_DATA_DIR="${EXTRACT_DIR}/enkfgdas.${yy_d}${mm_d}${dd_d}/${hh_d}/mem${MEMBER}/RESTART"
RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}"
OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}/atmos
fi

rm -fr $WORKDIR
mkdir -p $WORKDIR
cd $WORKDIR

rm -fr $OUTDIR
mkdir -p $OUTDIR
mkdir -p $OUTDIR/INPUT

cat << EOF > fort.41

&config
Expand Down Expand Up @@ -77,20 +71,7 @@ if [ $rc != 0 ]; then
exit $rc
fi

mv gfs_ctrl.nc ${OUTDIR}/INPUT

for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
do
mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc
mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc
done

if [ ${MEMBER} == 'gdas' ]; then
cp ${RADSTAT_DATA_DIR}/* $OUTDIR
touch $OUTDIR/gdas.t${hh}z.loginc.txt
else
touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt
fi
$UFS_DIR/util/gdas_init/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $RADSTAT_DATA_DIR

rm -fr $WORKDIR

Expand Down
27 changes: 1 addition & 26 deletions util/gdas_init/run_v16.chgres.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/bin/bash

copy_data()
{

mkdir -p $SAVEDIR
cp gfs_ctrl.nc $SAVEDIR

for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
do
cp out.atm.${tile}.nc ${SAVEDIR}/gfs_data.${tile}.nc
cp out.sfc.${tile}.nc ${SAVEDIR}/sfc_data.${tile}.nc
done
}

#---------------------------------------------------------------------------
# Run chgres using v16 netcdf history data as input. These history
# files are part of the OPS v16 gfs/gdas/enkf tarballs, and the
Expand Down Expand Up @@ -89,19 +76,7 @@ if [ $rc != 0 ]; then
exit $rc
fi

if [ ${MEMBER} == 'gdas' ] || [ ${MEMBER} == 'gfs' ]; then
SAVEDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}/atmos/INPUT
copy_data
touch $SAVEDIR/../${MEMBER}.t${hh}z.loginc.txt
if [ ${MEMBER} == 'gdas' ]; then
cp ${INPUT_DATA_DIR}/*abias* $SAVEDIR/..
cp ${INPUT_DATA_DIR}/*radstat $SAVEDIR/..
fi
else
SAVEDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}/atmos/INPUT
copy_data
touch $SAVEDIR/../enkfgdas.t${hh}z.loginc.txt
fi
$UFS_DIR/util/gdas_init/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $INPUT_DATA_DIR

rm -fr $WORKDIR

Expand Down
34 changes: 1 addition & 33 deletions util/gdas_init/run_v16retro.chgres.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/bin/bash

copy_data()
{

mkdir -p $SAVEDIR
cp gfs_ctrl.nc $SAVEDIR

for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6'
do
cp out.atm.${tile}.nc ${SAVEDIR}/gfs_data.${tile}.nc
cp out.sfc.${tile}.nc ${SAVEDIR}/sfc_data.${tile}.nc
done
}

#---------------------------------------------------------------------------
# Run chgres for gdas/enkf members using v16 parallel data as input.
# The enkf data is not saved. So the coldstart files for all
Expand Down Expand Up @@ -102,26 +89,7 @@ if [ $rc != 0 ]; then
exit $rc
fi

if [ ${MEMBER} == 'hires' ]; then
SAVEDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh}/atmos/INPUT
copy_data
cp $RADSTAT_DATA_DIR/*abias* $SAVEDIR/..
cp $RADSTAT_DATA_DIR/*radstat $SAVEDIR/..
touch $SAVEDIR/../gdas.t${hh}z.loginc.txt
else
MEMBER=1
while [ $MEMBER -le 80 ]; do
if [ $MEMBER -lt 10 ]; then
MEMBER_CH="00${MEMBER}"
else
MEMBER_CH="0${MEMBER}"
fi
SAVEDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER_CH}/atmos/INPUT
copy_data
touch $SAVEDIR/../enkfgdas.t${hh}z.loginc.txt
MEMBER=$(( $MEMBER + 1 ))
done
fi
$UFS_DIR/util/gdas_init/copy_coldstart_files.sh $MEMBER $OUTDIR $yy $mm $dd $hh $RADSTAT_DATA_DIR

rm -fr $WORKDIR

Expand Down