Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions sorc/checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Clones and checks out external components necessary for
cloning and just check out the requested version (unless
-c option is used).

Usage: $BASH_SOURCE [-c][-h][-m ufs_hash][-o]
Usage: ${BASH_SOURCE[0]} [-c][-h][-m ufs_hash][-o]
-c:
Create a fresh clone (delete existing directories)
-h:
Expand Down Expand Up @@ -51,7 +51,7 @@ function checkout() {
remote="$2"
version="$3"

name=$(echo ${dir} | cut -d '.' -f 1)
name=$(echo "${dir}" | cut -d '.' -f 1)
echo "Performing checkout of ${name}"

logfile="${logdir:-$(pwd)}/checkout_${name}.log"
Expand All @@ -60,8 +60,8 @@ function checkout() {
rm "${logfile}"
fi

cd "${topdir}"
if [[ -d "${dir}" && $CLEAN == "YES" ]]; then
cd "${topdir}" || exit 1
if [[ -d "${dir}" && ${CLEAN} == "YES" ]]; then
echo "|-- Removing existing clone in ${dir}"
rm -Rf "${dir}"
fi
Expand All @@ -74,10 +74,10 @@ function checkout() {
echo
return "${status}"
fi
cd "${dir}"
cd "${dir}" || exit 1
else
# Fetch any updates from server
cd "${dir}"
cd "${dir}" || exit 1
echo "|-- Fetching updates from ${remote}"
git fetch
fi
Expand Down Expand Up @@ -131,7 +131,7 @@ while getopts ":chgum:o" option; do
;;
m)
echo "Received -m flag with argument, will check out ufs-weather-model hash ${OPTARG} instead of default"
ufs_model_hash=$OPTARG
ufs_model_hash=${OPTARG}
;;
:)
echo "option -${OPTARG} needs an argument"
Expand All @@ -145,7 +145,8 @@ while getopts ":chgum:o" option; do
done
shift $((OPTIND-1))

export topdir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
topdir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
export topdir
export logdir="${topdir}/logs"
mkdir -p "${logdir}"

Expand Down Expand Up @@ -183,7 +184,7 @@ if [[ ${checkout_gtg} == "YES" ]]; then
################################################################################

echo "Checking out GTG extension for UPP"
cd "${topdir}/ufs_model.fd/FV3/upp"
cd "${topdir}/ufs_model.fd/FV3/upp" || exit 1
logfile="${logdir}/checkout_gtg.log"
git -c submodule."post_gtg.fd".update=checkout submodule update --init --recursive >> "${logfile}" 2>&1
status=$?
Expand All @@ -197,4 +198,4 @@ if (( errs > 0 )); then
echo "WARNING: One or more errors encountered during checkout process, please check logs before building"
fi
echo
exit $errs
exit "${errs}"
52 changes: 26 additions & 26 deletions sorc/link_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
top_dir=$(cd "$(dirname "${script_dir}")" &> /dev/null && pwd)
cd "${script_dir}"

COMPILER="intel"
export COMPILER="intel"
# shellcheck disable=SC1091
source gfs_utils.fd/ush/detect_machine.sh # (sets MACHINE_ID)
# shellcheck disable=
Expand Down Expand Up @@ -80,8 +80,8 @@ fi
[[ -d upp.fd ]] && rm -rf upp.fd
${LINK} ufs_model.fd/FV3/upp upp.fd

if [ ! -z "${FIX_DIR}" ]; then
if [ ! -d "${top_dir}/fix" ]; then mkdir "${top_dir}/fix" || exit 1; fi
if [[ -n "${FIX_DIR}" ]]; then
if [[ ! -d "${top_dir}/fix" ]]; then mkdir "${top_dir}/fix" || exit 1; fi
fi
cd "${top_dir}/fix" || exit 1
for dir in aer \
Expand All @@ -100,15 +100,15 @@ for dir in aer \
verif \
wave
do
if [ -d "${dir}" ]; then
if [[ -d "${dir}" ]]; then
[[ "${RUN_ENVIR}" == "nco" ]] && chmod -R 755 "${dir}"
rm -rf "${dir}"
fi
fix_ver="${dir}_ver"
${LINK} "${FIX_DIR}/${dir}/${!fix_ver}" "${dir}"
done

if [ -d "${script_dir}/ufs_utils.fd" ]; then
if [[ -d "${script_dir}/ufs_utils.fd" ]]; then
cd "${script_dir}/ufs_utils.fd/fix" || exit 1
./link_fixdirs.sh "${RUN_ENVIR}" "${machine}" 2> /dev/null
fi
Expand All @@ -118,7 +118,7 @@ fi
#--add files from external repositories
#---------------------------------------
cd "${top_dir}/parm" || exit 1
if [ -d "${script_dir}/gldas.fd" ]; then
if [[ -d "${script_dir}/gldas.fd" ]]; then
[[ -d gldas ]] && rm -rf gldas
${LINK} "${script_dir}/gldas.fd/parm" gldas
fi
Expand Down Expand Up @@ -146,7 +146,7 @@ cd "${top_dir}/ush" || exit 8

#-----------------------------------
#--add gfs_wafs link if checked out
if [ -d "${script_dir}/gfs_wafs.fd" ]; then
if [[ -d "${script_dir}/gfs_wafs.fd" ]]; then
#-----------------------------------
cd "${top_dir}/jobs" || exit 1
${LINK} "${script_dir}/gfs_wafs.fd/jobs"/* .
Expand All @@ -166,7 +166,7 @@ fi
#------------------------------
#--add GSI fix directory
#------------------------------
if [ -d "${script_dir}/gsi_enkf.fd" ]; then
if [[ -d "${script_dir}/gsi_enkf.fd" ]]; then
cd "${top_dir}/fix" || exit 1
[[ -d gsi ]] && rm -rf gsi
${LINK} "${script_dir}/gsi_enkf.fd/fix" gsi
Expand All @@ -175,12 +175,12 @@ fi
#------------------------------
#--add GDASApp fix directory
#------------------------------
if [ -d "${script_dir}/gdas.cd" ]; then
if [[ -d "${script_dir}/gdas.cd" ]]; then
cd "${top_dir}/fix" || exit 1
[[ ! -d gdas ]] && mkdir -p gdas
cd gdas || exit 1
for gdas_sub in bump crtm fv3jedi gsibec; do
if [ -d "${gdas_sub}" ]; then
if [[ -d "${gdas_sub}" ]]; then
rm -rf "${gdas_sub}"
fi
fix_ver="gdas_${gdas_sub}_ver"
Expand All @@ -191,16 +191,16 @@ fi
#------------------------------
#--add GDASApp files
#------------------------------
if [ -d "${script_dir}/gdas.cd" ]; then
cd "${top_dir}/ush"
if [[ -d "${script_dir}/gdas.cd" ]]; then
cd "${top_dir}/ush" || exit 1
${LINK} "${script_dir}/gdas.cd/ush/ufsda" .
fi


#------------------------------
#--add DA Monitor file (NOTE: ensure to use correct version)
#------------------------------
if [ -d "${script_dir}/gsi_monitor.fd" ]; then
if [[ -d "${script_dir}/gsi_monitor.fd" ]]; then

cd "${top_dir}/fix" || exit 1
[[ ! -d gdas ]] && ( mkdir -p gdas || exit 1 )
Expand All @@ -227,7 +227,7 @@ fi
#--link executables
#------------------------------

if [ ! -d "${top_dir}/exec" ]; then mkdir "${top_dir}/exec" || exit 1 ; fi
if [[ ! -d "${top_dir}/exec" ]]; then mkdir "${top_dir}/exec" || exit 1 ; fi
cd "${top_dir}/exec" || exit 1

for utilexe in fbwndgfs.x gaussian_sfcanl.x gfs_bufr.x regrid_nemsio.x supvit.x syndat_getjtbul.x \
Expand All @@ -243,7 +243,7 @@ ${LINK} "${script_dir}/ufs_model.fd/tests/ufs_model.x" .
[[ -s "upp.x" ]] && rm -f upp.x
${LINK} "${script_dir}/upp.fd/exec/upp.x" .

if [ -d "${script_dir}/gfs_wafs.fd" ]; then
if [[ -d "${script_dir}/gfs_wafs.fd" ]]; then
for wafsexe in \
wafs_awc_wafavn.x wafs_blending.x wafs_blending_0p25.x \
wafs_cnvgrib2.x wafs_gcip.x wafs_grib2_0p25.x \
Expand All @@ -260,15 +260,15 @@ for ufs_utilsexe in \
done

# GSI
if [ -d "${script_dir}/gsi_enkf.fd" ]; then
if [[ -d "${script_dir}/gsi_enkf.fd" ]]; then
for gsiexe in enkf.x gsi.x; do
[[ -s "${gsiexe}" ]] && rm -f "${gsiexe}"
${LINK} "${script_dir}/gsi_enkf.fd/install/bin/${gsiexe}" .
done
fi

# GSI Utils
if [ -d "${script_dir}/gsi_utils.fd" ]; then
if [[ -d "${script_dir}/gsi_utils.fd" ]]; then
for exe in calc_analysis.x calc_increment_ens_ncio.x calc_increment_ens.x \
getsfcensmeanp.x getsigensmeanp_smooth.x getsigensstatp.x \
interp_inc.x recentersigp.x;do
Expand All @@ -278,23 +278,23 @@ if [ -d "${script_dir}/gsi_utils.fd" ]; then
fi

# GSI Monitor
if [ -d "${script_dir}/gsi_monitor.fd" ]; then
if [[ -d "${script_dir}/gsi_monitor.fd" ]]; then
for exe in oznmon_horiz.x oznmon_time.x radmon_angle.x \
radmon_bcoef.x radmon_bcor.x radmon_time.x; do
[[ -s "${exe}" ]] && rm -f "${exe}"
${LINK} "${script_dir}/gsi_monitor.fd/install/bin/${exe}" .
done
fi

if [ -d "${script_dir}/gldas.fd" ]; then
if [[ -d "${script_dir}/gldas.fd" ]]; then
for gldasexe in gdas2gldas gldas2gdas gldas_forcing gldas_model gldas_post gldas_rst; do
[[ -s "${gldasexe}" ]] && rm -f "${gldasexe}"
${LINK} "${script_dir}/gldas.fd/exec/${gldasexe}" .
done
fi

# GDASApp
if [ -d "${script_dir}/gdas.cd" ]; then
if [[ -d "${script_dir}/gdas.cd" ]]; then
for gdasexe in fv3jedi_addincrement.x fv3jedi_diffstates.x fv3jedi_ensvariance.x fv3jedi_hofx.x \
fv3jedi_var.x fv3jedi_convertincrement.x fv3jedi_dirac.x fv3jedi_error_covariance_training.x \
fv3jedi_letkf.x fv3jedi_convertstate.x fv3jedi_eda.x fv3jedi_forecast.x fv3jedi_plot_field.x \
Expand All @@ -307,17 +307,17 @@ fi
#------------------------------
#--link source code directories
#------------------------------
cd "${script_dir}" || exit 8
cd "${script_dir}" || exit 8

if [ -d gsi_enkf.fd ]; then
if [[ -d gsi_enkf.fd ]]; then
[[ -d gsi.fd ]] && rm -rf gsi.fd
${SLINK} gsi_enkf.fd/src/gsi gsi.fd

[[ -d enkf.fd ]] && rm -rf enkf.fd
${SLINK} gsi_enkf.fd/src/enkf enkf.fd
fi

if [ -d gsi_utils.fd ]; then
if [[ -d gsi_utils.fd ]]; then
[[ -d calc_analysis.fd ]] && rm -rf calc_analysis.fd
${SLINK} gsi_utils.fd/src/netcdf_io/calc_analysis.fd calc_analysis.fd

Expand All @@ -343,7 +343,7 @@ cd "${script_dir}" || exit 8
${SLINK} gsi_utils.fd/src/netcdf_io/interp_inc.fd interp_inc.fd
fi

if [ -d gsi_monitor.fd ] ; then
if [[ -d gsi_monitor.fd ]] ; then
[[ -d oznmon_horiz.fd ]] && rm -rf oznmon_horiz.fd
${SLINK} gsi_monitor.fd/src/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd oznmon_horiz.fd

Expand Down Expand Up @@ -401,7 +401,7 @@ cd "${script_dir}" || exit 8
${LINK} "gfs_utils.fd/src/${prog}" .
done

if [ -d "${script_dir}/gfs_wafs.fd" ]; then
if [[ -d "${script_dir}/gfs_wafs.fd" ]]; then
${SLINK} gfs_wafs.fd/sorc/wafs_awc_wafavn.fd wafs_awc_wafavn.fd
${SLINK} gfs_wafs.fd/sorc/wafs_blending.fd wafs_blending.fd
${SLINK} gfs_wafs.fd/sorc/wafs_blending_0p25.fd wafs_blending_0p25.fd
Expand All @@ -412,7 +412,7 @@ cd "${script_dir}" || exit 8
${SLINK} gfs_wafs.fd/sorc/wafs_setmissing.fd wafs_setmissing.fd
fi

if [ -d gldas.fd ]; then
if [[ -d gldas.fd ]]; then
for prog in gdas2gldas.fd gldas2gdas.fd gldas_forcing.fd gldas_model.fd gldas_post.fd gldas_rst.fd ;do
[[ -d "${prog}" ]] && rm -rf "${prog}"
${SLINK} "gldas.fd/sorc/${prog}" "${prog}"
Expand Down
6 changes: 3 additions & 3 deletions sorc/ncl.setup
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

set +x
case $target in
case ${target} in
'jet'|'hera')
module load ncl/6.5.0
export NCARG_LIB=$NCARG_ROOT/lib
export NCARG_LIB=${NCARG_ROOT}/lib
;;
*)
echo "[${BASH_SOURCE}]: unknown $target"
echo "[${BASH_SOURCE[0]}]: unknown ${target}"
;;
esac
Loading