[gdal-dev] Gdal_calc.py with more than 26 input files

Mike Toews mwtoews at gmail.com
Thu Jul 16 16:29:11 PDT 2015

On 17 July 2015 at 11:13, Even Rouault <even.rouault at spatialys.com> wrote:
> But when you have more than 26 input files, it is dubious that you really want
> to individually identify them with a particular letter/name. As in one of the
> examples, you likely just want to apply a global operation on them, like sum,
> mean, .... So they would be better passed as a lis
> t so as to be able to build a 3 dimension numpy array, so you can do things
> like:
> --input foo.tif bar.tif ... --calc "rasters.mean(axis=0)"
> And you could also still reference a particular raster with rasters[i] syntax
> (To be clear: the above is not something currently available)

It's actually not too far off. For instance, stack several single-band
var*.tif rasters in a multi-band VRT, then calculate the mean along
the 0th axis:

gdalbuildvrt -separate var_stacked.vrt var*.tif
gdal_calc.py -A var_stacked.vrt --outfile=avg_var.tif --calc="A.mean(axis=0)"

However, the result avg_var.tif is not as expected due to the use of
blocks. Is this ticket worthy?

More information about the gdal-dev mailing list