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

Use sdba options for xclim by default #363

Merged
merged 4 commits into from
Mar 15, 2024
Merged

Use sdba options for xclim by default #363

merged 4 commits into from
Mar 15, 2024

Conversation

aulemahal
Copy link
Collaborator

Pull Request Checklist:

  • [] This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • (If applicable) Documentation has been added / updated (for bug fixes / features).
  • (If applicable) Tests have been added.
  • This PR does not seem to break the templates.
  • 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?

Instead of setting the options only when calling xclim's adjust, we set the options globally at import time.

This fixes the subtle issue noted in Ouranosinc/xclim#1674 : the context options are not seen by all code when dask-backed data is used. as the actual computation occurs outside of the context.

It also allows to change these options at run time. xc.set_options(sdba_encode_cf=False) will fix #362, for example. This was not possible earlier as the option context was within the function and couldn't be modified by the user.

Does this PR introduce a breaking change?

Yes, issue #362 will now occur on dask arrays too, until xclim's PR is merged. But it can be circumvented as shown above.

Copy link
Contributor

@juliettelavoie juliettelavoie left a comment

Choose a reason for hiding this comment

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

Thanks for figuring this out!

You're probably going to have to add xc.set_options(sdba_encode_cf=False) to the notebook Getting Started until the issue is fixed in xclim.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@aulemahal aulemahal merged commit c2261fb into main Mar 15, 2024
23 checks passed
@aulemahal aulemahal deleted the default-xc-opts branch March 15, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust only works with dask array
2 participants