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

Deprecate calendar ops #1761

Merged
merged 9 commits into from
Jun 11, 2024
Merged

Deprecate calendar ops #1761

merged 9 commits into from
Jun 11, 2024

Conversation

aulemahal
Copy link
Collaborator

@aulemahal aulemahal commented May 24, 2024

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features) (mostly removed)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGES.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

  • Calendar utilities that have an equivalent in xarray have been deprecated and will be removed in 0.51. This concerns the following members of xclim.core.calendar:
    • convert_calendar : Use Dataset.convert_calendar, DataArray.convert_calendar or xr.coding.calendar_ops.convert_calendar instead.
      • If your code passes target as an array, first convert the source to the target's calendar and then reindex the result to target.
      • If you were using the doy=True option, replace it with xc.core.calendar.convert_doy(source, target_cal).convert_calendar(target_cal).
      • "default" is no longer a valid calendar name for any xclim functions and will not be returned by get_calendar. Xarray has a use_cftime argument, xclim exposes it when the distinction is needed.
    • date_range : Use xarray.date_range instead.
    • date_range_like: Use xarray.date_range_like instead.
    • interp_calendar : Use xarray.coding.calendar_ops.interp_calendar instead.
    • days_in_year : Use xarray.coding.calendar_ops._days_in_year instead.
    • datetime_to_decimal_year : Use xarray.coding.calendar_ops._datetime_to_decimal_year instead.

Does this PR introduce a breaking change?

Yes.

  • Some options of convert_calendar are not possible with xarray, suggestions are made above.
  • "default" is not a calendar name anymore.

Other information:

@aulemahal aulemahal requested a review from Zeitsperre May 24, 2024 13:41
@github-actions github-actions bot added the sdba Issues concerning the sdba submodule. label May 24, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added the docs Improvements to documenation label May 30, 2024
Copy link
Collaborator

@Zeitsperre Zeitsperre left a comment

Choose a reason for hiding this comment

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

Looks good!

CHANGES.rst Outdated Show resolved Hide resolved
CHANGES.rst Show resolved Hide resolved
xclim/core/calendar.py Outdated Show resolved Hide resolved
xclim/core/calendar.py Outdated Show resolved Hide resolved
xclim/core/calendar.py Outdated Show resolved Hide resolved
xclim/core/calendar.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added the approved Approved for additional tests label May 31, 2024
CHANGES.rst Outdated Show resolved Hide resolved
Co-authored-by: Trevor James Smith <[email protected]>
xclim/core/calendar.py Outdated Show resolved Hide resolved
@Zeitsperre Zeitsperre added this to the v0.50.0 milestone Jun 11, 2024
@Zeitsperre Zeitsperre merged commit ef5699c into main Jun 11, 2024
18 checks passed
@Zeitsperre Zeitsperre deleted the deprecate-calendar branch June 11, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests docs Improvements to documenation sdba Issues concerning the sdba submodule.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants