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: nanargmin with all nan slice #134

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

manuba95
Copy link
Contributor

This fixes an issue in the DiscreteVoronoiModel. The model crashes when frame are all NaN because of the np.nanargmin() function. This is because of type stability of the return of that function as its supposed to return integers. See pydata/xarray#4481 and pydata/xarray#3884.
One easy fix for this would be to apply the np.nanargmin() only to slices that are not all NaN using np.where(). However, masking the hole array before the loop and catching the all NaN slices early might be a more elegant and better performing option.

@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Merging #134 (5d10c39) into develop (e1de087) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop     #134   +/-   ##
========================================
  Coverage    95.58%   95.58%           
========================================
  Files           47       47           
  Lines         3194     3194           
========================================
  Hits          3053     3053           
  Misses         141      141           
Files Changed Coverage Δ
floodlight/models/space.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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.

None yet

1 participant