From c87f8d35ddad3f2322dd7cd69256655c433a2b6d Mon Sep 17 00:00:00 2001 From: Guillaume Vernieres Date: Fri, 5 Jul 2024 13:59:28 -0400 Subject: [PATCH] tidy --- parm/soca/berror/soca_ensb.yaml.j2 | 4 - scripts/exgdas_global_marine_analysis_prep.py | 110 +----------------- 2 files changed, 2 insertions(+), 112 deletions(-) diff --git a/parm/soca/berror/soca_ensb.yaml.j2 b/parm/soca/berror/soca_ensb.yaml.j2 index dcb45c481..48bc494f4 100644 --- a/parm/soca/berror/soca_ensb.yaml.j2 +++ b/parm/soca/berror/soca_ensb.yaml.j2 @@ -78,10 +78,6 @@ background error output: linear variable change: linear variable changes: -# - linear variable change name: BkgErrFILT -# ocean_depth_min: 500 # zero where ocean is shallower than 500m -# rescale_bkgerr: 1.0 # rescale perturbation -# efold_z: 1500.0 # Apply exponential decay - linear variable change name: BalanceSOCA trajectory: diff --git a/scripts/exgdas_global_marine_analysis_prep.py b/scripts/exgdas_global_marine_analysis_prep.py index d47c3dbd0..4b7192057 100755 --- a/scripts/exgdas_global_marine_analysis_prep.py +++ b/scripts/exgdas_global_marine_analysis_prep.py @@ -16,7 +16,7 @@ from jcb import render from wxflow import (Logger, Template, TemplateConstants, - YAMLFile, FileHandler, AttrDict, parse_j2yaml) + YAMLFile, FileHandler) logger = Logger() @@ -174,47 +174,9 @@ def parse_obs_list_file(): ens_perturbations = os.path.join('..', f'gdasmarinebmat.{PDY}{cyc}', 'enspert', 'ens') os.symlink(ens_perturbations, 'ens') -# logger.info("---------------- Stage ensemble members") -# ens_member_list = [] -# for mem in range(1, nmem_ens+1): -# for domain in ['ocean', 'ice']: -# # TODO(Guillaume): make use and define ensemble COM in the j-job -# ensroot = os.getenv('COM_OCEAN_HISTORY_PREV') -# ensdir = os.path.join(os.getenv('COM_OCEAN_HISTORY_PREV'), '..', '..', '..', '..', '..', -# f'enkf{RUN}.{PDY}', f'{gcyc}', f'mem{str(mem).zfill(3)}', -# 'model_data', domain, 'history') -# ensdir_real = os.path.realpath(ensdir) -# f009 = f'enkfgdas.{domain}.t{gcyc}z.inst.f009.nc' -# -# fname_in = os.path.abspath(os.path.join(ensdir_real, f009)) -# fname_out = os.path.realpath(os.path.join(static_ens, domain+"."+str(mem)+".nc")) -# ens_member_list.append([fname_in, fname_out]) -# FileHandler({'copy': ens_member_list}).sync() -# -# # reformat the cice history output -# for mem in range(1, nmem_ens+1): -# cice_fname = os.path.realpath(os.path.join(static_ens, "ice."+str(mem)+".nc")) -# bkg_utils.cice_hist2fms(cice_fname, cice_fname) -#else: -# if nmem_ens >= 3: -# logger.info("---------------- Stage offline ensemble members") -# ens_member_list = [] -# clim_ens_dir = find_clim_ens(pytz.utc.localize(window_begin, is_dst=None)) -# list_of_members = glob.glob(os.path.join(clim_ens_dir, 'ocean.*.nc')) -# nmem_ens = min(nmem_ens, len(list_of_members)) -# for domain in ['ocean', 'ice']: -# for mem in range(1, nmem_ens+1): -# fname = domain+"."+str(mem)+".nc" -# fname_in = os.path.join(clim_ens_dir, fname) -# fname_out = os.path.join(static_ens, fname) -# ens_member_list.append([fname_in, fname_out]) -# FileHandler({'copy': ens_member_list}).sync() - -os.environ['ENS_SIZE'] = str(nmem_ens) - ################################################################################ # prepare JEDI yamls - +os.environ['ENS_SIZE'] = str(nmem_ens) logger.info(f"---------------- Generate JEDI yaml files") ################################################################################ @@ -223,42 +185,6 @@ def parse_obs_list_file(): dst = os.path.join(anl_dir, 'soca_gridspec.nc') FileHandler({'copy': [[src, dst]]}).sync() -#logger.info(f"---------------- generate gridgen.yaml") -#gridgen_yaml_src = os.path.realpath(os.path.join(gdas_home, 'parm', 'soca', 'gridgen', 'gridgen.yaml')) -#gridgen_yaml_dst = os.path.realpath(os.path.join(stage_cfg['stage_dir'], 'gridgen.yaml')) -#FileHandler({'copy': [[gridgen_yaml_src, gridgen_yaml_dst]]}).sync() - -################################################################################ -# generate the YAML file for the post processing of the clim. ens. B -berror_yaml_dir = os.path.join(gdas_home, 'parm', 'soca', 'berror') - -#logger.info(f"---------------- generate soca_diagb.yaml") -#conf = parse_j2yaml(path=os.path.join(berror_yaml_dir, 'soca_diagb.yaml.j2'), -# data=envconfig) -#conf.save(os.path.join(anl_dir, 'soca_diagb.yaml')) - -#logger.info(f"---------------- generate soca_ensb.yaml") -#berr_yaml = os.path.join(anl_dir, 'soca_ensb.yaml') -#berr_yaml_template = os.path.join(berror_yaml_dir, 'soca_ensb.yaml') -#config = YAMLFile(path=berr_yaml_template) -#config = Template.substitute_structure(config, TemplateConstants.DOUBLE_CURLY_BRACES, envconfig.get) -#config.save(berr_yaml) -# -#logger.info(f"---------------- generate soca_ensweights.yaml") -#berr_yaml = os.path.join(anl_dir, 'soca_ensweights.yaml') -#berr_yaml_template = os.path.join(berror_yaml_dir, 'soca_ensweights.yaml') -#config = YAMLFile(path=berr_yaml_template) -#config = Template.substitute_structure(config, TemplateConstants.DOUBLE_CURLY_BRACES, envconfig.get) -#config.save(berr_yaml) - -################################################################################ -# copy yaml for localization length scales - -#logger.info(f"---------------- generate soca_setlocscales.yaml") -#locscales_yaml_src = os.path.join(gdas_home, 'parm', 'soca', 'berror', 'soca_setlocscales.yaml') -#locscales_yaml_dst = os.path.join(stage_cfg['stage_dir'], 'soca_setlocscales.yaml') -#FileHandler({'copy': [[locscales_yaml_src, locscales_yaml_dst]]}).sync() - ################################################################################ # stage the static B-matrix bmat_list = [] @@ -285,38 +211,6 @@ def parse_obs_list_file(): os.path.join(anl_dir, "ice.ens_weights.nc")]) FileHandler({'copy': ensbmat_list}).sync() -################################################################################ -# copy yaml for correlation length scales - -#logger.info(f"---------------- generate soca_setcorscales.yaml") -#corscales_yaml_src = os.path.join(gdas_home, 'parm', 'soca', 'berror', 'soca_setcorscales.yaml') -#corscales_yaml_dst = os.path.join(stage_cfg['stage_dir'], 'soca_setcorscales.yaml') -#FileHandler({'copy': [[corscales_yaml_src, corscales_yaml_dst]]}).sync() - -################################################################################ -# copy yaml for diffusion initialization - -#logger.info(f"---------------- generate soca_parameters_diffusion_hz.yaml") -#diffu_hz_yaml = os.path.join(anl_dir, 'soca_parameters_diffusion_hz.yaml') -#diffu_hz_yaml_dir = os.path.join(gdas_home, 'parm', 'soca', 'berror') -#diffu_hz_yaml_template = os.path.join(berror_yaml_dir, 'soca_parameters_diffusion_hz.yaml') -#config = YAMLFile(path=diffu_hz_yaml_template) -#config = Template.substitute_structure(config, TemplateConstants.DOUBLE_CURLY_BRACES, envconfig.get) -#config.save(diffu_hz_yaml) -# -#logger.info(f"---------------- generate soca_vtscales.yaml") -#conf = parse_j2yaml(path=os.path.join(gdas_home, 'parm', 'soca', 'berror', 'soca_vtscales.yaml.j2'), -# data=envconfig) -#conf.save(os.path.join(anl_dir, 'soca_vtscales.yaml')) -# -#logger.info(f"---------------- generate soca_parameters_diffusion_vt.yaml") -#diffu_vt_yaml = os.path.join(anl_dir, 'soca_parameters_diffusion_vt.yaml') -#diffu_vt_yaml_dir = os.path.join(gdas_home, 'parm', 'soca', 'berror') -#diffu_vt_yaml_template = os.path.join(berror_yaml_dir, 'soca_parameters_diffusion_vt.yaml') -#config = YAMLFile(path=diffu_vt_yaml_template) -#config = Template.substitute_structure(config, TemplateConstants.DOUBLE_CURLY_BRACES, envconfig.get) -#config.save(diffu_vt_yaml) - ################################################################################ # generate yaml for soca_var