Skip to content

Fix NaN NoData handling in convolve_2d#474

Merged
phargogh merged 4 commits intonatcap:mainfrom
claire-simpson:bugfix/473-convolve2d-handles-nan-poorly
Mar 13, 2026
Merged

Fix NaN NoData handling in convolve_2d#474
phargogh merged 4 commits intonatcap:mainfrom
claire-simpson:bugfix/473-convolve2d-handles-nan-poorly

Conversation

@claire-simpson
Copy link
Copy Markdown
Contributor

@claire-simpson claire-simpson commented Mar 11, 2026

Fixes a bug where, if a raster with NoData=nan was passed to convolve_2d, a large part of/the entire resulting raster would become nan.

I followed #465 and opted to use pygeoprocessing.array_equals_nodata (instead of adding equal_nan=True to numpy.isclose) to take advantage of the special case speedups that are handled in that helper function.

Fixes #473

@claire-simpson claire-simpson requested a review from phargogh March 11, 2026 22:21
Copy link
Copy Markdown
Member

@phargogh phargogh left a comment

Choose a reason for hiding this comment

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

Makes sense to me ... thanks @claire-simpson !

@phargogh phargogh merged commit a325b65 into natcap:main Mar 13, 2026
92 of 93 checks passed
@claire-simpson claire-simpson deleted the bugfix/473-convolve2d-handles-nan-poorly branch March 16, 2026 19:37
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.

convolve_2d doesn't handle nan NoData values correctly

2 participants