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

SWY: check for numpy.nan pixels in routing functions #1706

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

davemfish
Copy link
Contributor

We have updated our is_close and numpy.isclose calls in most places to check for numpy.nan, but this is one place where we were not doing that. It's plausible for the rasters being processed by this module to have numpy.nan pixels.

Fixes #1705

Checklist

  • Updated HISTORY.rst and link to any relevant issue (if these changes are user-facing)
  • Updated the user's guide (if needed)
  • Tested the Workbench UI (if relevant)

@davemfish davemfish requested a review from emlys December 11, 2024 20:38
Copy link
Member

@emlys emlys left a comment

Choose a reason for hiding this comment

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

Thanks @davemfish! Just wondering if this has an effect of slowing down the model significantly?

@davemfish
Copy link
Contributor Author

Thanks @davemfish! Just wondering if this has an effect of slowing down the model significantly?

@emlys I did some tests and found no noticeable slowdown of the model until I used a datastack that took 56 minutes to run on my machine. In that case, a version with the isnan checks took 57 minutes.

At a recent meeting we discussed this and agreed this is acceptable for now since doing the isnan checks fixes a bug where nans would otherwise pollute some math.

I also created #1714 and #1715 so that we can revisit a broader invest-wide solution and revert this change later if we want to.

@davemfish davemfish requested a review from emlys December 16, 2024 18:50
Copy link
Member

@emlys emlys left a comment

Choose a reason for hiding this comment

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

@davemfish thanks, I was going to wait for the checks to pass, but it seems that the macos checks have been stalled all day (on this and other branches too), so feel free to merge given that all seemingly relevant checks have passed.

@davemfish davemfish merged commit 3b9b2d1 into natcap:main Dec 17, 2024
29 checks passed
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.

SWY cython is_close does not handle numpy.nan
2 participants