Skip to content

Commit

Permalink
Correct GDASApp paths (#2435)
Browse files Browse the repository at this point in the history
The changes in this PR 
- account for changes in GDASApp directory structure
- generalize how the path to the GDASApp python ioda library is
specified

Resolves #2434
  • Loading branch information
RussTreadon-NOAA authored Mar 27, 2024
1 parent f0b912b commit bc1c46d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
3 changes: 2 additions & 1 deletion jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_PREP
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \

# Add UFSDA to PYTHONPATH
ufsdaPATH="${HOMEgfs}/sorc/gdas.cd/ush/"
pyiodaPATH="${HOMEgfs}/sorc/gdas.cd/build/lib/python3.7/"
# shellcheck disable=SC2311
pyiodaPATH="${HOMEgfs}/sorc/gdas.cd/build/lib/python$(detect_py_ver)/"
PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${ufsdaPATH}:${pyiodaPATH}"
export PYTHONPATH

Expand Down
5 changes: 3 additions & 2 deletions jobs/rocoto/prepatmiodaobs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export jobid="${job}.$$"
###############################################################
# setup python path for workflow and ioda utilities
wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src"
PYIODALIB="${HOMEgfs}/sorc/gdas.cd/build/lib/python3.7"
PYTHONPATH="${PYIODALIB}:${wxflowPATH}:${PYTHONPATH}"
# shellcheck disable=SC2311
pyiodaPATH="${HOMEgfs}/sorc/gdas.cd/build/lib/python$(detect_py_ver)/"
PYTHONPATH="${pyiodaPATH}:${wxflowPATH}:${PYTHONPATH}"
export PYTHONPATH

###############################################################
Expand Down
4 changes: 3 additions & 1 deletion jobs/rocoto/prepsnowobs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export jobid="${job}.$$"
###############################################################
# setup python path for workflow utilities and tasks
wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src"
gdasappPATH="${HOMEgfs}/sorc/gdas.cd/iodaconv/src:${HOMEgfs}/sorc/gdas.cd/build/lib/python3.7"
# shellcheck disable=SC2311
pyiodaPATH="${HOMEgfs}/sorc/gdas.cd/build/lib/python$(detect_py_ver)/"
gdasappPATH="${HOMEgfs}/sorc/gdas.cd/sorc/iodaconv/src:${pyiodaPATH}"
PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}:${gdasappPATH}"
export PYTHONPATH

Expand Down
16 changes: 16 additions & 0 deletions ush/preamble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,22 @@ function generate_com() {
# shellcheck disable=
declare -xf generate_com

function detect_py_ver() {
#
# Returns the major.minor version of the currently active python executable
#
regex="[0-9]+\.[0-9]+"
# shellcheck disable=SC2312
if [[ $(python --version) =~ ${regex} ]]; then
echo "${BASH_REMATCH[0]}"
else
echo "FATAL ERROR: Could not detect the python version"
exit 1
fi
}
# shellcheck disable=
declare -xf detect_py

# Turn on our settings
set_strict
set_trace

0 comments on commit bc1c46d

Please sign in to comment.