Skip to content
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

Adapt to CF conventions 1.9 - remove gregorian calendar #935

Merged
merged 7 commits into from
Nov 25, 2021

Conversation

aulemahal
Copy link
Collaborator

@aulemahal aulemahal commented Nov 25, 2021

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • Tests for the changes have been added (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • HISTORY.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added.
  • bumpversion patch has been called on this branch
  • The relevant author information has been added to .zenodo.json

What kind of change does this PR introduce?

  • Deprecates the calendar name "gregorian". Uses "standard" instead, as stated in the version 1.9 of the CF conventions (Sept 2021). In this we simply follow cftime that made this change yesterday (address deprecation of calendar='gregorian' in CF v1.9 (issue #256) Unidata/cftime#257).
  • Changes to get_calendar and ensure_ctime_array to fix a bug I saw while making this change. Both were failing in some edgecases involving xr.CFTimeIndex objects.

Does this PR introduce a breaking change?

Yes, get_calendar will never return "gregorian", but "standard".

@aulemahal aulemahal requested a review from Zeitsperre November 25, 2021 21:15
Comment on lines +88 to +89
if obj.calendar == "gregorian":
return "standard"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this comment is out of scope, but would we want to emit a warning here about this change of calendar? I don't think we specify any output Conventions to our datasets. Should we be appending this information to our output Datasets?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do not add this attribute, simply because we don't output Datasets. If we ever do, than I guess we could append the info. And if we do, we'll have to be even more careful about this kind of change.

It's a good question. But I believe that this change doesn't need a warning :

  1. CF conventions have always accepted "standard" as equivalent to "gregorian", they just dropped the latter recently.
  2. Code might "break", but only with cftime <= 1.5.1. For people using the forthcoming cftime 1.5.2, this break will be generalized and we will be able to shift responsability to them ;).

Copy link
Collaborator

@Zeitsperre Zeitsperre Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case, is this an event where we should bump the required version of CFtime within xclim?

EDIT: the new CFtime isn't released yet. Never mind for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not released yet! That bug was found because of our smart tox builds using the master!

@coveralls
Copy link

coveralls commented Nov 25, 2021

Pull Request Test Coverage Report for Build 1505393848

  • 13 of 13 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.007%) to 90.264%

Files with Coverage Reduction New Missed Lines %
xclim/core/calendar.py 1 95.55%
Totals Coverage Status
Change from base Build 1482118663: 0.007%
Covered Lines: 12664
Relevant Lines: 14030

💛 - Coveralls

@Zeitsperre Zeitsperre mentioned this pull request Nov 25, 2021
7 tasks
@Zeitsperre Zeitsperre added enhancement New feature or request standards / conventions Suggestions on ways forward labels Nov 25, 2021
@Zeitsperre Zeitsperre added this to the v0.32 milestone Nov 25, 2021
@aulemahal aulemahal merged commit b1be4ad into master Nov 25, 2021
@aulemahal aulemahal deleted the fix-for-CF1.9 branch November 25, 2021 22:37
raquelalegre added a commit to UCL/xclim that referenced this pull request Nov 30, 2021
…s/heat_index

* 'indices/heat_index' of github.com:UCL/xclim: (42 commits)
  Added french metadata for heat index.
  Apply changes to fraction indicator
  [sdba] Re-write of Extreme's adjustment (Ouranosinc#914)
  update history
  Update history
  [Ouranosinc#931] Fix indicator for Rxxp index
  Add missing type for `threshold_count`
  Add dev notes - add indexer example - other small changes
  run all available tests in one call for slow builds
  update makefile target black, only install coveralls in tox if coveralls is needed
  Indexing within indicators (Ouranosinc#934)
  Update history
  finish needs doctests
  Remove unnecessary keep_attrs
  Adapt to CF conventions 1.9 - remove gregorian calendar (Ouranosinc#935)
  Bump version: 0.31.2-beta → 0.31.3-beta
  update HISTORY.rst
  suggested corrections
  Apply suggestions from code review
  Resampling indicator (Ouranosinc#927)
  ...
raquelalegre added a commit to UCL/xclim that referenced this pull request Nov 30, 2021
…es/wetday_prop

* 'indices/wetday_prop' of github.com:UCL/xclim: (46 commits)
  Add moi-meme as 0.32 contributor
  do not redefine builtin next
  use array_almost_equal in tests
  Update history
  Improve quantile function
  Apply changes to fraction indicator
  [sdba] Re-write of Extreme's adjustment (Ouranosinc#914)
  update history
  Update history
  [Ouranosinc#931] Fix indicator for Rxxp index
  Add missing type for `threshold_count`
  Add dev notes - add indexer example - other small changes
  run all available tests in one call for slow builds
  update makefile target black, only install coveralls in tox if coveralls is needed
  Indexing within indicators (Ouranosinc#934)
  Update history
  finish needs doctests
  Remove unnecessary keep_attrs
  Adapt to CF conventions 1.9 - remove gregorian calendar (Ouranosinc#935)
  Bump version: 0.31.2-beta → 0.31.3-beta
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request standards / conventions Suggestions on ways forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants