-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Warn about INIT_DEST in warp operation instead of failing #12189
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
base: master
Are you sure you want to change the base?
Conversation
If I understand right, the gdalwarp binary has always required some input for the destination nodata
Out of curiosity, what Rasterio is doing with such input? Does it copy the source nodata value, or set nodata into 0, or what? |
@jratike80 Rasterio uses GDAL's C++ warper, not gdalwarp or its core C function. |
I guessed that, but I was thinking that Rasrerio it is doing something similar than gdalwarp and there is something in common in the logic. This is fun:
This is with GDAL 3.11.0dev-29aee5da70, released 2025/04/10 |
Sean isn't possible to modify instead Rasterio to not set INIT_DEST to NO_DATA when there is none but instead likely to 0 ? |
It's not a no-op -- it causes an initialization to zero, though nothing in the code suggests to me that this behavior is intentional. Try running the below snippet both with and without
If the desired behavior in rasterio is "initialize to the NoData unless there isn't one, in which case initialize to zero", why not code that explicitly? |
A new Rasterio release to fix its usage isn't in the cards right now. That's why I'm asking if we can have a warning instead of a warp-stopping failure. Now it could be that Rasterio user code is less susceptible that Rasterio's tests, and that I could just update Rasterio's tests to not blindly set INIT_DEST like they do. I'll look into that. |
I don't have any problem making it a warning for the current release, I'd just prefer not to enshrine the current behavior. Would you object to making it a failure in 3.12? |
#11978 changed a no-op condition to a hard failure. This breaks every recent version of Rasterio, which sets
INIT_DEST=NO_DATA
by default: https://github.com/rasterio/rasterio/blob/0fe62a7106034021e0375746b2581ad595f44f86/rasterio/_warp.pyx#L584-L585.Instead, how about restoring the no-op, but with a warning?