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

Convert_calendar bugs with falsy missing value. #1562

Closed
aulemahal opened this issue Dec 15, 2023 · 0 comments · Fixed by #1563
Closed

Convert_calendar bugs with falsy missing value. #1562

aulemahal opened this issue Dec 15, 2023 · 0 comments · Fixed by #1563
Assignees
Labels
bug Something isn't working
Milestone

Comments

@aulemahal
Copy link
Collaborator

If any requested missing value evaluates as False (like 0), it gets ignored and np.NaN is used instead.

out = out.reindex({dim: target}, fill_value=missing or np.nan)

@aulemahal aulemahal added the bug Something isn't working label Dec 15, 2023
@aulemahal aulemahal added this to the v0.48.0 milestone Dec 15, 2023
@aulemahal aulemahal self-assigned this Dec 15, 2023
aulemahal added a commit that referenced this issue Dec 15, 2023
<!--Please ensure the PR fulfills the following requirements! -->
<!-- If this is your first PR, make sure to add your details to the
AUTHORS.rst! -->
### Pull Request Checklist:
- [x] This PR addresses an already opened issue (for bug fixes /
features)
- This PR fixes #1562, fixes
Ouranosinc/ESPO-Internal#3
- [x] Tests for the changes have been added (for bug fixes / features)
- [ ] (If applicable) Documentation has been added / updated (for bug
fixes / features)
- [x] CHANGES.rst has been updated (with summary of main changes)
- [x] Link to issue (:issue:`number`) and pull request (:pull:`number`)
has been added

### What kind of change does this PR introduce?

* When `missing=0` is passed to `convert_calendar`, it is used instead
of replaced by `np.NaN` by faulty expression.

### Does this PR introduce a breaking change?
No.

### Other information:
Xarray's implementation does not have this problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant