-
Notifications
You must be signed in to change notification settings - Fork 19
XIOS implementation of readForcingTimeStatic
#928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// TODO: Avoid making configGetForcingFieldNames public? | ||
auto forcingFieldNames = xiosHandler.configGetForcingFieldNames(); | ||
for (int ts = 1; ts <= 4; ts++) { | ||
|
||
// Read forcings from file and check they take the expected values | ||
TimePoint time = xiosHandler.getCurrentDate(); | ||
ModelState forcings = pio->readForcingTimeStatic(forcingFieldNames, time, filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the configGetXFieldNames
member functions are private. I couldn't see a way to keep this one private while maintaining the interface to readForcingTimeStatic
that accepts the set of forcing field names as its first argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's currently unnecessary to run these tests in both the MPI and XIOS test workflows.
a506306
to
116506e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jwallwork23 looks good to me
// ASSUME all forcings are HFields: finite volume fields on the same | ||
// grid as ice thickness | ||
std::vector<size_t> indexArray = { targetTIndex }; | ||
std::vector<size_t> extentArray = { 1 }; | ||
|
||
// Loop over the dimensions of H | ||
const std::vector<ModelArray::Dimension>& dimensions | ||
= ModelArray::typeDimensions.at(ModelArray::Type::H); | ||
for (auto riter = dimensions.rbegin(); riter != dimensions.rend(); ++riter) { | ||
indexArray.push_back(0); | ||
extentArray.push_back(ModelArray::definedDimensions.at(*riter).localLength); | ||
} | ||
|
||
for (const std::string& varName : forcings) { | ||
netCDF::NcVar var = ncFile.getVar(varName); | ||
state.data[varName] = ModelArray(ModelArray::Type::H); | ||
ModelArray& data = state.data.at(varName); | ||
data.resize(); | ||
HField field(ModelArray::Type::H); | ||
field.resize(); | ||
state.merge(ModelState { { { fieldId, field } }, {} }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this is just for the Forcing file and not restart currently. Just to make a note for future, that Restart files also need to support CGFields
(AFAIK anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, assuming the XIOS things work as they are supposed to :)
XIOS implementation of
readForcingTimeStatic
Fixes #916
Task List
Change Description
This PR provides an XIOS implementation of the
readForcingTimeStatic
function. Doing so requires introducing a newXiosForcing
category to account for forcings as well as restarts.This PR works under the assumption that the forcings data are found in the same input file used for restarts. I plan to account for separate forcings and restart files when addressing #929.
Other changes to facilitate the implementation:
getCurrentDate
to return aTimePoint
rather than string.configGetFieldNames
for the different categories (input, output, forcing).Test Description
Tests for reading forcings have been added into the existing
XiosRead_test
.Documentation Impact
The XIOS section of the documentation is updated to mention the new
XiosForcing
section.Pre-Request Checklist