Hi Even, Thanks for your reply!
On Fri, 19 Jan 2024 at 17:32, Even Rouault <even.roua...@spatialys.com> wrote: > I can't think an easy way of doing what you want. > Is there a functional gap? *Conceptually* it feels to me like VRTRasterBand.ComplexSource.UseMaskBand should "mark" a pixel to be nodata-equivalent (NaN?), and then VRTRasterBand.NoDataValue should "write" the nodata-marked pixels with the value. <VRTDataset ...> ... <VRTRasterBand dataType="Int16" band="1"> <NoDataValue>-1</NoDataValue> <ComplexSource> <SourceFilename>in.tif</SourceFilename> <SourceBand>1</SourceBand> <UseMaskBand>true</UseMaskBand> ... </ComplexSource> ... </VRTRasterBand> But maybe that's not how it's modelled inside? > Well, you can definitely do that using a VRT Python pixel function, that > would essentially do your --calc expression > Thanks for confirming it's possible, I'll have a play. >From what I can see the python pixel functions are only called once, use numpy and (IIUC) vectorised CPU operations... would that make it faster/comparable to one of the C pixel functions that's doing a naive array loop over rows & columns? > A nice exercice for (Pythonist) contributors would be to add a -f VRT > capability to gdal_calc.py that would essentially automate the writing > of such VRT using Python pixel functions. Just saying... *adds to a long list of nice exercises* Thanks Rob :)
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev