Skip to content

Commit

Permalink
Place copy of coldstart files in a common script.
Browse files Browse the repository at this point in the history
Fixes #772.
  • Loading branch information
GeorgeGayno-NOAA committed Feb 10, 2023
1 parent d98902f commit a886e6a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 76 deletions.
49 changes: 49 additions & 0 deletions util/gdas_init/copy_coldstart_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/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

echo 'in new script'
echo $MEMBER $OUTDIR

if [ ${MEMBER} == 'gdas' ] || [ ${MEMBER} == 'gfs' ]; then
SUBDIR=$OUTDIR/${MEMBER}.${yy}${mm}${dd}/${hh}
rm -fr $SUBDIR
SAVEDIR=$SUBDIR/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
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
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

0 comments on commit a886e6a

Please sign in to comment.