Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Aug 3, 2023
1 parent 5df5739 commit 823b741
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
1 change: 0 additions & 1 deletion parm/soca/variational/3dvarfgat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ variational:
fields metadata: ./fields_metadata.yaml
ninner: !ENV ${SOCA_NINNER}
gradient norm reduction: 1e-10
test: on
diagnostics:
departures: ombg

Expand Down
13 changes: 11 additions & 2 deletions scripts/exgdas_global_marine_analysis_bmat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ fi
################################################################################
# Compute the ens std. dev, ignore ssh variance
# TODO (G): Implement what's below into one single oops application
# 0 - Compute moments of original ensemble, used at the diag of the first
# 0 - Compute moments of original ensemble, used at the diag of the first
# component of the hybrid B
# 1 - Ensemble perturbations:
# o Vertically Interpolate to the deterministic layers
# o Recenter around 0 to create an ensemble of perturbations
# o Recenter around 0 to create an ensemble of perurbations
# 2 - Filter members and apply the linear steric height balance to each members
# 3 - Copy h from deterministic to unbalanced perturbations
# 4 - Compute moments of converted ensemble perturbations
Expand All @@ -131,6 +131,15 @@ if [ $err -gt 0 ]; then
exit $err
fi

# Zero out std. dev of ssh to use the balance as a strong constraint
# TODO: Apply the inverse of the balance
clean_yaml soca_clim_ens_moments.yaml
$APRUN_OCNANAL $JEDI_BIN/gdas_incr_handler.x soca_postproc_stddev.yaml
export err=$?; err_chk
if [ $err -gt 0 ]; then
exit $err
fi

# Compute ensemble perturbations, vertically remap to cycle's vertical geometry
clean_yaml soca_clim_ens_perts.yaml
$APRUN_OCNANAL $JEDI_BIN/soca_ensrecenter.x soca_clim_ens_perts.yaml
Expand Down
10 changes: 8 additions & 2 deletions scripts/exgdas_global_marine_analysis_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,18 @@ def find_clim_ens(input_date):
# generate YAMLS file for diag of clim. ens. B
berror_yaml_dir = os.path.join(gdas_home, 'parm', 'soca', 'berror')

logging.info(f"---------------- generate soca_clim_moments.yaml")
logging.info(f"---------------- generate soca_clim_ens_moments.yaml")
berr_yaml = os.path.join(anl_dir, 'soca_clim_ens_moments.yaml')
berr_yaml_template = os.path.join(berror_yaml_dir, 'soca_clim_ens_moments.yaml')
config = YAMLFile(path=berr_yaml_template)
config = Template.substitute_structure(config, TemplateConstants.DOUBLE_CURLY_BRACES, envconfig.get)
config = Template.substitute_structure(config, TemplateConstants.DOLLAR_PARENTHESES, envconfig.get)
config.save(berr_yaml)

logging.info(f"---------------- generate soca_postproc_stddev.yaml")
berr_yaml = os.path.join(anl_dir, 'soca_postproc_stddev.yaml')
berr_yaml_template = os.path.join(berror_yaml_dir, 'soca_postproc_stddev.yaml')
config = YAMLFile(path=berr_yaml_template)
config = Template.substitute_structure(config, TemplateConstants.DOUBLE_CURLY_BRACES, envconfig.get)
config.save(berr_yaml)

logging.info(f"---------------- generate soca_clim_ens_perts.yaml")
Expand Down
9 changes: 8 additions & 1 deletion utils/gdas_postprocincr.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,16 @@ class PostProcIncr {
// wait for everybody to be done
comm_.barrier();

// Change soca standard output name to something specidfied in the config
// Change soca standard output name to something specified in the config
int result = 0;
if ( comm_.rank() == 0 ) {
// get the output directory
std::string dataDir;
outputIncrConfig_.get("datadir", dataDir);
// get the output file name
std::string outputFileName;
outputIncrConfig_.get("output file", outputFileName);
outputFileName = dataDir + "/" + outputFileName;
if (outputIncrConfig_.has("pattern")) {
std::string pattern;
outputIncrConfig_.get("pattern", pattern);
Expand Down Expand Up @@ -226,6 +231,8 @@ class PostProcIncr {
// Utility functions
// -----------------------------------------------------------------------------
// Recreate the soca filename from the configuration
// TODO: Change this in soca?
// TODO: Hard-coded for ocean, implement for seaice as well
std::string socaFname() {
std::string datadir;
outputIncrConfig_.get("datadir", datadir);
Expand Down

0 comments on commit 823b741

Please sign in to comment.