Skip to content

Comments

test_reproject_resampling: Add another value for mode.#3293

Merged
sgillies merged 2 commits intorasterio:mainfrom
schwehr:test_warp_mode
Jan 17, 2025
Merged

test_reproject_resampling: Add another value for mode.#3293
sgillies merged 2 commits intorasterio:mainfrom
schwehr:test_warp_mode

Conversation

@schwehr
Copy link
Contributor

@schwehr schwehr commented Jan 16, 2025

Change triggered by OSGeo/gdal@b68bf74

schwehr referenced this pull request in OSGeo/gdal Jan 16, 2025
Warper: Fixes related to mode resampling
@dbaston
Copy link
Contributor

dbaston commented Jan 16, 2025

This change is a result of the weighting of partially-covered pixels?

@schwehr schwehr marked this pull request as draft January 16, 2025 22:12
@schwehr
Copy link
Contributor Author

schwehr commented Jan 16, 2025

Maybe? I haven't looked closely at what triggered the change.

@schwehr schwehr marked this pull request as ready for review January 16, 2025 22:35
Copy link
Member

@sgillies sgillies left a comment

Choose a reason for hiding this comment

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

Thanks @schwehr !

@sgillies sgillies merged commit 7adb4f5 into rasterio:main Jan 17, 2025
22 checks passed
@dbaston
Copy link
Contributor

dbaston commented Jan 17, 2025

I've been digging into this (always terrified that I've broken something!) But I have reproduced the new value of 438002 in "vanilla" GDAL and I think the changes make sense. Unlike with a categorical raster, in this reprojection there are many different source pixel values associated with a given destination pixel value. When these pixels were weighted equally, the first pixel encountered was assigned as the mode. Now that source pixels are not weighted equally, the outcome is different for most pixels.

@sgillies
Copy link
Member

@dbaston @schwehr I appreciate the updates here! Though, sometimes I think I may have made a mistake by asserting any resampling values. I can't remember that these tests have ever caught a regression in GDAL.

@schwehr
Copy link
Contributor Author

schwehr commented Jan 17, 2025

Someone somewhere someday will be hugely appreciative of that test as it stops them from doing something catastrophic, but hard to catch. And we will never know that your test saved millions of lives or some such.

I am thinking of some of the weird bugs in CPUs, core libraries, compilers, etc. Like the time I had to tell a team to stop using the fast-math compiler flag...

@schwehr schwehr deleted the test_warp_mode branch January 17, 2025 17:35
QuLogic pushed a commit to QuLogic/rasterio that referenced this pull request Sep 7, 2025
* test_reproject_resampling: Add another value for mode.

Change triggered by OSGeo/gdal@b68bf74

* test_reproject_resampling_alpha: Change in mode
@snowman2 snowman2 added this to the 1.4.4 milestone Sep 11, 2025
@snowman2 snowman2 added the backport-1.4 To be backported to maint-1.4 label Nov 6, 2025
snowman2 pushed a commit that referenced this pull request Nov 6, 2025
* test_reproject_resampling: Add another value for mode.

Change triggered by OSGeo/gdal@b68bf74

* test_reproject_resampling_alpha: Change in mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-1.4 To be backported to maint-1.4 testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants