<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Denis,<br>
</p>
<div class="moz-cite-prefix">Le 05/12/2021 à 00:09, Denis Rykov a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAJbvKNra2i2ZB5DXokCbHrBBj=FiKjdGTRyw-QBARNUMW=ANuQ@mail.gmail.com">
<div dir="ltr">According to rasterio's <a
href="https://rasterio.readthedocs.io/en/latest/topics/reproject.html"
moz-do-not-send="true">documentation</a> "reproject" is a
geospatial-specific analog to SciPy’s <a
href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.geometric_transform.html#scipy.ndimage.geometric_transform"
moz-do-not-send="true">geometric_transform</a>.<br>
<div>But the thing is "geometric_transform" doesn't support
masked arrays so it can't properly transform images with
nodata value.<br>
</div>
<div>My question: is it possible to write a custom transformer
function and use it in GDAL to transform an image (considering
nodata) to overcome the lack of the appropriate functionality
in SciPy.</div>
</div>
</blockquote>
<p>If you use the low level C++ API you should be able to do that.</p>
<p>You' ll need to use GDALWarpOperation as the entry point, and
initialize it with GDALWarpOptions with your custom transformer
function in the pfnProgress / pProgressArg members</p>
<p>You may use apps/gdalwarp_lib.cpp or frmts/vrt/vrtwarped.cpp as
examples of how to use those API. This is not entirely trivial
admittedly.</p>
<p>Actually I was thinking a nice contribution, and perhaps simpler
than having your own warping code, could be to enhance the
GDALWarpApp API of apps/gdalwarp_lib.cpp to have a
GDALWarpAppOptionsSetTransformer() function where users could
specify their own transformer which would skip the creation of the
default one.<br>
</p>
<p>Even<br>
</p>
--
<pre class="moz-signature" cols="72"><a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>