Skip to content

Commit

Permalink
Single Executable for main GDAS JEDI applications (NOAA-EMC#2565)
Browse files Browse the repository at this point in the history
Changes that accompany GDAS PR (NOAA-EMC/GDASApp/pull/1075) that allows
building of a single gdas executable, which should be more compliant
with NCO requirements.

Addresses NOAA-EMC/GDASApp#1085
  • Loading branch information
danholdaway committed May 6, 2024
1 parent a005244 commit 233c188
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 77 deletions.
2 changes: 1 addition & 1 deletion parm/config/gfs/config.aeroanl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export JEDI_FIX_YAML="${PARMgfs}/gdas/aero_jedi_fix.yaml.j2"
export io_layout_x=@IO_LAYOUT_X@
export io_layout_y=@IO_LAYOUT_Y@

export JEDIEXE="${EXECgfs}/fv3jedi_var.x"
export JEDIEXE="${EXECgfs}/gdas.x"

if [[ "${DOIAU}" == "YES" ]]; then
export aero_bkg_times="3,6,9"
Expand Down
2 changes: 1 addition & 1 deletion parm/config/gfs/config.atmanl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export layout_y_atmanl=@LAYOUT_Y_ATMANL@
export io_layout_x=@IO_LAYOUT_X@
export io_layout_y=@IO_LAYOUT_Y@

export JEDIEXE=${EXECgfs}/fv3jedi_var.x
export JEDIEXE=${EXECgfs}/gdas.x

echo "END: config.atmanl"
2 changes: 1 addition & 1 deletion parm/config/gfs/config.atmensanl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export layout_y_atmensanl=@LAYOUT_Y_ATMENSANL@
export io_layout_x=@IO_LAYOUT_X@
export io_layout_y=@IO_LAYOUT_Y@

export JEDIEXE=${EXECgfs}/fv3jedi_letkf.x
export JEDIEXE=${EXECgfs}/gdas.x

echo "END: config.atmensanl"
2 changes: 1 addition & 1 deletion parm/config/gfs/config.snowanl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source "${EXPDIR}/config.resources" snowanl
export OBS_LIST="${PARMgfs}/gdas/snow/obs/lists/gdas_snow.yaml.j2"

# Name of the JEDI executable and its yaml template
export JEDIEXE="${EXECgfs}/fv3jedi_letkf.x"
export JEDIEXE="${EXECgfs}/gdas.x"
export JEDIYAML="${PARMgfs}/gdas/snow/letkfoi/letkfoi.yaml.j2"

# Ensemble member properties
Expand Down
25 changes: 4 additions & 21 deletions sorc/link_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -333,33 +333,16 @@ fi

# GDASApp
if [[ -d "${HOMEgfs}/sorc/gdas.cd/build" ]]; then
declare -a JEDI_EXE=("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" \
declare -a JEDI_EXE=("gdas.x" \
"gdas_soca_gridgen.x" \
"gdas_soca_error_covariance_toolbox.x" \
"gdas_soca_setcorscales.x" \
"fv3jedi_plot_field.x" \
"fv3jedi_data_checker.py" \
"fv3jedi_enshofx.x" \
"fv3jedi_hofx_nomodel.x" \
"fv3jedi_testdata_downloader.py" \
"fv3jedi_fv3inc.x" \
"gdas_ens_handler.x" \
"gdas_incr_handler.x" \
"gdas_obsprovider2ioda.x" \
"gdas_socahybridweights.x" \
"soca_convertincrement.x" \
"soca_error_covariance_training.x" \
"soca_setcorscales.x" \
"soca_gridgen.x" \
"soca_var.x" \
"bufr2ioda.x" \
"calcfIMS.exe" \
"apply_incr.exe" )
Expand Down
4 changes: 3 additions & 1 deletion ush/python/pygfs/task/aero_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ def execute(self: Analysis) -> None:
chdir(self.task_config.DATA)

exec_cmd = Executable(self.task_config.APRUN_AEROANL)
exec_name = os.path.join(self.task_config.DATA, 'fv3jedi_var.x')
exec_name = os.path.join(self.task_config.DATA, 'gdas.x')
exec_cmd.add_default_arg(exec_name)
exec_cmd.add_default_arg('fv3jedi')
exec_cmd.add_default_arg('variational')
exec_cmd.add_default_arg(self.task_config.jedi_yaml)

try:
Expand Down
40 changes: 0 additions & 40 deletions ush/python/pygfs/task/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,46 +292,6 @@ def get_fv3ens_dict(config: Dict[str, Any]) -> Dict[str, Any]:
}
return ens_dict

@staticmethod
@logit(logger)
def execute_jediexe(workdir: Union[str, os.PathLike], aprun_cmd: str, jedi_exec: str, jedi_yaml: str) -> None:
"""
Run a JEDI executable
Parameters
----------
workdir : str | os.PathLike
Working directory where to run containing the necessary files and executable
aprun_cmd : str
Launcher command e.g. mpirun -np <ntasks> or srun, etc.
jedi_exec : str
Name of the JEDI executable e.g. fv3jedi_var.x
jedi_yaml : str | os.PathLike
Name of the yaml file to feed the JEDI executable e.g. fv3jedi_var.yaml
Raises
------
OSError
Failure due to OS issues
WorkflowException
All other exceptions
"""

os.chdir(workdir)

exec_cmd = Executable(aprun_cmd)
exec_cmd.add_default_arg([os.path.join(workdir, jedi_exec), jedi_yaml])

logger.info(f"Executing {exec_cmd}")
try:
exec_cmd()
except OSError:
logger.exception(f"FATAL ERROR: Failed to execute {exec_cmd}")
raise OSError(f"{exec_cmd}")
except Exception:
logger.exception(f"FATAL ERROR: Error occured during execution of {exec_cmd}")
raise WorkflowException(f"{exec_cmd}")

@staticmethod
@logit(logger)
def tgz_diags(statfile: str, diagdir: str) -> None:
Expand Down
19 changes: 14 additions & 5 deletions ush/python/pygfs/task/atm_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ def variational(self: Analysis) -> None:
chdir(self.task_config.DATA)

exec_cmd = Executable(self.task_config.APRUN_ATMANLVAR)
exec_name = os.path.join(self.task_config.DATA, 'fv3jedi_var.x')
exec_name = os.path.join(self.task_config.DATA, 'gdas.x')
exec_cmd.add_default_arg(exec_name)
exec_cmd.add_default_arg('fv3jedi')
exec_cmd.add_default_arg('variational')
exec_cmd.add_default_arg(self.task_config.jedi_yaml)

try:
Expand All @@ -144,10 +146,17 @@ def init_fv3_increment(self: Analysis) -> None:
@logit(logger)
def fv3_increment(self: Analysis) -> None:
# Run executable
self.execute_jediexe(self.runtime_config.DATA,
self.task_config.APRUN_ATMANLFV3INC,
self.task_config.jedi_exe,
self.task_config.jedi_yaml)
exec_cmd = Executable(self.task_config.APRUN_ATMANLFV3INC)
exec_cmd.add_default_arg(self.task_config.jedi_exe)
exec_cmd.add_default_arg(self.task_config.jedi_yaml)

try:
logger.debug(f"Executing {exec_cmd}")
exec_cmd()
except OSError:
raise OSError(f"Failed to execute {exec_cmd}")
except Exception:
raise WorkflowException(f"An error occured during execution of {exec_cmd}")

@logit(logger)
def finalize(self: Analysis) -> None:
Expand Down
4 changes: 3 additions & 1 deletion ush/python/pygfs/task/atmens_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ def execute(self: Analysis) -> None:
chdir(self.task_config.DATA)

exec_cmd = Executable(self.task_config.APRUN_ATMENSANL)
exec_name = os.path.join(self.task_config.DATA, 'fv3jedi_letkf.x')
exec_name = os.path.join(self.task_config.DATA, 'gdas.x')
exec_cmd.add_default_arg(exec_name)
exec_cmd.add_default_arg('fv3jedi')
exec_cmd.add_default_arg('localensembleda')
exec_cmd.add_default_arg(self.task_config.jedi_yaml)

try:
Expand Down
18 changes: 14 additions & 4 deletions ush/python/pygfs/task/snow_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,20 @@ def execute(self) -> None:
AttrDict({key: localconf[key] for key in ['DATA', 'ntiles', 'current_cycle']}))

logger.info("Running JEDI LETKF")
self.execute_jediexe(localconf.DATA,
localconf.APRUN_SNOWANL,
os.path.basename(localconf.JEDIEXE),
localconf.jedi_yaml)
exec_cmd = Executable(localconf.APRUN_SNOWANL)
exec_name = os.path.join(localconf.DATA, 'gdas.x')
exec_cmd.add_default_arg(exec_name)
exec_cmd.add_default_arg('fv3jedi')
exec_cmd.add_default_arg('localensembleda')
exec_cmd.add_default_arg(localconf.jedi_yaml)

try:
logger.debug(f"Executing {exec_cmd}")
exec_cmd()
except OSError:
raise OSError(f"Failed to execute {exec_cmd}")
except Exception:
raise WorkflowException(f"An error occured during execution of {exec_cmd}")

logger.info("Creating analysis from backgrounds and increments")
self.add_increments(localconf)
Expand Down

0 comments on commit 233c188

Please sign in to comment.