-
Notifications
You must be signed in to change notification settings - Fork 52
Design Document: reorganizing timekeeping #103
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
Design Document: reorganizing timekeeping #103
Conversation
design_docs/timekeeping_reorg.md
Outdated
date: 2017/02/06 <br> | ||
</h1> | ||
<h2> Summary </h2> | ||
Currently, a the `Date` class is used to parse a date object from a date string |
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.
small typo: a the
design_docs/timekeeping_reorg.md
Outdated
date formats: date strings, days since a reference date, `datetime.datetime` objects | ||
and `relativedelta` objects (see below). The success of this reorganization will be | ||
demonstrated when the existing analysis can be performed successfully with the new | ||
utility functions with both the `'gregorian_noleap'` calendar used by most existing |
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.
Does it make sense to call the noleap calendar 'gregorian_noleap'? I would personally be in favor of 'gregorian' versus simply 'noleap' (or no_leap, or perhaps '365_noleap').
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.
@milenaveneziani, these are the names used in MPAS cores. I am sticking with those names unless there's a compelling reason to change.
design_docs/timekeeping_reorg.md
Outdated
</h2> | ||
|
||
There must be a way to parse dates from MPAS that is aware of the appropriate calendar to | ||
use, either `'gregorian'` or `'gregorian_noleap'`. |
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.
By this you mean that there should be a CF compliant time variable in MPAS files that tells us what calendar was used?
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.
No, I mean there should be a way to use the namelist option config_calendar_type
to determine which calendar is correct, and then to parse date strings accordingly. I will clarify.
design_docs/timekeeping_reorg.md
Outdated
|
||
As long as `relativedelta` objects rather than `datetime.timedelta` objects are used to increment | ||
`datetime.datetime` objects, `datetime.datetime` can be used to represent dates on either the Gregorian | ||
or the 365-day clanedars. |
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.
small typo here.
design_docs/timekeeping_reorg.md
Outdated
</h2> | ||
Analysis will be run on Edison with all available configurations found in `configs/edison`. In addion, | ||
a test ACME run will be performed on LANL IC with the `gregorian` calendar option, and this will be | ||
used to test the analysis with the alternative calendar. |
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 do not think we currently have an MPAS or ACME run that uses the gregorian calendar. I am pretty sure that for now we are only using the 365_noleap.
We should find out what is the plan for future simulations.
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.
A google search revealed that CESM 1.2 supports both noleap and gregorian calendars:
CESM supports a 365 day (or no-leap) calendar as well as a gregorian calendar. The calendar is set by the xml variable, CALENDAR, in env_build.xml. The no-leap calendar has the standard 12 months, but it has 365 days every year and 28 days in every February. Monthly averages in CESM are truly computed over varying number of days depending on the month of the year. In CESM1.0.x, a gregorian calendar was only possible if the ESMF library was used. This is no longer the case in CESM1.1.x and CESM1.2.x.
But I suspect that in our previous CESM-based simulations we always used noleap.
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.
@milenaveneziani, that is why I was proposing to perform a new ACME simulation with gregorain
.
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 see, sorry for not reading your text more carefully.
I didn't know that we already have those two calendar options in MPAS (I've been meaning to look at the code today, but seems all LCFs as well as LANL IC have conjured on system maintenance for this day..).
It will be interesting to see how things go when choosing the gregorian calendar.
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.
@xylar: I talked with a few people about this and also brought up the subject at the MPAS meeting today, and, contrary to what I thought initially, there is a general agreement that we are not going to use the gregorian calendar in MPAS or ACME simulations. Even for transient simulations, CESM has always used the noleap calendar (the transient forcing just does not have anything for the Feb 29's). So, I would say it is good if we support both (as MPAS and ACME/CESM do), but we probably do not want to invest time on running additional testing.
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.
Okay, great! That saves me some time. I'll update the testing plan accordingly.
</h2> | ||
Analysis will be run on Edison with all available configurations found in `configs/edison`. As there | ||
are currently no plans to run with the `gregorian` calendar option, we do not have test runs that use this | ||
calendar. If this situation changes in the future, we'll test at that time. |
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.
Shouldn't we still test functionality via py.test, even if it isn't fully in use? Otherwise, we could argue we don't need to fully flesh out the option that is neither tested nor used.
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.
Yes, and I'm doing that although I don't have any tests that specifically test the gregorian vs. the gregorian_noleap calendars. Do you have a suggestion? Maybe I should try to add one day to 2016-02-28 and see what I get?
design_docs/timekeeping_reorg.md
Outdated
calendar. If this situation changes in the future, we'll test at that time. | ||
|
||
Regression tests previously for `Date` has been modified to test the new utility functions. | ||
|
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'm confused, are we or are not testing the gregorian
calendar option?
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.
No, we are not, because we are not likely to use it in ACME or MPAS in the near (or not-so-near) future. See my last comment after you click on View changes (or however you do to pull out previous review comments..).
@xylar, this looks good to me except for my concern about not testing implemented functionality. |
@pwolfram, I have tested both calendars in the CI but I don't have a run with |
@pwolfram, damn! Good thing you made me add more testing! I'll play with it some more tomorrow. |
After adding CI, I discovered that @pwolfram, I realize you prefer that we use existing libraries wherever possible but I hope this compromise (building on top of an existing library but adding functionality to address our needs) works for you. |
@xylar, this type of thing will be unavoidable given the absolute and persistent confusion regarding how dates should be handled through and across multiple libraries. I fully agree a solution, as long as it is as compact as possible, is what we need even if it strictly isn't clean. There really don't appear to be any clean solutions in this space and top experts in this area essentially say things along the lines of "extensive numpy / scipy / pandas / xarray refractoring and development is needed", which implies we need some type of custom solution like you are proposing. |
I should also note that we would have eventually run into calendar problems ourselves as pointed out in the MPAS-O meeting last week by @maltrud, even if we restricted ourselves to the minimal matlab-equivalent python stack of numpy / matplotlib. |
bf02909
to
8a38f08
Compare
I have squashed commits and I think this is ready to merge. @milenaveneziani, would you do the honors? |
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.
LGTM, I'm happy to merge this before / after #102 although technically I think we should merge the design docs before the code that implements them.
Thanks @milenaveneziani @pwolfram wrote:
I suppose that's true. My thinking was that you might not be sure you're done making changes to the design document (e.g. details of testing or implementation) until you've merged the branch. But essentially both should happen simultaneously. |
A design document for reorganizing the timekeeping module.