Skip to content

Commit

Permalink
Merge branch 'develop' into vrfy-bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres authored Feb 7, 2025
2 parents 58e223a + 07ff8a0 commit 785387b
Show file tree
Hide file tree
Showing 16 changed files with 182 additions and 87 deletions.
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ esac

CMAKE_OPTS+=" -DCLONE_JCSDADATA=$CLONE_JCSDADATA -DMACHINE=$BUILD_TARGET"

# TODO: Remove LD_LIBRARY_PATH line as soon as permanent solution is available
if [[ $BUILD_TARGET == 'wcoss2' ]]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/cray/pe/mpich/8.1.19/ofi/intel/19.0/lib"
fi

BUILD_DIR=${BUILD_DIR:-$dir_root/build}
if [[ $CLEAN_BUILD == 'YES' ]]; then
[[ -d ${BUILD_DIR} ]] && rm -rf ${BUILD_DIR}
Expand Down
2 changes: 1 addition & 1 deletion modulefiles/EVA/hera.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local pkgNameVer = myModuleFullName()

conflict(pkgName)

prepend_path("MODULEPATH", "/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/unified-env-rocky8/install/modulefiles/Core")
prepend_path("MODULEPATH", "/contrib/spack-stack//spack-stack-1.6.0/envs/unified-env-rocky8/install/modulefiles/Core")
load("stack-intel/2021.5.0")
load("python/3.10.13")
load("proj/9.2.1")
Expand Down
2 changes: 1 addition & 1 deletion modulefiles/GDAS/hera.intel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local pkgName = myModuleName()
local pkgVersion = myModuleVersion()
local pkgNameVer = myModuleFullName()

prepend_path("MODULEPATH", '/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/unified-env-rocky8/install/modulefiles/Core')
prepend_path("MODULEPATH", '/contrib/spack-stack//spack-stack-1.6.0/envs/unified-env-rocky8/install/modulefiles/Core')
--prepend_path("MODULEPATH", '/scratch1/NCEPDEV/da/python/opt/modulefiles/stack')

-- below two lines get us access to the spack-stack modules
Expand Down
2 changes: 1 addition & 1 deletion parm/soca/berror/soca_ensrecenter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ output increment:
date: '{{ MARINE_WINDOW_END_ISO }}'
exp: trash
type: incr
output file: 'ocn.recenter.incr.%mem%.nc'
output file: 'recenter.incr.%mem%.nc'
pattern: '%mem%'
16 changes: 5 additions & 11 deletions parm/soca/fms/input.nml.j2
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
&MOM_input_nml
output_directory = './',
input_filename = 'r'
input_filename = 'r',
{% if not simple_geom %}
restart_input_dir = 'INPUT/',
restart_output_dir = 'RESTART/',
parameter_filename = 'MOM_input' /
{% endif %}
parameter_filename = '{{ mom_input }}'
/

&diag_manager_nml
/

&ocean_solo_nml
months = 0
days = 1
date_init = {{ date_init }},
hours = 0
minutes = 0
seconds = 0
calendar = 'NOLEAP' /

&fms_io_nml
max_files_w=100
checksum_required=.false.
Expand Down
5 changes: 5 additions & 0 deletions parm/soca/soca_fix_stage_025.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
mkdir:
- "{{ DATA }}/INPUT"
- "{{ DATA }}/anl_geom"
######################################
# fix files to copy
######################################
copy:
# Deterministic resource files
- ["{{ SOCA_INPUT_FIX_DIR }}/rossrad.nc", "{{ DATA }}/rossrad.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/field_table", "{{ DATA }}/field_table"]
- ["{{ SOCA_INPUT_FIX_DIR }}/diag_table", "{{ DATA }}/diag_table"]
Expand All @@ -23,3 +25,6 @@ copy:
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/geothermal_davies2013_v1.nc", "{{ DATA }}/INPUT/geothermal_davies2013_v1.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/interpolate_zgrid_46L.nc", "{{ DATA }}/INPUT/interpolate_zgrid_46L.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/C384_mosaic.nc", "{{ DATA }}/INPUT/C384_mosaic.nc"]
# Analysis resource files
- ["{{ SOCA_ANL_GEOM }}/soca_gridspec.nc", "{{ DATA }}/anl_geom/soca_gridspec.nc"]
- ["{{ SOCA_ANL_GEOM }}/MOM_input", "{{ DATA }}/anl_geom/MOM_input"]
5 changes: 5 additions & 0 deletions parm/soca/soca_fix_stage_100.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
mkdir:
- "{{ DATA }}/INPUT"
- "{{ DATA }}/anl_geom"
######################################
# fix files to copy
######################################
copy:
# Deterministic resource files
- ["{{ SOCA_INPUT_FIX_DIR }}/rossrad.nc", "{{ DATA }}/rossrad.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/field_table", "{{ DATA }}/field_table"]
- ["{{ SOCA_INPUT_FIX_DIR }}/diag_table", "{{ DATA }}/diag_table"]
Expand All @@ -23,3 +25,6 @@ copy:
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/topo_edits_011818.nc", "{{ DATA }}/INPUT/topo_edits_011818.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/MOM_channels_SPEAR", "{{ DATA }}/INPUT/MOM_channels_SPEAR"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/seawifs_1998-2006_smoothed_2X.nc", "{{ DATA }}/INPUT/seawifs_1998-2006_smoothed_2X.nc"]
# Analysis resource files
- ["{{ SOCA_ANL_GEOM }}/soca_gridspec.nc", "{{ DATA }}/anl_geom/soca_gridspec.nc"]
- ["{{ SOCA_ANL_GEOM }}/MOM_input", "{{ DATA }}/anl_geom/MOM_input"]
5 changes: 5 additions & 0 deletions parm/soca/soca_fix_stage_500.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
mkdir:
- "{{ DATA }}/INPUT"
- "{{ DATA }}/anl_geom"
######################################
# fix files to copy
######################################
copy:
# Deterministic resource files
- ["{{ SOCA_INPUT_FIX_DIR }}/rossrad.nc", "{{ DATA }}/rossrad.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/field_table", "{{ DATA }}/field_table"]
- ["{{ SOCA_INPUT_FIX_DIR }}/diag_table", "{{ DATA }}/diag_table"]
Expand All @@ -15,3 +17,6 @@ copy:
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/ocean_hgrid.nc", "{{ DATA }}/INPUT/ocean_hgrid.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/ocean_mosaic.nc", "{{ DATA }}/INPUT/ocean_mosaic.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/ocean_topog.nc", "{{ DATA }}/INPUT/ocean_topog.nc"]
# Analysis resource files
- ["{{ SOCA_ANL_GEOM }}/soca_gridspec.nc", "{{ DATA }}/anl_geom/soca_gridspec.nc"]
- ["{{ SOCA_ANL_GEOM }}/MOM_input", "{{ DATA }}/anl_geom/MOM_input"]
5 changes: 5 additions & 0 deletions test/gw-ci/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ function(add_task task_name test_prefix is_full_cycle HALF_CYCLE FULL_CYCLE pslo
elseif("${task_name}" STREQUAL "gdas_marineanlletkf")
list(APPEND TEST_DEPENDS "${test_prefix}_enkfgdas_fcst_${HALF_CYCLE}")
list(APPEND TEST_DEPENDS "${test_prefix}_gdas_prepoceanobs_${FULL_CYCLE}")
elseif("${task_name}" STREQUAL "gdas_ocnanalecen")
list(APPEND TEST_DEPENDS "${test_prefix}_gdas_marineanlvar_${FULL_CYCLE}")
list(APPEND TEST_DEPENDS "${test_prefix}_gdas_marineanlletkf_${FULL_CYCLE}")
else()
list(APPEND TEST_DEPENDS "${test_prefix}")
endif()
Expand Down Expand Up @@ -359,6 +362,7 @@ if (WORKFLOW_TESTS)
set(YAML_PATH ${HOMEgfs}/ci/cases/pr/${pslot}.yaml)
set(HALF_CYCLE_TASKS
"gdas_stage_ic"
"gdas_waveinit"
"gdas_fcst")
set(FULL_CYCLE_TASKS
"gdas_prepoceanobs"
Expand Down Expand Up @@ -393,6 +397,7 @@ if (WORKFLOW_TESTS)
"gdas_marinebmat"
"gdas_marineanlinit"
"gdas_marineanlvar"
"gdas_ocnanalecen"
"gdas_marineanlchkpt"
"gdas_marineanlfinal"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
platform_description = 'GLIDER profiles from subpfl: temperature and salinity'


class GliderConfig(Bufr2iodaConfig):
def ioda_filename(self):
return f"{self.cycle_type}.t{self.hh}z.insitu_profile_glider.{self.cycle_datetime}.nc4"


if __name__ == '__main__':

script_name, config_file, log_file, test_file = parse_arguments()

bufr2ioda_config = Bufr2iodaConfig(
bufr2ioda_config = GliderConfig(
script_name,
config_file,
platform_description)
Expand Down
47 changes: 29 additions & 18 deletions utils/soca/gdas_ens_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,22 @@ namespace gdasapp {
// -----------------------------------------------------------------------------

int execute(const eckit::Configuration & fullConfig) const {
// Setup the soca geometry
// Setup the native geometry of the ens. members,
// currently assumed to be the same as the deterministic
const eckit::LocalConfiguration geomConfig(fullConfig, "geometry");
oops::Log::info() << "geometry: " << std::endl << geomConfig << std::endl;
const soca::Geometry geom(geomConfig, this->getComm());

// Setup the ensemble B (and output) soca geometry
oops::Log::info() << "====================== ens B geometry" << std::endl;
const std::string outputGeometryKey = fullConfig.has("output geometry")
? "output geometry" // keep things backward compatible for now
: "geometry"; // and default to the input geometry
const eckit::LocalConfiguration geomOutConfig(fullConfig, outputGeometryKey);
const soca::Geometry geomOut(geomOutConfig, this->getComm());

// Initialize the post processing
PostProcIncr postProcIncr(fullConfig, geom, this->getComm());
PostProcIncr postProcIncr(fullConfig, geom, this->getComm(), geomOut);

oops::Log::info() << "soca increments: " << std::endl
<< postProcIncr.inputIncrConfig_ << std::endl;
Expand All @@ -93,7 +101,9 @@ namespace gdasapp {
oops::Log::info() << postProcIncr.inputIncrConfig_ << std::endl;

// Assume z* output is the same for the trajectory and the state
ensMembers.push_back(postProcIncr.read(i));
soca::Increment fullResIncr = postProcIncr.read(i);
soca::Increment lowResIncr(geomOut, fullResIncr); // interp to low resolution geometry
ensMembers.push_back(lowResIncr);
}

// Check if we need to recenter the increment around the deterministic
Expand All @@ -103,9 +113,9 @@ namespace gdasapp {
}

// Compute ensemble moments
soca::Increment ensMean(geom, postProcIncr.socaIncrVar_, postProcIncr.dt_);
soca::Increment ensStd(geom, postProcIncr.socaIncrVar_, postProcIncr.dt_);
soca::Increment ensVariance(geom, postProcIncr.socaIncrVar_, postProcIncr.dt_);
soca::Increment ensMean(geomOut, postProcIncr.socaIncrVar_, postProcIncr.dt_);
soca::Increment ensStd(geomOut, postProcIncr.socaIncrVar_, postProcIncr.dt_);
soca::Increment ensVariance(geomOut, postProcIncr.socaIncrVar_, postProcIncr.dt_);
gdasapp_ens_utils::ensMoments(ensMembers, ensMean, ensStd, ensVariance);
oops::Log::info() << "mean: " << ensMean << std::endl;
oops::Log::info() << "std: " << ensStd << std::endl;
Expand All @@ -123,14 +133,15 @@ namespace gdasapp {

// Initialize the trajectories used in the linear variable changes
const eckit::LocalConfiguration trajConfig(fullConfig, "trajectory");
soca::State determTraj(geom, trajConfig); // deterministic trajectory
soca::State determTrajNative(geom, trajConfig); // deterministic trajectory at full res
soca::State determTraj(geomOut, determTrajNative); // interpolated deterministic trajectory
soca::State ensMeanTraj(determTraj); // trajectory defined as the ens. mean
ensMeanTraj.zero();
ensMeanTraj += ensMean;

// Compute the recentering increment as the difference between
// the ensemble mean and the deterministic
soca::Increment recenteringIncr(geom, postProcIncr.socaIncrVar_, postProcIncr.dt_);
soca::Increment recenteringIncr(geomOut, postProcIncr.socaIncrVar_, postProcIncr.dt_);
recenteringIncr.diff(determTraj, ensMeanTraj);
postProcIncr.setToZero(recenteringIncr);

Expand Down Expand Up @@ -158,7 +169,7 @@ namespace gdasapp {
postProcIncr.setToZero(incr);

// Save the increments used to initialize the ensemble forecast
result = postProcIncr.save(mom6_incr, i+1);
result = postProcIncr.save(mom6_incr, i+1, {"ocn"});
}
return result;
}
Expand Down Expand Up @@ -192,7 +203,7 @@ namespace gdasapp {

// Save total ssh
oops::Log::info() << "ssh ensemble member " << i << std::endl;
soca::Increment ssh_tmp(geom, socaSshVar, postProcIncr.dt_);
soca::Increment ssh_tmp(geomOut, socaSshVar, postProcIncr.dt_);
ssh_tmp = ensMembers[i];
sshTotal.push_back(ssh_tmp);

Expand Down Expand Up @@ -257,9 +268,9 @@ namespace gdasapp {
}

// Compute ensemble moments for total ssh
soca::Increment sshMean(geom, socaSshVar, postProcIncr.dt_);
soca::Increment sshStd(geom, socaSshVar, postProcIncr.dt_);
soca::Increment sshTotalVariance(geom, socaSshVar, postProcIncr.dt_);
soca::Increment sshMean(geomOut, socaSshVar, postProcIncr.dt_);
soca::Increment sshStd(geomOut, socaSshVar, postProcIncr.dt_);
soca::Increment sshTotalVariance(geomOut, socaSshVar, postProcIncr.dt_);
gdasapp_ens_utils::ensMoments(sshTotal, sshMean, sshStd, sshTotalVariance);
oops::Log::info() << "mean ssh total: " << sshMean << std::endl;
oops::Log::info() << "std ssh total: " << sshStd << std::endl;
Expand All @@ -269,7 +280,7 @@ namespace gdasapp {
// Compute ensemble moments for steric ssh
sshMean.zero();
sshStd.zero();
soca::Increment sshStericVariance(geom, socaSshVar, postProcIncr.dt_);
soca::Increment sshStericVariance(geomOut, socaSshVar, postProcIncr.dt_);
gdasapp_ens_utils::ensMoments(sshSteric, sshMean, sshStd, sshStericVariance);
oops::Log::info() << "mean steric ssh: " << sshMean << std::endl;
oops::Log::info() << "std steric ssh: " << sshStd << std::endl;
Expand All @@ -278,8 +289,8 @@ namespace gdasapp {

// Compute ensemble moments for non-steric ssh
sshMean.zero();
soca::Increment sshNonStericVariance(geom, socaSshVar, postProcIncr.dt_);
soca::Increment sshNonStericStd(geom, socaSshVar, postProcIncr.dt_);
soca::Increment sshNonStericVariance(geomOut, socaSshVar, postProcIncr.dt_);
soca::Increment sshNonStericStd(geomOut, socaSshVar, postProcIncr.dt_);
sshNonStericStd.zero();
gdasapp_ens_utils::ensMoments(sshNonSteric, sshMean, sshNonStericStd, sshNonStericVariance);
oops::Log::info() << "mean non-steric ssh: " << sshMean << std::endl;
Expand Down Expand Up @@ -308,7 +319,7 @@ namespace gdasapp {
ensStd.write(bkgErrOutputConfig);

// Explained variance by steric height R=1-SS(non-steric ssh)/SS(total ssh)
soca::Increment varianceRatio(geom, socaSshVar, postProcIncr.dt_);
soca::Increment varianceRatio(geomOut, socaSshVar, postProcIncr.dt_);
varianceRatio = sshNonStericVariance;
atlas::FieldSet varianceRatioFs;
varianceRatio.toFieldSet(varianceRatioFs);
Expand All @@ -319,7 +330,7 @@ namespace gdasapp {
util::divideFieldSets(varianceRatioFs, sshTotalVarianceFs, sshTotalVarianceFs);
varianceRatio.fromFieldSet(varianceRatioFs);

soca::Increment stericExplainedVariance(geom, socaSshVar, postProcIncr.dt_);
soca::Increment stericExplainedVariance(geomOut, socaSshVar, postProcIncr.dt_);
stericExplainedVariance.ones();
stericExplainedVariance -= varianceRatio;

Expand Down
9 changes: 8 additions & 1 deletion utils/soca/gdas_incr_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <iostream>
#include <string>
#include <vector>

#include "eckit/config/LocalConfiguration.h"

Expand Down Expand Up @@ -35,6 +36,12 @@ namespace gdasapp {
oops::Log::info() << "geometry: " << std::endl << geomConfig << std::endl;
const soca::Geometry geom(geomConfig, this->getComm());

// Domains to save
std::vector<std::string> domains = {"ocn", "ice"};
if (fullConfig.has("domains")) {
fullConfig.get("domains", domains);
}

// Check that we are using at least 2 mpi tasks
if (this->getComm().size() < 2) {
throw eckit::BadValue("This application requires at least 2 MPI tasks", Here());
Expand Down Expand Up @@ -65,7 +72,7 @@ namespace gdasapp {
oops::Log::debug() << incr_mom6 << std::endl;

// Save final increment
result = postProcIncr.save(incr_mom6, i);
result = postProcIncr.save(incr_mom6, i, domains);
oops::Log::debug() << "========= after appending layer and after saving:" << std::endl;
oops::Log::debug() << incr_mom6 << std::endl;
}
Expand Down
Loading

0 comments on commit 785387b

Please sign in to comment.