I don't have ArcGIS (ArcPy) so I am hoping to use some other python package such as numpy to compute the mean of a list of rasters in a directory (i.e. Raster1.tif + Raster2.tif + Raster3.tif / 3).
I like to input the directory in the console for computations- using this:
import os
import sys
directory = sys.argv[1]
rasters []
for i in os.listdir(directory):
if i.endswith(".tif"):
After this I am not really sure what package or code to use. The only examples I have found online are using ArcPy.
Can anyone help me out?
I am hoping to export a single averaged raster as a 16-bit tif.
Best Answer
You could use
rasterio
to read your data as numpy arrays (and write from numpy arrays) andnumpy
to perform the averaging.