Skip to content

Commit

Permalink
Redo some things
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidNew-NOAA committed Jan 22, 2025
1 parent 42f2113 commit 0d2659a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
2 changes: 1 addition & 1 deletion sorc/oops
Submodule oops updated from d829ed to d5cdcd
32 changes: 9 additions & 23 deletions utils/fv3jedi/fv3jedi_ecen.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

#include "eckit/config/LocalConfiguration.h"

//#include "fv3jedi/Geometry/Geometry.h"
//#include "fv3jedi/Increment/Increment.h"
//#include "fv3jedi/State/State.h"

#include "fv3jedi/Utilities/Traits.h"

#include "oops/mpi/mpi.h"
Expand All @@ -37,9 +33,7 @@ namespace gdasapp {
fullConfig.get("forecast hours", fcstHours);
fullConfig.get("window begin", windowBeginStr);
const util::DateTime windowBegin(windowBeginStr);
const oops::Variables atmStateVars(fullConfig, "atmospheric state variables");
const oops::Variables sfcStateVars(fullConfig, "surface state variables");
const oops::Variables atmIncrVars(fullConfig, "atmospheric increment variables");
const oops::Variables atmVars(fullConfig, "atmospheric variables");

// Get geometry configurations
const eckit::LocalConfiguration bkgGeomConfig(fullConfig, "background geometry");
Expand Down Expand Up @@ -78,51 +72,43 @@ namespace gdasapp {

// Get elements of individual additions configurations
const eckit::LocalConfiguration atmBkgConfig(additionsConfig[ihrs], "atmospheric background");
const eckit::LocalConfiguration sfcBkgConfig(additionsConfig[ihrs], "surface background");
const eckit::LocalConfiguration atmIncrConfig(additionsConfig[ihrs], "atmospheric increment");
const eckit::LocalConfiguration atmIncrConfig(additionsConfig[ihrs], "atmospheric increment variables");
const eckit::LocalConfiguration atmAnlEnsMeanConfig(additionsConfig[ihrs], \
"atmospheric ensemble mean analysis");
const eckit::LocalConfiguration atmIncrCorConfig(additionsConfig[ihrs], \
"atmospheric correction increment");
const eckit::LocalConfiguration atmAnlConfig(additionsConfig[ihrs], \
"atmospheric analysis to structured grid");
const eckit::LocalConfiguration sfcAnlConfig(additionsConfig[ihrs], \
"surface analysis to structured grid");
"atmospheric increment to structured grid");

// Initialize background states
oops::State<fv3jedi::Traits> xxAtmBkg(bkgGeom, atmStateVars, currentCycle);
oops::State<fv3jedi::Traits> xxSfcBkg(bkgGeom, sfcStateVars, currentCycle);
oops::State<fv3jedi::Traits> xxAtmBkg(bkgGeom, atmVars, currentCycle);
xxAtmBkg.read(atmBkgConfig);
xxSfcBkg.read(sfcBkgConfig);

// Initialize increments
oops::Increment<fv3jedi::Traits> dxAtm(incrGeom, atmIncrVars, currentCycle);
oops::Increment<fv3jedi::Traits> dxAtm(incrGeom, atmVars, currentCycle);
dxAtm.read(atmIncrConfig);

// Initialize ensemble mean analyses
oops::State<fv3jedi::Traits> xxAtmAnlEnsMean(anlEnsMeanGeom, atmIncrVars, currentCycle);
oops::State<fv3jedi::Traits> xxAtmAnlEnsMean(anlEnsMeanGeom, atmVars, currentCycle);
xxAtmAnlEnsMean.read(atmAnlEnsMeanConfig);

// Compute analyses
oops::State<fv3jedi::Traits> xxAtmAnl(bkgGeom, xxAtmBkg);
oops::State<fv3jedi::Traits> xxSfcAnl(bkgGeom, xxSfcBkg);
xxAtmAnl += dxAtm;

// Interpolate full resolution analyses to ensemble resolution and then change variables
oops::State<fv3jedi::Traits> xxAtmAnlEnsRes(incrCorGeom, oops::State<fv3jedi::Traits>(atmIncrVars, xxAtmAnl));
oops::State<fv3jedi::Traits> xxAtmAnlEnsRes(incrCorGeom, oops::State<fv3jedi::Traits>(atmVars, xxAtmAnl));

// Compute correction increments
oops::Increment<fv3jedi::Traits> dxAtmCor(incrCorGeom, atmIncrVars, xxAtmBkg.validTime());
oops::Increment<fv3jedi::Traits> dxAtmCor(incrCorGeom, atmVars, xxAtmBkg.validTime());
dxAtmCor.diff(xxAtmAnlEnsMean, xxAtmAnlEnsRes);

// Write correction increment
dxAtmCor.write(atmIncrCorConfig);

// Write analyses
const oops::StructuredGridWriter<fv3jedi::Traits> atmGridWriter(atmAnlConfig, bkgGeom);
const oops::StructuredGridWriter<fv3jedi::Traits> sfcGridWriter(sfcAnlConfig, bkgGeom);
atmGridWriter.interpolateAndWrite(xxAtmAnl);
sfcGridWriter.interpolateAndWrite(xxSfcAnl);
atmGridWriter.interpolateAndWrite(dxAtm);
}

return 0;
Expand Down

0 comments on commit 0d2659a

Please sign in to comment.