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

certain resampling methods fail when CHECK_WITH_INVERT_PROJ is False #614

Closed
perrygeo opened this issue Mar 31, 2016 · 5 comments
Closed

Comments

@perrygeo
Copy link
Contributor

with rasterio.drivers(CHECK_WITH_INVERT_PROJ=False):
    ...
    # works
    reproject(..., resampling=Resampling.nearest)

    # succeeds but produces blank image
    reproject(..., resampling=Resampling.bilinear)

If CHECK_WITH_INVERT_PROJ=True, both nearest and bilinear work fine.

Related discussion about making invert proj checking the default #613

@sgillies
Copy link
Member

@perrygeo this has me rethinking the keyword argument I proposed in #613. Maybe the application of CHECK_WITH_INVERT_PROJ is more pervasive than I realized. Baking True into our environments is making more sense to me.

@perrygeo
Copy link
Contributor Author

perrygeo commented Jun 2, 2016

This is a fun one. I parametrized the test to run with all resampling methods and here's the results:

tests/test_warp.py::test_resample_no_invert_proj[Resampling.nearest] PASSED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.bilinear] FAILED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.cubic] FAILED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.cubic_spline] FAILED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.lanczos] FAILED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.average] PASSED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.mode] PASSED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.gauss] FAILED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.max] PASSED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.min] PASSED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.med] PASSED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.q1] PASSED
tests/test_warp.py::test_resample_no_invert_proj[Resampling.q3] PASSED

@perrygeo
Copy link
Contributor Author

Copied from #753:

Prelim look at gdalwarpkernel.cpp shows that all of the xfailing resampling methods (with the exception of gauss) use their own Filter Functions. Makes sense since the algorithms require a certain radius of neighboring data. But these appear to be failing silently or producing invalid results when CHECK_WITH_INVERT_PROJ is false.

The filter functions themselves are here for future reference.

@perrygeo perrygeo changed the title bilinear resampling creates blank image without check-invert-proj certain resampling methods fail when CHECK_WITH_INVERT_PROJ is False Jun 11, 2016
@perrygeo
Copy link
Contributor Author

This is a known bug and we can deal with it post-1.0. Getting #780 merged will greatly reduce the chances of users hitting this by accident.

@perrygeo perrygeo modified the milestones: post 1.0, 1.0 Jun 11, 2016
@sgillies
Copy link
Member

I wonder if the SOURCE_EXTRA warp option is needed to make some of these resampling methods reliable https://gdal.org/api/gdalwarp_cpp.html#_CPPv4N15GDALWarpOptions16papszWarpOptionsE. I'm going to close this one and we'll reopen if the problems continue with PROJ 6+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants