From 6f7776075e71a3543cd47e2249cb7a732aae7403 Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Wed, 8 May 2024 13:42:07 -0400 Subject: [PATCH 01/10] Initial commit of snow recentering code --- utils/CMakeLists.txt | 1 + utils/snow/CMakeLists.txt | 5 +++++ utils/snow/snow_ensrecenter.cc | 8 ++++++++ utils/snow/snow_ensrecenter.h | 0 4 files changed, 14 insertions(+) create mode 100644 utils/snow/CMakeLists.txt create mode 100644 utils/snow/snow_ensrecenter.cc create mode 100644 utils/snow/snow_ensrecenter.h diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 4f376c26a..7010e1b64 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -22,3 +22,4 @@ add_subdirectory(test) add_subdirectory(obsproc) add_subdirectory(fv3jedi) add_subdirectory(chem) +add_subdirectory(snow) diff --git a/utils/snow/CMakeLists.txt b/utils/snow/CMakeLists.txt new file mode 100644 index 000000000..1529a0c86 --- /dev/null +++ b/utils/snow/CMakeLists.txt @@ -0,0 +1,5 @@ +# Ensemble recenter of snow +ecbuild_add_executable( TARGET gdasapp_snow_ensrecenter.x + SOURCES snow_ensrecenter.cc ) +target_compile_features( gdasapp_snow_ensrecenter.x PUBLIC cxx_std_17) +target_link_libraries( gdasapp_snow_ensrecenter.x PUBLIC NetCDF::NetCDF_CXX oops atlas fv3jedi) diff --git a/utils/snow/snow_ensrecenter.cc b/utils/snow/snow_ensrecenter.cc new file mode 100644 index 000000000..060cc50ca --- /dev/null +++ b/utils/snow/snow_ensrecenter.cc @@ -0,0 +1,8 @@ +#include "snow_ensrecenter.h" +#include "oops/runs/Run.h" + +int main(int argc, char ** argv) { + oops::Run run(argc, argv); + gdasapp::FV3SnowEnsRecenter fv3snowensrecenter; + return run.execute(fv3snowensrecenter); +} diff --git a/utils/snow/snow_ensrecenter.h b/utils/snow/snow_ensrecenter.h new file mode 100644 index 000000000..e69de29bb From 8d8350d8c7eae7ca93928b364e581916e4701373 Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Wed, 8 May 2024 15:31:11 -0400 Subject: [PATCH 02/10] Commit to try to compile --- utils/snow/snow_ensrecenter.h | 67 +++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/utils/snow/snow_ensrecenter.h b/utils/snow/snow_ensrecenter.h index e69de29bb..dc5d2d6f0 100644 --- a/utils/snow/snow_ensrecenter.h +++ b/utils/snow/snow_ensrecenter.h @@ -0,0 +1,67 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include "eckit/config/LocalConfiguration.h" + +#include "oops/base/FieldSet3D.h" +#include "oops/base/GeometryData.h" +#include "oops/base/StateEnsemble.h" +#include "oops/mpi/mpi.h" +#include "oops/runs/Application.h" +#include "oops/util/DateTime.h" +#include "oops/util/Duration.h" +#include "oops/util/FieldSetHelpers.h" +#include "oops/util/FieldSetOperations.h" +#include "oops/util/Logger.h" + +#include "fv3jedi/Geometry/Geometry.h" +#include "fv3jedi/Increment/Increment.h" +#include "fv3jedi/State/State.h" + + +namespace gdasapp { + /** + * FV3SnowEnsRecenter Class Implementation + * + * Generates an analysis increment for the ensemble forecast of snow + * based off of the difference between the forecast ensemble mean and the + * deterministic snow forecast plus the analysis increment. + */ + + class FV3SnowEnsRecenter : public oops::Application { + public: + explicit FV3SnowEnsRecenter(const eckit::mpi::Comm & comm = oops::mpi::world()) + : Application(comm) {} + static const std::string classname() {return "gdasapp::FV3SnowEnsRecenter";} + + int execute(const eckit::Configuration & fullConfig, bool /*validate*/) const { + /// Setup the FV3 geometry, we are going to assume that things are on the same grid + /// as we do not fully trust OOPS interpolation for land compared to other tools + const eckit::LocalConfiguration geomConfig(fullConfig, "geometry"); + const fv3jedi::Geometry geom(geomConfig, this->getComm()); + + /// Get the valid time + std::string strdt; + fullConfig.get("date", strdt); + util::DateTime cycleDate = util::DateTime(strdt); + + /// Get the list of variables to read from the background + oops::Variables varList(fullConfig, "variables.name"); + + /// Read the determinstic background + fv3jedi::State detbkg(geom, varList, cycleDate); + const eckit::LocalConfiguration bkgConfig(fullConfig, "deterministic background"); + detbkg.read(bkgConfig); + oops::Log::info() << "Determinstic background: " << std::endl << detbkg << std::endl; + + /// Read the ensemble and get the mean + const eckit::LocalConfiguration ensBkgConfig(fullConfig, "ensemble background"); + oops::StateEnsemble ensState(geom, ensBkgConfig); + + oops::Log::info() << "Ensemble mean background: " << std::endl << ensmean << std::endl; + } From 552643f6016b724d0b03c60b3f21994a43fb55d1 Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Wed, 8 May 2024 16:39:49 -0400 Subject: [PATCH 03/10] Compiles --- utils/snow/snow_ensrecenter.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/utils/snow/snow_ensrecenter.h b/utils/snow/snow_ensrecenter.h index dc5d2d6f0..e028aede7 100644 --- a/utils/snow/snow_ensrecenter.h +++ b/utils/snow/snow_ensrecenter.h @@ -10,7 +10,6 @@ #include "oops/base/FieldSet3D.h" #include "oops/base/GeometryData.h" -#include "oops/base/StateEnsemble.h" #include "oops/mpi/mpi.h" #include "oops/runs/Application.h" #include "oops/util/DateTime.h" @@ -61,7 +60,15 @@ namespace gdasapp { /// Read the ensemble and get the mean const eckit::LocalConfiguration ensBkgConfig(fullConfig, "ensemble background"); - oops::StateEnsemble ensState(geom, ensBkgConfig); + /// oops::StateEnsemble ensState(geom, ensBkgConfig); - oops::Log::info() << "Ensemble mean background: " << std::endl << ensmean << std::endl; + /// oops::Log::info() << "Ensemble mean background: " << std::endl << ensmean << std::endl; } + private: + + // ----------------------------------------------------------------------------- + std::string appname() const { + return "gdasapp::FV3SnowEnsRecenter"; + } + }; +} // namespace gdasapp From 7999e3127943297eeaa4d74f5c8a7d1b3a971198 Mon Sep 17 00:00:00 2001 From: CoryMartin-NOAA Date: Thu, 9 May 2024 16:04:11 +0000 Subject: [PATCH 04/10] Making progress --- utils/snow/snow_ensrecenter.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/utils/snow/snow_ensrecenter.h b/utils/snow/snow_ensrecenter.h index e028aede7..34fe2c596 100644 --- a/utils/snow/snow_ensrecenter.h +++ b/utils/snow/snow_ensrecenter.h @@ -12,6 +12,7 @@ #include "oops/base/GeometryData.h" #include "oops/mpi/mpi.h" #include "oops/runs/Application.h" +#include "oops/util/ConfigFunctions.h" #include "oops/util/DateTime.h" #include "oops/util/Duration.h" #include "oops/util/FieldSetHelpers.h" @@ -50,7 +51,7 @@ namespace gdasapp { util::DateTime cycleDate = util::DateTime(strdt); /// Get the list of variables to read from the background - oops::Variables varList(fullConfig, "variables.name"); + oops::Variables varList(fullConfig, "variables"); /// Read the determinstic background fv3jedi::State detbkg(geom, varList, cycleDate); @@ -59,10 +60,29 @@ namespace gdasapp { oops::Log::info() << "Determinstic background: " << std::endl << detbkg << std::endl; /// Read the ensemble and get the mean - const eckit::LocalConfiguration ensBkgConfig(fullConfig, "ensemble background"); - /// oops::StateEnsemble ensState(geom, ensBkgConfig); + const eckit::LocalConfiguration ensBkgConfig(fullConfig, "ensemble backgrounds"); + std::vector ensMembers; + int nens = 0; + ensBkgConfig.get("number of members", nens); + std::string pattern; + ensBkgConfig.get("pattern", pattern); + size_t zpad = 0; + ensBkgConfig.get("zero padding", zpad); + eckit::LocalConfiguration ensMemConfig(ensBkgConfig, "template"); + fv3jedi::State ensmean(geom, varList, cycleDate); + ensmean.zero(); + const double rr = 1.0/static_cast(nens); + for (size_t i = 1; i < nens+1; ++i) { + /// replace template as appropriate + if (!pattern.empty()) { + util::seekAndReplace(ensMemConfig, pattern, i, zpad); + } + fv3jedi::State ensmem(geom, varList, cycleDate); + ensmem.read(ensMemConfig); + ensmean.accumul(rr, ensmem); + } - /// oops::Log::info() << "Ensemble mean background: " << std::endl << ensmean << std::endl; + oops::Log::info() << "Ensemble mean background: " << std::endl << ensmean << std::endl; } private: From ee065a52e7d2a9b461f3fc0c7be54a33d4be860c Mon Sep 17 00:00:00 2001 From: CoryMartin-NOAA Date: Thu, 9 May 2024 17:21:11 +0000 Subject: [PATCH 05/10] Looks like it is working --- utils/snow/snow_ensrecenter.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/utils/snow/snow_ensrecenter.h b/utils/snow/snow_ensrecenter.h index 34fe2c596..77e75d115 100644 --- a/utils/snow/snow_ensrecenter.h +++ b/utils/snow/snow_ensrecenter.h @@ -58,6 +58,7 @@ namespace gdasapp { const eckit::LocalConfiguration bkgConfig(fullConfig, "deterministic background"); detbkg.read(bkgConfig); oops::Log::info() << "Determinstic background: " << std::endl << detbkg << std::endl; + oops::Log::info() << "=========================" << std::endl; /// Read the ensemble and get the mean const eckit::LocalConfiguration ensBkgConfig(fullConfig, "ensemble backgrounds"); @@ -81,8 +82,35 @@ namespace gdasapp { ensmem.read(ensMemConfig); ensmean.accumul(rr, ensmem); } - oops::Log::info() << "Ensemble mean background: " << std::endl << ensmean << std::endl; + oops::Log::info() << "=========================" << std::endl; + + /// Read the deterministic increment + fv3jedi::Increment detinc(geom, varList, cycleDate); + const eckit::LocalConfiguration detIncConfig(fullConfig, "deterministic increment"); + detinc.read(detIncConfig); + oops::Log::info() << "Determinstic increment: " << std::endl << detinc << std::endl; + oops::Log::info() << "=========================" << std::endl; + + /// Difference the deterministic and ensemble mean forecasts + fv3jedi::Increment recenter(geom, varList, cycleDate); + recenter.diff(detbkg, ensmean); + oops::Log::info() << "Difference between deterministic and ensemble mean forecasts: " << std::endl << recenter << std::endl; + oops::Log::info() << "=========================" << std::endl; + + /// Add the difference to the deterministic increment + fv3jedi::Increment ensinc(geom, varList, cycleDate); + ensinc.zero(); + ensinc += recenter; + ensinc += detinc; + oops::Log::info() << "Ensemble mean increment: " << std::endl << ensinc << std::endl; + oops::Log::info() << "=========================" << std::endl; + + /// Write out the new ensemble mean increment + const eckit::LocalConfiguration outIncConfig(fullConfig, "output increment"); + ensinc.write(outIncConfig); + + return 0; } private: From 7e5a04d25ff630aff61dcbac334cbe93cb5d0aa6 Mon Sep 17 00:00:00 2001 From: CoryMartin-NOAA Date: Thu, 9 May 2024 17:31:29 +0000 Subject: [PATCH 06/10] Make Norm happy --- utils/snow/snow_ensrecenter.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/snow/snow_ensrecenter.h b/utils/snow/snow_ensrecenter.h index 77e75d115..529efcda6 100644 --- a/utils/snow/snow_ensrecenter.h +++ b/utils/snow/snow_ensrecenter.h @@ -95,7 +95,8 @@ namespace gdasapp { /// Difference the deterministic and ensemble mean forecasts fv3jedi::Increment recenter(geom, varList, cycleDate); recenter.diff(detbkg, ensmean); - oops::Log::info() << "Difference between deterministic and ensemble mean forecasts: " << std::endl << recenter << std::endl; + oops::Log::info() << "Difference between deterministic and ensemble mean forecasts: " + << std::endl << recenter << std::endl; oops::Log::info() << "=========================" << std::endl; /// Add the difference to the deterministic increment @@ -112,8 +113,8 @@ namespace gdasapp { return 0; } - private: + private: // ----------------------------------------------------------------------------- std::string appname() const { return "gdasapp::FV3SnowEnsRecenter"; From bee471b187154a88d824c80610522a7fcf3bad42 Mon Sep 17 00:00:00 2001 From: CoryMartin-NOAA Date: Mon, 13 May 2024 13:13:02 +0000 Subject: [PATCH 07/10] Change from snow to land to be more generic --- utils/CMakeLists.txt | 2 +- utils/land/CMakeLists.txt | 5 +++++ utils/land/land_ensrecenter.cc | 8 ++++++++ .../snow_ensrecenter.h => land/land_ensrecenter.h} | 14 +++++++------- utils/snow/CMakeLists.txt | 5 ----- utils/snow/snow_ensrecenter.cc | 8 -------- 6 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 utils/land/CMakeLists.txt create mode 100644 utils/land/land_ensrecenter.cc rename utils/{snow/snow_ensrecenter.h => land/land_ensrecenter.h} (92%) delete mode 100644 utils/snow/CMakeLists.txt delete mode 100644 utils/snow/snow_ensrecenter.cc diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 7010e1b64..5cef42cad 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -22,4 +22,4 @@ add_subdirectory(test) add_subdirectory(obsproc) add_subdirectory(fv3jedi) add_subdirectory(chem) -add_subdirectory(snow) +add_subdirectory(land) diff --git a/utils/land/CMakeLists.txt b/utils/land/CMakeLists.txt new file mode 100644 index 000000000..cb5295124 --- /dev/null +++ b/utils/land/CMakeLists.txt @@ -0,0 +1,5 @@ +# Ensemble recenter of land +ecbuild_add_executable( TARGET gdasapp_land_ensrecenter.x + SOURCES land_ensrecenter.cc ) +target_compile_features( gdasapp_land_ensrecenter.x PUBLIC cxx_std_17) +target_link_libraries( gdasapp_land_ensrecenter.x PUBLIC NetCDF::NetCDF_CXX oops atlas fv3jedi) diff --git a/utils/land/land_ensrecenter.cc b/utils/land/land_ensrecenter.cc new file mode 100644 index 000000000..02467c836 --- /dev/null +++ b/utils/land/land_ensrecenter.cc @@ -0,0 +1,8 @@ +#include "land_ensrecenter.h" +#include "oops/runs/Run.h" + +int main(int argc, char ** argv) { + oops::Run run(argc, argv); + gdasapp::FV3LandEnsRecenter fv3landensrecenter; + return run.execute(fv3landensrecenter); +} diff --git a/utils/snow/snow_ensrecenter.h b/utils/land/land_ensrecenter.h similarity index 92% rename from utils/snow/snow_ensrecenter.h rename to utils/land/land_ensrecenter.h index 529efcda6..8e7b72639 100644 --- a/utils/snow/snow_ensrecenter.h +++ b/utils/land/land_ensrecenter.h @@ -26,18 +26,18 @@ namespace gdasapp { /** - * FV3SnowEnsRecenter Class Implementation + * FV3LandEnsRecenter Class Implementation * - * Generates an analysis increment for the ensemble forecast of snow + * Generates an analysis increment for the ensemble forecast of land surface vars * based off of the difference between the forecast ensemble mean and the - * deterministic snow forecast plus the analysis increment. + * deterministic land surface forecast plus the analysis increment. */ - class FV3SnowEnsRecenter : public oops::Application { + class FV3LandEnsRecenter : public oops::Application { public: - explicit FV3SnowEnsRecenter(const eckit::mpi::Comm & comm = oops::mpi::world()) + explicit FV3LandEnsRecenter(const eckit::mpi::Comm & comm = oops::mpi::world()) : Application(comm) {} - static const std::string classname() {return "gdasapp::FV3SnowEnsRecenter";} + static const std::string classname() {return "gdasapp::FV3LandEnsRecenter";} int execute(const eckit::Configuration & fullConfig, bool /*validate*/) const { /// Setup the FV3 geometry, we are going to assume that things are on the same grid @@ -117,7 +117,7 @@ namespace gdasapp { private: // ----------------------------------------------------------------------------- std::string appname() const { - return "gdasapp::FV3SnowEnsRecenter"; + return "gdasapp::FV3LandEnsRecenter"; } }; } // namespace gdasapp diff --git a/utils/snow/CMakeLists.txt b/utils/snow/CMakeLists.txt deleted file mode 100644 index 1529a0c86..000000000 --- a/utils/snow/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Ensemble recenter of snow -ecbuild_add_executable( TARGET gdasapp_snow_ensrecenter.x - SOURCES snow_ensrecenter.cc ) -target_compile_features( gdasapp_snow_ensrecenter.x PUBLIC cxx_std_17) -target_link_libraries( gdasapp_snow_ensrecenter.x PUBLIC NetCDF::NetCDF_CXX oops atlas fv3jedi) diff --git a/utils/snow/snow_ensrecenter.cc b/utils/snow/snow_ensrecenter.cc deleted file mode 100644 index 060cc50ca..000000000 --- a/utils/snow/snow_ensrecenter.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "snow_ensrecenter.h" -#include "oops/runs/Run.h" - -int main(int argc, char ** argv) { - oops::Run run(argc, argv); - gdasapp::FV3SnowEnsRecenter fv3snowensrecenter; - return run.execute(fv3snowensrecenter); -} From ca61adc088c4b74a645194ed1b022eef4b151c41 Mon Sep 17 00:00:00 2001 From: CoryMartin-NOAA Date: Mon, 13 May 2024 19:39:16 +0000 Subject: [PATCH 08/10] Add option to mask out increment --- utils/land/land_ensrecenter.h | 39 +++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/utils/land/land_ensrecenter.h b/utils/land/land_ensrecenter.h index 8e7b72639..11c6fd325 100644 --- a/utils/land/land_ensrecenter.h +++ b/utils/land/land_ensrecenter.h @@ -50,12 +50,12 @@ namespace gdasapp { fullConfig.get("date", strdt); util::DateTime cycleDate = util::DateTime(strdt); - /// Get the list of variables to read from the background + /// Get the list of variables to process oops::Variables varList(fullConfig, "variables"); /// Read the determinstic background - fv3jedi::State detbkg(geom, varList, cycleDate); const eckit::LocalConfiguration bkgConfig(fullConfig, "deterministic background"); + fv3jedi::State detbkg(geom, varList, cycleDate); detbkg.read(bkgConfig); oops::Log::info() << "Determinstic background: " << std::endl << detbkg << std::endl; oops::Log::info() << "=========================" << std::endl; @@ -104,10 +104,41 @@ namespace gdasapp { ensinc.zero(); ensinc += recenter; ensinc += detinc; - oops::Log::info() << "Ensemble mean increment: " << std::endl << ensinc << std::endl; - oops::Log::info() << "=========================" << std::endl; + + /// Mask out the increment (if applicable) + if (fullConfig.has("increment mask")) { + /// Get the configuration + const eckit::LocalConfiguration incrMaskConfig(fullConfig, "increment mask"); + std::string maskvarname; + incrMaskConfig.get("variable", maskvarname); + double minvalue = incrMaskConfig.getDouble("minvalue", -9e36); + double maxvalue = incrMaskConfig.getDouble("maxvalue", 9e36); + oops::Variables maskVars(incrMaskConfig, "variable"); + fv3jedi::State maskbkg(geom, maskVars, cycleDate); + maskbkg.read(bkgConfig); + atlas::FieldSet xbFs; + maskbkg.toFieldSet(xbFs); + /// Create the atlas fieldset for the output increment + atlas::FieldSet ensincFs; + ensinc.toFieldSet(ensincFs); + /// Loop over all points, if the mask is in range, zero out the increments + auto bkgMask = atlas::array::make_view(xbFs[maskvarname]); + for (atlas::idx_t jnode = 0; jnode < bkgMask.shape(0); ++jnode) { + if (bkgMask(jnode, 0) > minvalue && bkgMask(jnode, 0) < maxvalue ) { + for (auto & var : varList.variables()){ + auto inc = atlas::array::make_view(ensincFs[var]); + for (atlas::idx_t level = 0; level < ensincFs[var].shape(1); ++level) { + inc(jnode, level) = 0; + } + } + } + } + ensinc.fromFieldSet(ensincFs); + } /// Write out the new ensemble mean increment + oops::Log::info() << "Ensemble mean increment: " << std::endl << ensinc << std::endl; + oops::Log::info() << "=========================" << std::endl; const eckit::LocalConfiguration outIncConfig(fullConfig, "output increment"); ensinc.write(outIncConfig); From f17d6be3ccbdd5b2fe4711edc53c0d2c982642f9 Mon Sep 17 00:00:00 2001 From: CoryMartin-NOAA Date: Wed, 15 May 2024 20:20:14 +0000 Subject: [PATCH 09/10] Address Clara's offline comments/suggestions --- utils/land/land_ensrecenter.h | 40 ++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/utils/land/land_ensrecenter.h b/utils/land/land_ensrecenter.h index 11c6fd325..3aa04477f 100644 --- a/utils/land/land_ensrecenter.h +++ b/utils/land/land_ensrecenter.h @@ -85,20 +85,40 @@ namespace gdasapp { oops::Log::info() << "Ensemble mean background: " << std::endl << ensmean << std::endl; oops::Log::info() << "=========================" << std::endl; - /// Read the deterministic increment + /// Read the deterministic increment (if specified) fv3jedi::Increment detinc(geom, varList, cycleDate); - const eckit::LocalConfiguration detIncConfig(fullConfig, "deterministic increment"); - detinc.read(detIncConfig); + if (fullConfig.has("deterministic increment")) { + const eckit::LocalConfiguration detIncConfig(fullConfig, "deterministic increment"); + detinc.read(detIncConfig); + } else { + detinc.zero(); // assume no increment + } oops::Log::info() << "Determinstic increment: " << std::endl << detinc << std::endl; oops::Log::info() << "=========================" << std::endl; /// Difference the deterministic and ensemble mean forecasts + std::string anchor; + anchor = "deterministic"; + if (fullConfig.has("recenter to")) { + fullConfig.get("recenter to", anchor); + } + if (anchor != "deterministic" && anchor != "ensemble mean") { + throw eckit::BadValue("'recenter to' must be 'deterministic' or 'ensemble mean'"); + } fv3jedi::Increment recenter(geom, varList, cycleDate); - recenter.diff(detbkg, ensmean); - oops::Log::info() << "Difference between deterministic and ensemble mean forecasts: " - << std::endl << recenter << std::endl; - oops::Log::info() << "=========================" << std::endl; - + std::string incrstr; + std::string recenterstr; + if (anchor == "deterministic") { + incrstr = "New ensemble mean increment: "; + recenter.diff(detbkg, ensmean); + recenterstr = "Difference between deterministic and ensemble mean forecasts: "; + } else if (anchor == "ensemble mean") { + incrstr = "New deterministic increment: "; + recenter.diff(ensmean, detbkg); + recenterstr = "Difference between ensemble mean and deterministic forecasts: "; + } + oops::Log::info() << recenterstr << std::endl << recenter << std::endl; + oops::Log::info() << "=========================" << std::endl; /// Add the difference to the deterministic increment fv3jedi::Increment ensinc(geom, varList, cycleDate); ensinc.zero(); @@ -136,8 +156,8 @@ namespace gdasapp { ensinc.fromFieldSet(ensincFs); } - /// Write out the new ensemble mean increment - oops::Log::info() << "Ensemble mean increment: " << std::endl << ensinc << std::endl; + /// Write out the new increment + oops::Log::info() << incrstr << std::endl << ensinc << std::endl; oops::Log::info() << "=========================" << std::endl; const eckit::LocalConfiguration outIncConfig(fullConfig, "output increment"); ensinc.write(outIncConfig); From 8e9fde75de1b2ac051f8d33bdd9ed3905a357c99 Mon Sep 17 00:00:00 2001 From: CoryMartin-NOAA Date: Wed, 15 May 2024 20:23:09 +0000 Subject: [PATCH 10/10] Make norm happy again --- utils/land/land_ensrecenter.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/land/land_ensrecenter.h b/utils/land/land_ensrecenter.h index 3aa04477f..e67358288 100644 --- a/utils/land/land_ensrecenter.h +++ b/utils/land/land_ensrecenter.h @@ -91,7 +91,7 @@ namespace gdasapp { const eckit::LocalConfiguration detIncConfig(fullConfig, "deterministic increment"); detinc.read(detIncConfig); } else { - detinc.zero(); // assume no increment + detinc.zero(); // assume no increment } oops::Log::info() << "Determinstic increment: " << std::endl << detinc << std::endl; oops::Log::info() << "=========================" << std::endl; @@ -118,7 +118,7 @@ namespace gdasapp { recenterstr = "Difference between ensemble mean and deterministic forecasts: "; } oops::Log::info() << recenterstr << std::endl << recenter << std::endl; - oops::Log::info() << "=========================" << std::endl; + oops::Log::info() << "=========================" << std::endl; /// Add the difference to the deterministic increment fv3jedi::Increment ensinc(geom, varList, cycleDate); ensinc.zero(); @@ -144,12 +144,12 @@ namespace gdasapp { /// Loop over all points, if the mask is in range, zero out the increments auto bkgMask = atlas::array::make_view(xbFs[maskvarname]); for (atlas::idx_t jnode = 0; jnode < bkgMask.shape(0); ++jnode) { - if (bkgMask(jnode, 0) > minvalue && bkgMask(jnode, 0) < maxvalue ) { - for (auto & var : varList.variables()){ + if (bkgMask(jnode, 0) > minvalue && bkgMask(jnode, 0) < maxvalue) { + for (auto & var : varList.variables()) { auto inc = atlas::array::make_view(ensincFs[var]); for (atlas::idx_t level = 0; level < ensincFs[var].shape(1); ++level) { inc(jnode, level) = 0; - } + } } } }