Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Jul 5, 2024
1 parent af23b27 commit c87f8d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 112 deletions.
4 changes: 0 additions & 4 deletions parm/soca/berror/soca_ensb.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
110 changes: 2 additions & 108 deletions scripts/exgdas_global_marine_analysis_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from jcb import render
from wxflow import (Logger, Template, TemplateConstants,
YAMLFile, FileHandler, AttrDict, parse_j2yaml)
YAMLFile, FileHandler)

logger = Logger()

Expand Down Expand Up @@ -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")

################################################################################
Expand All @@ -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 = []
Expand All @@ -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

Expand Down

0 comments on commit c87f8d3

Please sign in to comment.