[gdal-dev] python code inside of VRT results to empty values
Even Rouault
even.rouault at spatialys.com
Mon May 25 02:14:34 PDT 2020
On lundi 25 mai 2020 10:44:10 CEST Jachym Cepicky wrote:
> Hi all,
>
> I have some python code inside of VRT file, but I can not produce
> reasonable output with gdal_transalte. All the input data do look ok,
> even when I print() the values I would like to store, the data are
> displayed, but the resulting TIFF file is just empty, any hint how to
> approach? I've tested it on gdal 2.2 as well as 3.8, so I assume, I do
> something wrong here. The minimal code looks like
>
> import numpy as np
> import copy
> def blur(in_ar, out_ar, xoff, yoff, xsize, ysize, raster_xsize,
> raster_ysize, buf_radius, gt, **kwargs):
> out_ar = copy.copy(in_ar[0])
> print(out_ar)
> return out_ar
>
> Any hint?
Actually, just realizing that you just don't follow the expectations of the
pixel function. The function should not return an array: it must modify in place
the provided out_ar argument.
Like all examples at
https://gdal.org/drivers/raster/vrt.html#using-derived-bands-with-pixel-functions-in-python
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200525/274ea033/attachment.html>
More information about the gdal-dev
mailing list