Skip to content

Commit

Permalink
Push TODOs to ParaGrid_Xios out of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jwallwork23 committed Oct 31, 2024
1 parent f12dac5 commit 4764a8e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
8 changes: 8 additions & 0 deletions core/src/ParaGridIO_Xios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ ModelState ParaGridIO::getModelState(const std::string& filePath, ModelMetadata&
#endif
}

ModelState ParaGridIO::readForcingTimeStatic(
const std::set<std::string>& forcings, const TimePoint& time, const std::string& filePath)
{
ModelState state;
throw std::runtime_error("XIOS implementation of readForcingTimeStatic incomplete"); // TODO-JGW
return state;
}

/*!
* @brief Writes the ModelState to a given file location from the provided
* model data and metadata.
Expand Down
3 changes: 3 additions & 0 deletions core/src/include/ParaGridIO_Xios.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class ParaGridIO : public ParametricGrid::IParaGridIO {
*/
void writeDiagnosticTime(
const ModelState& state, const ModelMetadata& meta, const std::string& filePath) override;

static ModelState readForcingTimeStatic(
const std::set<std::string>& forcings, const TimePoint& time, const std::string& filePath);
};
} /* namespace Nextsim */

Expand Down
6 changes: 3 additions & 3 deletions core/test/ConfigOutput_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* @file ConfigOutput_test.cpp
*
* @date 24 Sep 2024
* @date 31 Oct 2024
* @author Tim Spain <[email protected]>
*/

Expand All @@ -21,8 +21,8 @@
#include "include/ModelComponent.hpp"
#include "include/ModelMetadata.hpp"
#include "include/ModelState.hpp"
#include "include/NextsimModule.hpp"
#include "include/NZLevels.hpp"
#include "include/NextsimModule.hpp"
#include "include/gridNames.hpp"

#include <ncDim.h>
Expand Down Expand Up @@ -144,7 +144,7 @@ TEST_CASE("Test periodic output")
hsnow += hourIncr;
ModelState state;

ido.outputState(meta);
ido.outputState(meta); // FIXME-JGW: XIOS impl fails here
meta.incrementTime(Duration(3600.));
}
}
Expand Down
10 changes: 4 additions & 6 deletions core/test/ParaGrid_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ TEST_CASE("Write and read a ModelState-based ParaGrid restart file")
#ifdef USE_MPI
ModelMetadata metadataIn(partitionFilename, test_comm);
metadataIn.setTime(TimePoint(dateString));
ModelState ms = gridIn.getModelState(filename, metadataIn);
ModelState ms = gridIn.getModelState(filename, metadataIn); // FIXME-JGW: XIOS impl fails here
#else
ModelState ms = gridIn.getModelState(filename);
#endif
Expand Down Expand Up @@ -520,14 +520,11 @@ TEST_CASE("Test array ordering")
std::set<std::string> fields = { fieldName };
TimePoint time;

#ifdef USE_XIOS
throw std::runtime_error("XIOS implementation incomplete"); // TODO-JGW
#else
// FIXME-JGW: XIOS impl fails here
ModelState state = ParaGridIO::readForcingTimeStatic(fields, time, inputFilename);
REQUIRE(state.data.count(fieldName) > 0);
index2d = state.data.at(fieldName);
REQUIRE(index2d(3, 5) == 35);
#endif
}

#ifdef USE_MPI
Expand Down Expand Up @@ -610,7 +607,8 @@ TEST_CASE("Check if a file with the old dimension names can be read")
metadata.localExtentX = 1;
metadata.localExtentY = ny;
metadata.setTime(TimePoint(dateString));
ModelState ms = gridIn.getModelState(inputFilename, metadata);
ModelState ms
= gridIn.getModelState(inputFilename, metadata); // FIXME-JGW: XIOS impl fails here
#else
ModelState ms = gridIn.getModelState(inputFilename);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ void ERA5Atmosphere::update(const TimestepTime& tst)
std::set<std::string> forcings
= { "tair", "dew2m", "pair", "sw_in", "lw_in", "wind_speed", "u", "v" };

#ifdef USE_XIOS
throw std::runtime_error("XIOS implementation incomplete"); // TODO-JGW
#else
ModelState state = ParaGridIO::readForcingTimeStatic(forcings, tst.start, filePath);
tair = state.data.at("tair");
tdew = state.data.at("dew2m");
Expand All @@ -80,7 +77,6 @@ void ERA5Atmosphere::update(const TimestepTime& tst)
emp = 0; // FIXME get E - P data

fluxImpl->update(tst);
#endif
}

void ERA5Atmosphere::setFilePath(const std::string& filePathIn) { filePath = filePathIn; }
Expand Down
4 changes: 0 additions & 4 deletions physics/src/modules/OceanBoundaryModule/TOPAZOcean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ void TOPAZOcean::updateBefore(const TimestepTime& tst)
// TODO: Get more authoritative names for the forcings
std::set<std::string> forcings = { "sst", "sss", "mld", "u", "v" };

#ifdef USE_XIOS
throw std::runtime_error("XIOS implementation incomplete"); // TODO-JGW
#else
ModelState state = ParaGridIO::readForcingTimeStatic(forcings, tst.start, filePath);
sstExt = state.data.at("sst");
sssExt = state.data.at("sss");
Expand All @@ -79,7 +76,6 @@ void TOPAZOcean::updateBefore(const TimestepTime& tst)
TimestepTime());

Module::getImplementation<IIceOceanHeatFlux>().update(tst);
#endif
}

void TOPAZOcean::updateAfter(const TimestepTime& tst)
Expand Down

0 comments on commit 4764a8e

Please sign in to comment.