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

Fix sdba_encode_cf bug #1333

Merged
merged 2 commits into from Mar 27, 2023
Merged

Fix sdba_encode_cf bug #1333

merged 2 commits into from Mar 27, 2023

Conversation

aulemahal
Copy link
Collaborator

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)
    • (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?

In xarray#7494 the _contains_cftime_datetimes function was restricted to Variable objects. We were passing a DataArray to xr.conventions.encode_cf_variable , which was passing it (assuming a variable) to that function. Since the PR, this raises an error.

In a way, this is my error because the encode_cf_variable clearly documents that its input should be a Variable, although there were not annotations at the time I implemented that line.

Moreover, we were not testing this code... It depended on the sdba_encode_cf option being activated, but no test was activating it.

This PR passes Variable instances were it should and enables the option in one of the test where it makes sense.

Does this PR introduce a breaking change?

No.

Other information:

Fixes xscen#175.

@aulemahal aulemahal added the bug Something isn't working label Mar 24, 2023
@aulemahal aulemahal added this to the v0.42 milestone Mar 24, 2023
@github-actions github-actions bot added the sdba Issues concerning the sdba submodule. label Mar 24, 2023
@Zeitsperre Zeitsperre added the priority Immediate priority label Mar 24, 2023
@github-actions github-actions bot added the approved Approved for additional tests label Mar 24, 2023
@Zeitsperre
Copy link
Collaborator

Merge when ready!

@aulemahal aulemahal merged commit 52e5626 into master Mar 27, 2023
19 checks passed
@aulemahal aulemahal deleted the sdba-encode-cf-xr2023 branch March 27, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests bug Something isn't working priority Immediate priority sdba Issues concerning the sdba submodule.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants