Skip to content

Commit

Permalink
add crtm_VERSION to atmanl and atmensanl config; move common function…
Browse files Browse the repository at this point in the history
…ality from analysis task class to parent class (NOAA-EMC#1313)
  • Loading branch information
RussTreadon-NOAA committed Mar 2, 2023
1 parent 3a3d628 commit c207ff6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 37 deletions.
3 changes: 2 additions & 1 deletion parm/config/config.atmanl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
echo "BEGIN: config.atmanl"

export OBS_YAML_DIR=${HOMEgfs}/sorc/gdas.cd/parm/atm/obs/config/
export OBS_LIST=${HOMEgfs}/sorc/gdas.cd/parm/atm/obs/lists/gdas_prototype.yaml
export OBS_LIST=${HOMEgfs}/sorc/gdas.cd/parm/atm/obs/lists/gdas_prototype_3d.yaml
export ATMVARYAML=${HOMEgfs}/sorc/gdas.cd/parm/atm/variational/3dvar_dripcg.yaml
export STATICB_TYPE="identity"
export BERROR_YAML=${HOMEgfs}/sorc/gdas.cd/parm/atm/berror/staticb_${STATICB_TYPE}.yaml
Expand All @@ -26,5 +26,6 @@ export io_layout_x=1
export io_layout_y=1

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

echo "END: config.atmanl"
1 change: 1 addition & 0 deletions parm/config/config.atmensanl
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ export io_layout_x=1
export io_layout_y=1

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

echo "END: config.atmensanl"
10 changes: 2 additions & 8 deletions ush/python/pygfs/task/aero_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,10 @@ def initialize(self: Analysis) -> None:
super().initialize()

# stage CRTM fix files
crtm_fix_list_path = os.path.join(self.task_config['HOMEgfs'], 'parm', 'parm_gdas', 'aero_crtm_coeff.yaml')
crtm_fix_list = YAMLFile(path=crtm_fix_list_path)
crtm_fix_list = Template.substitute_structure(crtm_fix_list, TemplateConstants.DOLLAR_PARENTHESES, self.task_config.get)
FileHandler(crtm_fix_list).sync()
super().stage_fix('aero_crtm_coeff.yaml')

# stage fix files
jedi_fix_list_path = os.path.join(self.task_config['HOMEgfs'], 'parm', 'parm_gdas', 'aero_jedi_fix.yaml')
jedi_fix_list = YAMLFile(path=jedi_fix_list_path)
jedi_fix_list = Template.substitute_structure(jedi_fix_list, TemplateConstants.DOLLAR_PARENTHESES, self.task_config.get)
FileHandler(jedi_fix_list).sync()
super().stage_fix('aero_jedi_fix.yaml')

# stage berror files
# copy BUMP files, otherwise it will assume ID matrix
Expand Down
21 changes: 18 additions & 3 deletions ush/python/pygfs/task/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pygw.file_utils import FileHandler
from pygw.logger import logit
from pygw.task import Task
from pygw.template import Template, TemplateConstants

logger = getLogger(__name__.split('.')[-1])

Expand All @@ -31,9 +32,7 @@ def initialize(self) -> None:
obs_dict = self.get_obs_dict()
FileHandler(obs_dict).sync()

def initialize_bias(self) -> None:
super().initialize()
# all analyses need to stage observations
# some analyses need to stage bias corrections
bias_dict = self.get_bias_dict()
FileHandler(bias_dict).sync()

Expand Down Expand Up @@ -175,3 +174,19 @@ def get_berror_dict(self, config: Dict[str, Any]) -> Dict[str, List[str]]:
"""
berror_dict = {'foo': 'bar'}
return berror_dict

@logit(logger)
def stage_fix(self, fix_yaml: str) -> None:
"""Stage fix files
This method is a placeholder for now... will be possibly made generic at a later date
Parameters
----------
fix_yaml : str
tamplate of fix files to copy
"""
fix_list_path = os.path.join(self.config['HOMEgfs'], 'parm', 'parm_gdas', fix_yaml)
fix_list = YAMLFile(path=fix_list_path)
fix_list = Template.substitute_structure(fix_list, TemplateConstants.DOLLAR_PARENTHESES, self.task_config.get)
FileHandler(fix_list).sync()
17 changes: 4 additions & 13 deletions ush/python/pygfs/task/atm_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,18 @@ def initialize(self: Analysis) -> None:
- creating output directories
"""

# stage observations
# stage observations and bias corrections
super().initialize()

# stage bias correction files
super().initialize_bias()

# stage CRTM fix files
crtm_fix_list_path = os.path.join(self.task_config['HOMEgfs'], 'parm', 'parm_gdas', 'atm_crtm_coeff.yaml')
crtm_fix_list = YAMLFile(path=crtm_fix_list_path)
crtm_fix_list = Template.substitute_structure(crtm_fix_list, TemplateConstants.DOLLAR_PARENTHESES, self.task_config.get)
FileHandler(crtm_fix_list).sync()
super().stage_fix('atm_crtm_coeff.yaml')

# stage fix files
jedi_fix_list_path = os.path.join(self.task_config['HOMEgfs'], 'parm', 'parm_gdas', 'atm_jedi_fix.yaml')
jedi_fix_list = YAMLFile(path=jedi_fix_list_path)
jedi_fix_list = Template.substitute_structure(jedi_fix_list, TemplateConstants.DOLLAR_PARENTHESES, self.task_config.get)
FileHandler(jedi_fix_list).sync()
super().stage_fix('atm_jedi_fix.yaml')

# stage berror files
# copy BUMP files, otherwise it will assume ID matrix
if self.task_config.get('STATICB_TYPE', 'bump_atm') in ['bump_atm']:
if self.task_config.get('STATICB_TYPE', 'identity') in ['bump']:
FileHandler(AtmAnalysis.get_berror_dict(self.task_config)).sync()

# stage backgrounds
Expand Down
15 changes: 3 additions & 12 deletions ush/python/pygfs/task/atmens_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,14 @@ def initialize(self: Analysis) -> None:
- creating output directories
"""

# stage observations
# stage observations and bias corrections
super().initialize()

# stage bias correction files
super().initialize_bias()

# stage CRTM fix files
crtm_fix_list_path = os.path.join(self.task_config['HOMEgfs'], 'parm', 'parm_gdas', 'atm_crtm_coeff.yaml')
crtm_fix_list = YAMLFile(path=crtm_fix_list_path)
crtm_fix_list = Template.substitute_structure(crtm_fix_list, TemplateConstants.DOLLAR_PARENTHESES, self.task_config.get)
FileHandler(crtm_fix_list).sync()
super().stage_fix('atm_crtm_coeff.yaml')

# stage fix files
jedi_fix_list_path = os.path.join(self.task_config['HOMEgfs'], 'parm', 'parm_gdas', 'atm_jedi_fix.yaml')
jedi_fix_list = YAMLFile(path=jedi_fix_list_path)
jedi_fix_list = Template.substitute_structure(jedi_fix_list, TemplateConstants.DOLLAR_PARENTHESES, self.task_config.get)
FileHandler(jedi_fix_list).sync()
super().stage_fix('atm_jedi_fix.yaml')

# stage backgrounds
FileHandler(self.get_bkg_dict(AttrDict(self.task_config, **self.task_config))).sync()
Expand Down

0 comments on commit c207ff6

Please sign in to comment.