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 regression: input arrays are not broadcast #61

Merged
merged 4 commits into from
Jun 14, 2021

Conversation

gjoseph92
Copy link
Contributor

I noticed that #49 introduced a regression where input arrays now all must be the same shape (before, they'd be broadcast when possible). In #49 (comment) I was trying to explain this and a potential fix, but probably wasn't very clear about it.

Here's a test demonstrating the issue; this passes on HEAD^ (as long as dask is installed from main). I'll push up the rest of the fix in a few hours.

cc @TomNicholas @rabernat

@gjoseph92 gjoseph92 marked this pull request as ready for review June 10, 2021 22:04
@rabernat
Copy link
Contributor

Thanks so much for this @gjoseph92! Sorry we missed your suggestion. #49 got a bit hard to follow by the end.

@codecov
Copy link

codecov bot commented Jun 11, 2021

Codecov Report

Merging #61 (b20c3f9) into master (d1df004) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #61      +/-   ##
==========================================
- Coverage   84.14%   84.08%   -0.07%     
==========================================
  Files           2        2              
  Lines         246      245       -1     
  Branches       77       74       -3     
==========================================
- Hits          207      206       -1     
  Misses         34       34              
  Partials        5        5              
Impacted Files Coverage Δ
xhistogram/core.py 81.72% <100.00%> (-0.10%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe1b3fa...b20c3f9. Read the comment docs.

@TomNicholas
Copy link
Member

Thanks @gjoseph92 for catching this!

The PR looks good to me, but there some test failures on some environments (all with python 3.7 it seems) of a form where
all_arrays = broadcast_arrays(*all_arrays)
is somehow causing

    def raise_if_computed():
>       raise ValueError("Triggered forbidden computation")
E       ValueError: Triggered forbidden computation

xhistogram\test\fixtures.py:8: ValueError

@TomNicholas
Copy link
Member

there are some test failures

Attempting to reproduce locally (on Ubuntu) suggests that a more recent numpy version will pass on python 3.7, so perhaps any future release of this functionality should just bump the dependencies a bit?

@gjoseph92
Copy link
Contributor Author

Thanks for looking into that. Yes, this will require NumPy >= 0.17 so that NEP-18 is active by default. I've updated that in this PR. Incidentally I saw that the NumPy version used in CI is different for all three Python versions; is that intentional?

@jrbourbeau
Copy link
Contributor

I saw that the NumPy version used in CI is different for all three Python versions; is that intentional?

Yes, that's so we can provide some CI coverage over multiple versions of NumPy (we do something similar in dask/dask)

Copy link
Member

@TomNicholas TomNicholas left a comment

Choose a reason for hiding this comment

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

Those pass now, and that explanation makes sense, thanks!

The only cross is from codecov - apparently the coverage somehow decreased slightly, but I think this fix can be merged anyway.

@TomNicholas TomNicholas merged commit 8a6765a into xgcm:master Jun 14, 2021
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.

4 participants