[gdal-dev] Some python learner questions
Stefan Gofferje
lists at home.gofferje.net
Sat Sep 20 00:15:02 PDT 2025
Morning!
I'm currently trying to learn Python and in my quest to do so, I'm
trying to rewrite some of bash scripts which use the GDAL tools into
Python, namely the ones that I use to process Sentinel 2 imagery.
I'm a little bit at a loss on how I would translate gdal_translate's
scale function into Python, e.g.
gdal_translate -ot Byte -scale ${min} ${max} 0 255 a.tiff a_scaled.tiff
Then, I assume, to replicate the function of gdalcalc, I would have to
load the bands into numpy arrays, do the calculations with the arrays
and write those arrays back as bands in a tiff? Or is there a smarter
way to do that?
BR: Stefan
--
(o_ Stefan Gofferje | SCLT, MCP, CCSA
//\ Reg'd Linux User #247167 | VCP #2263
V_/_ https://www.gofferje.net | https://www.saakeskus.fi
More information about the gdal-dev
mailing list