Skip to content

Commit

Permalink
move JEDI executable link to analysis.py (NOAA-EMC#1313)
Browse files Browse the repository at this point in the history
  • Loading branch information
RussTreadon-NOAA committed Apr 19, 2023
1 parent 6b66312 commit 4b61129
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion parm/config/config.aeroanl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export BERROR_DATE="20160630.000000"
export io_layout_x=@IO_LAYOUT_X@
export io_layout_y=@IO_LAYOUT_Y@

export JEDIVAREXE=${HOMEgfs}/exec/fv3jedi_var.x
export JEDIEXE=${HOMEgfs}/exec/fv3jedi_var.x
export crtm_VERSION="2.3.0"

echo "END: config.aeroanl"
2 changes: 1 addition & 1 deletion parm/config/config.atmanl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export layout_y=1
export io_layout_x=1
export io_layout_y=1

export JEDIVAREXE=${HOMEgfs}/exec/fv3jedi_var.x
export JEDIEXE=${HOMEgfs}/exec/fv3jedi_var.x
export crtm_VERSION="2.3.0"

echo "END: config.atmanl"
2 changes: 1 addition & 1 deletion parm/config/config.atmensanl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export layout_y=1
export io_layout_x=1
export io_layout_y=1

export JEDIENSEXE=${HOMEgfs}/exec/fv3jedi_letkf.x
export JEDIEXE=${HOMEgfs}/exec/fv3jedi_letkf.x
export crtm_VERSION="2.3.0"

echo "END: config.atmensanl"
9 changes: 0 additions & 9 deletions ush/python/pygfs/task/aero_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def initialize(self: Analysis) -> None:
- staging B error files
- staging model backgrounds
- generating a YAML file for the JEDI executable
- linking the JEDI executable (TODO make it copyable, requires JEDI fix)
- creating output directories
"""
super().initialize()
Expand Down Expand Up @@ -99,14 +98,6 @@ def initialize(self: Analysis) -> None:
save_as_yaml(varda_yaml, self.task_config.fv3jedi_yaml)
logger.info(f"Wrote variational YAML to: {self.task_config.fv3jedi_yaml}")

# link executable to DATA/ directory
exe_src = self.task_config['JEDIVAREXE']
logger.debug(f"Link executable {exe_src} to DATA/") # TODO: linking is not permitted per EE2. Needs work in JEDI to be able to copy the exec.
exe_dest = os.path.join(self.task_config['DATA'], os.path.basename(exe_src))
if os.path.exists(exe_dest):
rm_p(exe_dest)
os.symlink(exe_src, exe_dest)

# need output dir for diags and anl
logger.debug("Create empty output [anl, diags] directories to receive output from executable")
newdirs = [
Expand Down
30 changes: 29 additions & 1 deletion ush/python/pygfs/task/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from netCDF4 import Dataset
from typing import List, Dict, Any

from pygw.yaml_file import YAMLFile, parse_j2yaml
from pygw.yaml_file import YAMLFile, parse_j2yaml, parse_yamltmpl
from pygw.file_utils import FileHandler
from pygw.template import Template, TemplateConstants
from pygw.logger import logit
Expand Down Expand Up @@ -36,6 +36,9 @@ def initialize(self) -> None:
bias_dict = self.get_bias_dict()
FileHandler(bias_dict).sync()

# link jedi executable to run directory
self.link_jediexe()

@logit(logger)
def get_obs_dict(self: Task) -> Dict[str, Any]:
"""Compile a dictionary of observation files to copy
Expand Down Expand Up @@ -171,3 +174,28 @@ def get_berror_dict(self, config: Dict[str, Any]) -> Dict[str, List[str]]:
"""
berror_dict = {'foo': 'bar'}
return berror_dict

@logit(logger)
def link_jediexe(self: Task) -> None:
"""Compile a dictionary of background error files to copy
This method links a JEDI executable to the run directory
Parameters
----------
Task: GDAS task
Returns
----------
None
"""
exe_src = self.task_config.JEDIEXE

# TODO: linking is not permitted per EE2. Needs work in JEDI to be able to copy the exec.
logger.debug(f"Link executable {exe_src} to DATA/")
exe_dest = os.path.join(self.task_config.DATA, os.path.basename(exe_src))
if os.path.exists(exe_dest):
rm_p(exe_dest)
os.symlink(exe_src, exe_dest)

return
9 changes: 0 additions & 9 deletions ush/python/pygfs/task/atm_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def initialize(self: Analysis) -> None:
- staging B error files
- staging model backgrounds
- generating a YAML file for the JEDI executable
- linking the JEDI executable (TODO make it copyable, requires JEDI fix)
- creating output directories
"""
super().initialize()
Expand Down Expand Up @@ -98,14 +97,6 @@ def initialize(self: Analysis) -> None:
save_as_yaml(varda_yaml, self.task_config.fv3jedi_yaml)
logger.info(f"Wrote variational YAML to: {self.task_config.fv3jedi_yaml}")

# link executable to DATA/ directory
exe_src = self.task_config.JEDIVAREXE
logger.debug(f"Link executable {exe_src} to DATA/") # TODO: linking is not permitted per EE2. Needs work in JEDI to be able to copy the exec.
exe_dest = os.path.join(self.task_config.DATA, os.path.basename(exe_src))
if os.path.exists(exe_dest):
rm_p(exe_dest)
os.symlink(exe_src, exe_dest)

# need output dir for diags and anl
logger.debug("Create empty output [anl, diags] directories to receive output from executable")
newdirs = [
Expand Down
9 changes: 0 additions & 9 deletions ush/python/pygfs/task/atmens_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def initialize(self: Analysis) -> None:
- staging FV3-JEDI fix files
- staging model backgrounds
- generating a YAML file for the JEDI executable
- linking the JEDI executable (TODO make it copyable, requires JEDI fix)
- creating output directories
Parameters
Expand Down Expand Up @@ -101,14 +100,6 @@ def initialize(self: Analysis) -> None:
save_as_yaml(ensda_yaml, self.task_config.fv3jedi_yaml)
logger.info(f"Wrote ensemble da YAML to: {self.task_config.fv3jedi_yaml}")

# link executable to DATA/ directory
exe_src = self.task_config.JEDIENSEXE
logger.debug(f"Link executable {exe_src} to DATA/") # TODO: linking is not permitted per EE2. Needs work in JEDI to be able to copy the exec.
exe_dest = os.path.join(self.task_config.DATA, os.path.basename(exe_src))
if os.path.exists(exe_dest):
rm_p(exe_dest)
os.symlink(exe_src, exe_dest)

# need output dir for diags and anl
logger.debug("Create empty output [anl, diags] directories to receive output from executable")
newdirs = [
Expand Down

0 comments on commit 4b61129

Please sign in to comment.