diff --git a/parm/config/gfs/config.aeroanlgenb b/parm/config/gfs/config.aeroanlgenb index 8f397375d5e..6a2139ad016 100644 --- a/parm/config/gfs/config.aeroanlgenb +++ b/parm/config/gfs/config.aeroanlgenb @@ -9,5 +9,9 @@ echo "BEGIN: config.aeroanlgenb" source "${EXPDIR}/config.resources" aeroanlgenb export BMATYAML="${PARMgfs}/gdas/aero/berror/aero_diagb.yaml.j2" +export DIFFUSIONYAML="${PARMgfs}/gdas/aero/berror/aero_diffusionparm.yaml.j2" +export iterations=10 +export fixed value=1.0 + echo "END: config.aeroanlgenb" diff --git a/ush/python/pygfs/task/aero_bmatrix.py b/ush/python/pygfs/task/aero_bmatrix.py index 6a559168579..436142abc1b 100644 --- a/ush/python/pygfs/task/aero_bmatrix.py +++ b/ush/python/pygfs/task/aero_bmatrix.py @@ -25,6 +25,7 @@ def __init__(self, config: Dict[str, Any]) -> None: _res_anl = int(self.config['CASE_ANL'][1:]) _bmat_yaml = os.path.join(self.runtime_config.DATA, f"{self.runtime_config.CDUMP}.t{self.runtime_config['cyc']:02d}z.chem_diagb.yaml") + _diffusion_yaml = os.path.join(self.runtime_config.DATA, f"{self.runtime_config.CDUMP}.t{self.runtime_config['cyc']:02d}z.chem_diffusion.yaml") # Create a local dictionary that is repeatedly used across this class local_dict = AttrDict( @@ -41,6 +42,7 @@ def __init__(self, config: Dict[str, Any]) -> None: 'APREFIX': f"{self.runtime_config.CDUMP}.t{self.runtime_config.cyc:02d}z.", # TODO: CDUMP is being replaced by RUN 'GPREFIX': f"gdas.t{self.runtime_config.previous_cycle.hour:02d}z.", 'bmat_yaml': _bmat_yaml, + 'diffusion_yaml': _diffusion_yaml, } ) @@ -63,6 +65,11 @@ def initialize(self: BMatrix) -> None: save_as_yaml(self.task_config.bmat_config, self.task_config.bmat_yaml) logger.info(f"Wrote bmat YAML to: {self.task_config.bmat_yaml}") + # generate diffusion parameters YAML file + logger.debug(f"Generate diffusion YAML file: {self.task_config.diffusion_yaml}") + save_as_yaml(self.task_config.diffusion_config, self.task_config.diffusion_yaml) + logger.info(f"Wrote diffusion YAML to: {self.task_config.diffusion_yaml}") + # create output directory FileHandler({'mkdir': [os.path.join(self.task_config['DATA'], 'stddev')]}).sync() @@ -95,9 +102,12 @@ def finalize(self) -> None: # copy full YAML from executable to ROTDIR src = os.path.join(self.task_config['DATA'], f"{self.task_config['CDUMP']}.t{self.runtime_config['cyc']:02d}z.chem_diagb.yaml") dest = os.path.join(self.task_config.COM_CHEM_ANALYSIS, f"{self.task_config['CDUMP']}.t{self.runtime_config['cyc']:02d}z.chem_diagb.yaml") + src_diffusion = os.path.join(self.task_config['DATA'], f"{self.task_config['CDUMP']}.t{self.runtime_config['cyc']:02d}z.chem_diffusion.yaml") + dest_diffusion = os.path.join(self.task_config.COM_CHEM_ANALYSIS, f"{self.task_config['CDUMP']}.t{self.runtime_config['cyc']:02d}z.chem_diffusion.yaml") yaml_copy = { 'mkdir': [self.task_config.COM_CHEM_ANALYSIS], - 'copy': [[src, dest]] + 'copy': [[src, dest]], + 'copy': [[src_diffusion, dest_diffusion]] } FileHandler(yaml_copy).sync() diff --git a/ush/python/pygfs/task/bmatrix.py b/ush/python/pygfs/task/bmatrix.py index 0c8696ff1a7..59b4683ff38 100644 --- a/ush/python/pygfs/task/bmatrix.py +++ b/ush/python/pygfs/task/bmatrix.py @@ -27,6 +27,7 @@ def initialize(self) -> None: super().initialize() # all BMatrix tasks need a config self.task_config.bmat_config = self.get_bmat_config() + self.task_config.diffusion_config = self.get_diffusion_config() def finalize(self) -> None: super().finalize() @@ -44,9 +45,31 @@ def get_bmat_config(self) -> Dict[str, Any]: a dictionary containing the fully rendered B matrix yaml configuration """ - # generate JEDI YAML file + # generate JEDI YAML file for stddev logger.info(f"Generate B Matrix YAML config: {self.task_config.bmat_yaml}") bmat_config = parse_j2yaml(self.task_config.BMATYAML, self.task_config, searchpath=self.gdasapp_j2tmpl_dir) logger.debug(f"BMAT config:\n{pformat(bmat_config)}") return bmat_config + + def get_diffusion_config(self) -> Dict[str, Any]: + """Compile a dictionary of diffusion operator configuration from DIFFUSIONYAML template file + + Parameters + ---------- + diffusion_iter + fixed_val + horiz_len + + Returns + ---------- + diffusion_config : Dict + a dictionary containing the fully rendered diffusion operator yaml configuration + """ + + # generate JEDI YAML file for diffusion parameters + logger.info(f"Generate Diff Parmameter YAML config: {self.task_config.diffusion_yaml}") + diffusion_config = parse_j2yaml(self.task_config.DIFFUSIONYAML, self.task_config, searchpath=self.gdasapp_j2tmpl_dir) + logger.debug(f"DIFFUSION config:\n{pformat(diffusion_config)}") + + return diffusion_config