-
Notifications
You must be signed in to change notification settings - Fork 13
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
Allow timestep to be set when XIOS handler is created #750
Conversation
core/src/Xios.cpp
Outdated
// Set default calendar origin and start // TODO: Pick something sensible | ||
setCalendarOrigin(TimePoint("2020-01-23T00:08:15Z")); | ||
setCalendarStart(TimePoint("2023-03-17T17:11:00Z")); |
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.
Any thoughts on suitable default calendar origin and start times?
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 guess the start will be read from the config file.
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 time classes in the rest of nextSIM use the Unix epoch as their calendar origin.
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, now addressed in 542da5b.
core/src/include/Xios.hpp
Outdated
std::string _calendarType; | ||
std::string _contextId; | ||
Duration _timestep; |
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.
Unless this is an XIOS convention, I'd discourage leading underscores in nextSIM code, since we generally try to align with the WebKit coding standard (albeit imperfectly).
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.
Sure, addressed in 197d747.
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.
Some suggested changes.
core/test/XiosCalendar_test.cpp
Outdated
REQUIRE(xios_handler.getCalendarTimestep().seconds() == doctest::Approx(3600.0)); // Default | ||
Duration timestep("P0-0T01:30:00"); | ||
REQUIRE(timestep.seconds() == doctest::Approx(5400.0)); |
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 know that testing floating point values can be imprecise, but I'd suggest that if we don't get back the exact integer values of 3600 and 5400, that should also be a test failure.
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.
Good point - fixed in 2eec43f.
I also provided the option to set the calendar start upon creating an |
10e4955
to
d5b28d0
Compare
@timspainNERSC please could you re-review this? I think I addressed all your concerns. |
.pre-commit
Outdated
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.
Do we want to merge these changes as part of this PR, rather than in a separate PR?
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'd figured it was a very small change so didn't know if it warranted it's own PR. But yeah, it'd be better practice to put it in a separate PR. I'll do that now.
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.
All looks good. But just make sure that the changes to .per-commit
are best added as part of this PR.
Thanks @timspainNERSC! |
0eae60a
to
cd35f66
Compare
Refinement of #751
Allow timestep to be set when XIOS handler is created
This PR makes a few minor modifications to the
Xios
handler object:Xios
instance.These steps should make it easier to set up XIOS and reduce the amount of additional boilerplate when using it to drive I/O rather than the existing approach.