From ab7fc7b12e33e8dda33e1aa717aec10b57c3223d Mon Sep 17 00:00:00 2001 From: "kate.friedman" Date: Thu, 20 Oct 2022 19:47:56 +0000 Subject: [PATCH 1/7] Update gfs-utils ush script paths - Update scripts that use gfs-utils ush scripts to point to new path under /ush folder (used to be /util/ush). Refs #1059 --- gempak/ush/gempak_gfs_f00_gif.sh | 2 +- parm/config/config.gldas | 2 +- scripts/exgfs_atmos_fbwind.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gempak/ush/gempak_gfs_f00_gif.sh b/gempak/ush/gempak_gfs_f00_gif.sh index 172cb687a2..2a7cca5c9f 100755 --- a/gempak/ush/gempak_gfs_f00_gif.sh +++ b/gempak/ush/gempak_gfs_f00_gif.sh @@ -593,7 +593,7 @@ if [ $SENDCOM = YES ]; then export input=${COMOUT}/${hgttmp500dev} export HEADER=YES export OUTPATH=$DATA/gfs_500_hgt_tmp_nh_anl_${cyc}.tif - ${UTILgfs}/ush/make_tif.sh + ${USHgfs}/make_tif.sh fi msg=" GEMPAK_GIF ${fhr} hour completed normally" diff --git a/parm/config/config.gldas b/parm/config/config.gldas index 8d503d0368..c51829d9fc 100755 --- a/parm/config/config.gldas +++ b/parm/config/config.gldas @@ -11,6 +11,6 @@ echo "BEGIN: config.gldas" export GLDASSH=$HOMEgfs/scripts/exgdas_atmos_gldas.sh export gldas_spinup_hours=72 export CPCGAUGE=$DMPDIR -export FINDDATE=$HOMEgfs/util/ush/finddate.sh +export FINDDATE=$USHgfs/finddate.sh echo "END: config.gldas" diff --git a/scripts/exgfs_atmos_fbwind.sh b/scripts/exgfs_atmos_fbwind.sh index ee15e6c634..e7d0ff3d82 100755 --- a/scripts/exgfs_atmos_fbwind.sh +++ b/scripts/exgfs_atmos_fbwind.sh @@ -79,7 +79,7 @@ fi if test "$SENDDBN" = 'YES' then # make_ntc_bull.pl WMOBH NONE KWNO NONE tran.fbwnd_pacific ${COMOUTwmo}/tran.fbwnd_pacific.$job_name - ${UTILgfs}/ush/make_ntc_bull.pl WMOBH NONE KWNO NONE tran.fbwnd_pacific ${COMOUTwmo}/tran.fbwnd_pacific.$job_name + ${USHgfs}/make_ntc_bull.pl WMOBH NONE KWNO NONE tran.fbwnd_pacific ${COMOUTwmo}/tran.fbwnd_pacific.$job_name fi ##################################################################### From 680c02944b2d83ab5dc021e2b0a92a80e3c2aebb Mon Sep 17 00:00:00 2001 From: "kate.friedman" Date: Thu, 20 Oct 2022 19:49:48 +0000 Subject: [PATCH 2/7] Update build_gfs_utils.sh for new repo home Refs #1059 --- sorc/build_gfs_utils.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sorc/build_gfs_utils.sh b/sorc/build_gfs_utils.sh index 9bceedb733..06e70c01ed 100755 --- a/sorc/build_gfs_utils.sh +++ b/sorc/build_gfs_utils.sh @@ -1,10 +1,9 @@ #! /usr/bin/env bash set -eux -function _usage() { +function usage() { cat << EOF -Builds all of the global-workflow components by calling the individual build - scripts in sequence. +Builds the GFS utility programs. Usage: ${BASH_SOURCE[0]} [-d][-h][-v] -d: @@ -24,6 +23,9 @@ while getopts ":dv" option; do case "${option}" in d) export BUILD_TYPE="DEBUG";; v) export BUILD_VERBOSE="YES";; + h) + usage + ;; :) echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" usage @@ -31,11 +33,13 @@ while getopts ":dv" option; do *) echo "[${BASH_SOURCE[0]}]: Unrecognized option: ${option}" usage - ;; + ;; esac done shift $((OPTIND-1)) -"${cwd}/gfs_utils.fd/sorc/build_gfs_utils.sh" +BUILD_TYPE=${BUILD_TYPE:-"Release"} \ +BUILD_VERBOSE=${BUILD_VERBOSE:-"NO"} \ +${cwd}/gfs_utils.fd/ush/build.sh -exit \ No newline at end of file +exit From 45732567cbb0d821d37905e90842c072ad5a39c1 Mon Sep 17 00:00:00 2001 From: "kate.friedman" Date: Thu, 20 Oct 2022 19:50:28 +0000 Subject: [PATCH 3/7] Update link_workflow.sh for new gfs-utils repo - Update machine detection. - Update gfs-utils exec symlink location. - Add gfs-utils ush scripts as symlinks. Refs #1059 --- sorc/link_workflow.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 15c09168d9..79dda2f63e 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -47,9 +47,9 @@ top_dir=$(cd "$(dirname "${script_dir}")" &> /dev/null && pwd) cd ${script_dir} # shellcheck disable=SC1091 -source gfs_utils.fd/ush/machine-setup.sh > /dev/null 2>&1 +source gfs_utils.fd/ush/detect_machine.sh # (sets MACHINE_ID) # shellcheck disable= -machine="${target:?}" +machine=$(echo $MACHINE_ID | cut -d. -f1) #------------------------------ #--model fix fields @@ -139,6 +139,9 @@ cd "${top_dir}/ush" || exit 8 emcsfc_snow.sh fv3gfs_filter_topo.sh global_cycle.sh fv3gfs_make_grid.sh ; do ${LINK} "${script_dir}/ufs_utils.fd/ush/${file}" . done + for file in finddate.sh make_ntc_bull.pl make_NTC_file.pl make_tif.sh month_name.sh ; do + ${LINK} "${script_dir}/gfs_utils.fd/ush/${file}" . + done #----------------------------------- #--add gfs_wafs link if checked out @@ -227,7 +230,7 @@ for utilexe in fbwndgfs.x gaussian_sfcanl.x gfs_bufr.x regrid_nemsio.x supvit.x syndat_maksynrc.x syndat_qctropcy.x tocsbufr.x enkf_chgres_recenter.x \ enkf_chgres_recenter_nc.x fv3nc2nemsio.x tave.x vint.x reg2grb2.x ; do [[ -s "${utilexe}" ]] && rm -f "${utilexe}" - ${LINK} "${script_dir}/gfs_utils.fd/sorc/install/bin/${utilexe}" . + ${LINK} "${script_dir}/gfs_utils.fd/install/bin/${utilexe}" . done [[ -s "ufs_model.x" ]] && rm -f ufs_model.x From 29ae2196b5c72873c973a5f9f0aac0d5fbf5f8db Mon Sep 17 00:00:00 2001 From: "kate.friedman" Date: Thu, 20 Oct 2022 20:04:24 +0000 Subject: [PATCH 4/7] Add h to getopts in build_gfs_utils.sh Refs #1059 --- sorc/build_gfs_utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_gfs_utils.sh b/sorc/build_gfs_utils.sh index 06e70c01ed..432e733d29 100755 --- a/sorc/build_gfs_utils.sh +++ b/sorc/build_gfs_utils.sh @@ -19,7 +19,7 @@ EOF cwd=$(pwd) OPTIND=1 -while getopts ":dv" option; do +while getopts ":dvh" option; do case "${option}" in d) export BUILD_TYPE="DEBUG";; v) export BUILD_VERBOSE="YES";; From 3467e864bb31f5da55d4b550315dd4989887a083 Mon Sep 17 00:00:00 2001 From: "kate.friedman" Date: Thu, 20 Oct 2022 20:18:42 +0000 Subject: [PATCH 5/7] Update gfs-utils hash to af933d3 Refs #1059 --- Externals.cfg | 2 +- sorc/checkout.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 3bc53ffe64..1bd2d4400d 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -8,7 +8,7 @@ protocol = git required = True [gfs-utils] -hash = 7bf599f +hash = af933d3 local_path = sorc/gfs_utils.fd repo_url = https://github.com/NOAA-EMC/gfs-utils protocol = git diff --git a/sorc/checkout.sh b/sorc/checkout.sh index d6326e5da9..b53d43496e 100755 --- a/sorc/checkout.sh +++ b/sorc/checkout.sh @@ -151,7 +151,7 @@ mkdir -p "${logdir}" # The checkout version should always be a speciifc commit (hash or tag), not a branch errs=0 -checkout "gfs_utils.fd" "https://github.com/NOAA-EMC/gfs-utils" "7bf599f" ; errs=$((errs + $?)) +checkout "gfs_utils.fd" "https://github.com/NOAA-EMC/gfs-utils" "af933d3" ; errs=$((errs + $?)) checkout "ufs_model.fd" "https://github.com/ufs-community/ufs-weather-model" "${ufs_model_hash:-3c3548d}" ; errs=$((errs + $?)) checkout "ufs_utils.fd" "https://github.com/ufs-community/UFS_UTILS.git" "8b990c0" ; errs=$((errs + $?)) checkout "verif-global.fd" "https://github.com/NOAA-EMC/EMC_verif-global.git" "c267780" ; errs=$((errs + $?)) From f272e643ad5c2fa4c105732de7ce74a259dde41a Mon Sep 17 00:00:00 2001 From: "Kate.Friedman" Date: Thu, 20 Oct 2022 20:25:30 +0000 Subject: [PATCH 6/7] Address SC2086 and SC2250 linter warnings Refs #1059 --- sorc/build_gfs_utils.sh | 2 +- sorc/link_workflow.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sorc/build_gfs_utils.sh b/sorc/build_gfs_utils.sh index 432e733d29..f160caa0aa 100755 --- a/sorc/build_gfs_utils.sh +++ b/sorc/build_gfs_utils.sh @@ -40,6 +40,6 @@ shift $((OPTIND-1)) BUILD_TYPE=${BUILD_TYPE:-"Release"} \ BUILD_VERBOSE=${BUILD_VERBOSE:-"NO"} \ -${cwd}/gfs_utils.fd/ush/build.sh +"${cwd}"/gfs_utils.fd/ush/build.sh exit diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 79dda2f63e..6aef3fb934 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -44,12 +44,12 @@ shift $((OPTIND-1)) script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) top_dir=$(cd "$(dirname "${script_dir}")" &> /dev/null && pwd) -cd ${script_dir} +cd "${script_dir}" # shellcheck disable=SC1091 source gfs_utils.fd/ush/detect_machine.sh # (sets MACHINE_ID) # shellcheck disable= -machine=$(echo $MACHINE_ID | cut -d. -f1) +machine=$(echo "${MACHINE_ID}" | cut -d. -f1) #------------------------------ #--model fix fields @@ -133,7 +133,7 @@ cd "${top_dir}/parm/post" || exit 1 done cd "${top_dir}/scripts" || exit 8 - $LINK "${script_dir}/ufs_utils.fd/scripts/exemcsfc_global_sfc_prep.sh" . + ${LINK} "${script_dir}/ufs_utils.fd/scripts/exemcsfc_global_sfc_prep.sh" . cd "${top_dir}/ush" || exit 8 for file in emcsfc_ice_blend.sh fv3gfs_driver_grid.sh fv3gfs_make_orog.sh global_cycle_driver.sh \ emcsfc_snow.sh fv3gfs_filter_topo.sh global_cycle.sh fv3gfs_make_grid.sh ; do @@ -244,7 +244,7 @@ if [ -d "${script_dir}/gfs_wafs.fd" ]; then wafs_awc_wafavn.x wafs_blending.x wafs_blending_0p25.x \ wafs_cnvgrib2.x wafs_gcip.x wafs_grib2_0p25.x \ wafs_makewafs.x wafs_setmissing.x; do - [[ -s $wafsexe ]] && rm -f $wafsexe + [[ -s ${wafsexe} ]] && rm -f ${wafsexe} ${LINK} "${script_dir}/gfs_wafs.fd/exec/${wafsexe}" . done fi From ee871e974bd00b539497f5e3059e02c3c63855c4 Mon Sep 17 00:00:00 2001 From: "kate.friedman" Date: Fri, 21 Oct 2022 14:02:33 +0000 Subject: [PATCH 7/7] Slight quote change to build command in build_gfs_utils.sh Refs #1059 --- sorc/build_gfs_utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_gfs_utils.sh b/sorc/build_gfs_utils.sh index f160caa0aa..2a7a611239 100755 --- a/sorc/build_gfs_utils.sh +++ b/sorc/build_gfs_utils.sh @@ -40,6 +40,6 @@ shift $((OPTIND-1)) BUILD_TYPE=${BUILD_TYPE:-"Release"} \ BUILD_VERBOSE=${BUILD_VERBOSE:-"NO"} \ -"${cwd}"/gfs_utils.fd/ush/build.sh +"${cwd}/gfs_utils.fd/ush/build.sh" exit