-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ee6c2d
commit 1d06644
Showing
9 changed files
with
178 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
geometry: | ||
mom6_input_nml: mom_input.nml | ||
fields metadata: ./fields_metadata.yaml | ||
|
||
date: '{{ATM_WINDOW_MIDDLE}}' | ||
|
||
variables: | ||
ice: [cicen, hicen, hsnon] | ||
ocean: [tocn, socn, uocn, vocn, ssh] | ||
|
||
background: | ||
date: '{{ATM_WINDOW_BEGIN}}' | ||
basename: ./INPUT/ | ||
ocn_filename: MOM.res.nc | ||
ice_filename: cice.res.nc | ||
read_from_file: 1 | ||
|
||
weights: | ||
ice: 0.1 | ||
ocean: 0.5 | ||
|
||
output: | ||
datadir: ./ | ||
date: '{{ATM_WINDOW_MIDDLE}}' | ||
exp: ens_weights | ||
type: incr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
geometry: | ||
mom6_input_nml: mom_input.nml | ||
fields metadata: ./fields_metadata.yaml | ||
|
||
date: 2018-04-15T09:00:00Z | ||
|
||
variables: | ||
ice: [cicen, hicen, hsnon] | ||
ocean: [tocn, socn, uocn, vocn, ssh] | ||
|
||
background: | ||
date: '2018-04-15T09:00:00Z' | ||
basename: ./INPUT/ | ||
ocn_filename: MOM.res.nc | ||
ice_filename: cice.res.nc | ||
read_from_file: 1 | ||
|
||
weights: | ||
ice: 0.1 | ||
ocean: 0.5 | ||
|
||
output: | ||
datadir: ./ | ||
date: '2018-04-15T12:00:00Z' | ||
exp: hybrid_weights | ||
type: incr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "socahybridweights.h" | ||
#include "oops/runs/Run.h" | ||
|
||
int main(int argc, char ** argv) { | ||
oops::Run run(argc, argv); | ||
gdasapp::SocaHybridWeights socahybridweights; | ||
return run.execute(socahybridweights); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#include <netcdf> | ||
#include <iostream> | ||
#include <filesystem> | ||
|
||
#include "eckit/config/LocalConfiguration.h" | ||
|
||
#include "atlas/field.h" | ||
|
||
#include "oops/base/PostProcessor.h" | ||
#include "oops/mpi/mpi.h" | ||
#include "oops/runs/Application.h" | ||
#include "oops/util/DateTime.h" | ||
#include "oops/util/Duration.h" | ||
#include "oops/util/Logger.h" | ||
|
||
#include "soca/State/State.h" | ||
#include "soca/Geometry/Geometry.h" | ||
#include "soca/Increment/Increment.h" | ||
|
||
namespace gdasapp { | ||
|
||
class SocaHybridWeights : public oops::Application { | ||
public: | ||
explicit SocaHybridWeights(const eckit::mpi::Comm & comm = oops::mpi::world()) | ||
: Application(comm) {} | ||
static const std::string classname() {return "gdasapp::SocaHybridWeights";} | ||
|
||
int execute(const eckit::Configuration & fullConfig, bool /*validate*/) const { | ||
|
||
/// Setup the soca geometry | ||
const eckit::LocalConfiguration geomConfig(fullConfig, "geometry"); | ||
oops::Log::info() << "geometry: " << std::endl << geomConfig << std::endl; | ||
const soca::Geometry geom(geomConfig, this->getComm()); | ||
|
||
/// Get the date | ||
std::string strdt; | ||
fullConfig.get("date", strdt); | ||
util::DateTime dt = util::DateTime(strdt); | ||
|
||
/// Get the list of variables | ||
oops::Variables socaOcnVars(fullConfig, "variables.ocean"); | ||
oops::Variables socaIceVars(fullConfig, "variables.ice"); | ||
oops::Variables socaVars(socaIceVars); | ||
socaVars += socaOcnVars; | ||
|
||
/// Read the background | ||
// TODO: Use the ice extent to set the weights ... no clue if this is | ||
// possible at this level | ||
soca::State socaBkg(geom, socaVars, dt); | ||
const eckit::LocalConfiguration socaBkgConfig(fullConfig, "background"); | ||
socaBkg.read(socaBkgConfig); | ||
oops::Log::info() << "socaBkg: " << std::endl << socaBkg << std::endl; | ||
|
||
/// Read weights | ||
const eckit::LocalConfiguration socaHWConfig(fullConfig, "weights"); | ||
double wIce = socaHWConfig.getDouble("ice"); | ||
double wOcean = socaHWConfig.getDouble("ocean"); | ||
oops::Log::info() << "wIce: " << wIce << std::endl; | ||
oops::Log::info() << "wOcean: " << wOcean << std::endl; | ||
|
||
/// Create fields of weights for seaice | ||
soca::Increment socaIceHW(geom, socaVars, dt); // ocean field is mandatory for writting | ||
socaIceHW.ones(); | ||
socaIceHW *= wIce; | ||
oops::Log::info() << "socaIceHW: " << std::endl << socaIceHW << std::endl; | ||
const eckit::LocalConfiguration socaHWOutConfig(fullConfig, "output"); | ||
socaIceHW.write(socaHWOutConfig); | ||
|
||
/// Create fields of weights for the ocean | ||
soca::Increment socaOcnHW(geom, socaOcnVars, dt); | ||
socaOcnHW.ones(); | ||
socaOcnHW *= wOcean; | ||
oops::Log::info() << "socaOcnHW: " << std::endl << socaOcnHW << std::endl; | ||
socaOcnHW.write(socaHWOutConfig); | ||
|
||
return 0; | ||
} | ||
// ----------------------------------------------------------------------------- | ||
private: | ||
std::string appname() const { | ||
return "gdasapp::SocaHybridWeights"; | ||
} | ||
// ----------------------------------------------------------------------------- | ||
}; | ||
|
||
} // namespace gdasapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters