Skip to content

Commit

Permalink
chg res for ice pert
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Jan 15, 2025
1 parent 5ece15f commit 7c2a3c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
34 changes: 19 additions & 15 deletions utils/soca/gdas_postprocincr.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,23 @@ class PostProcIncr {
// 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);
outputFileName = this->swapPattern(outputFileName, pattern, std::to_string(ensMem));
}
const char* charPtrOut = outputFileName.c_str();

std::string incrFname = this->socaFname();
const char* charPtr = incrFname.c_str();

oops::Log::info() << "rename: " << incrFname << " to " << outputFileName << std::endl;
result = std::rename(charPtr, charPtrOut);

for (const std::string& domain : {"ocn", "ice"}) {
std::string outputDomain = dataDir + "/" + domain + "." +outputFileName;
if (outputIncrConfig_.has("pattern")) {
std::string pattern;
outputIncrConfig_.get("pattern", pattern);
outputDomain = this->swapPattern(outputDomain, pattern, std::to_string(ensMem));
}
const char* charPtrOut = outputDomain.c_str();

// rename the file
std::string incrFname = this->socaFname(domain);
const char* charPtr = incrFname.c_str();
oops::Log::info() << "domain: " << domain <<" rename: "
<< incrFname << " to " << outputDomain << std::endl;
result += std::rename(charPtr, charPtrOut);
}
}
return result;
}
Expand Down Expand Up @@ -291,7 +295,7 @@ class PostProcIncr {
// Recreate the soca filename from the configuration
// TODO(guillaume): Change this in soca?
// TODO(guillaume): Hard-coded for ocean, implement for seaice as well
std::string socaFname() {
std::string socaFname(const std::string& domain = "ocn") {
std::string datadir;
outputIncrConfig_.get("datadir", datadir);
std::experimental::filesystem::path pathToResolve(datadir);
Expand All @@ -300,7 +304,7 @@ class PostProcIncr {
std::string outputType;
outputIncrConfig_.get("type", outputType);
std::string incrFname = std::experimental::filesystem::canonical(pathToResolve);
incrFname += "/ocn." + exp + "." + outputType + "." + dt_.toString() + ".nc";
incrFname += "/" + domain + "." + exp + "." + outputType + "." + dt_.toString() + ".nc";

return incrFname;
}
Expand Down
2 changes: 1 addition & 1 deletion utils/soca/gdas_socahybridweights.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace gdasapp {
/// Create fields of weights for seaice
soca::Increment socaIceHW(geom, socaVars, dt); // ocean field is mandatory for writting
socaIceHW.ones();
// TODO: set the weights based on the ice extent
// TODO(Guillaume): set the weights based on the ice extent
socaIceHW *= wIce;
oops::Log::info() << "socaIceHW: " << std::endl << socaIceHW << std::endl;
const eckit::LocalConfiguration socaHWOutConfig(fullConfig, "output");
Expand Down

0 comments on commit 7c2a3c8

Please sign in to comment.