`'has_year_zero'` differences for "months/years since ..." units
A pull request for this has already been merged.
- #548 by @davidhassell — merged
- Dominant language
- Python
- Stars
- 150
- Forks
- 23
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 2
Description
Specifying units of "months since <a date>" or "years since <a date>" (and possibly other options too) in certain calendars can lead to datetime results with the has_year_zero property set to True (e.g. cftime.Datetime360Day(2000, 3, 1, 20, 58, 7, 662446, has_year_zero=True)). However it is not clear how we can specify an equivalent datetime result directly in cf, without having to import cftime separately.
While the underlying issue is whether or not the 'has_year_zero' property is somehow, and should be, exposed to the API, there is also the potential for inconsistency that might have arose in cf due to the change in default value this at cftime version 1.5.1 (see the relevant changelog entries)
Such a default change seems to have caused inconsistencies in the expected and actual outputs from test_Data_months_years, hence I have added a skip until we can investigate this, which for lack of viewable permalink (due to not being master code) provides the summary of:
@unittest.skipIf(
True,
"Failing due to 'has_year_zero' differences in actual and expected "
"outputs: relates to github.com/Unidata/cftime/issues/233, see also "
"NCAS-CMS/cfunits/commit/ca15e7f6db76fe613db740993b4e45115341d865.",
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test/test_Data.py around the skipped test_Data_months_years case and review the linked cftime changelog entries and cftime issue 233. Investigate how has_year_zero affects actual and expected outputs, then resolve the inconsistency and determine how an equivalent datetime should be specified through cf without a separate cftime import.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100