I am using SAGA GIS and python modules in QGIS to compute the Topographic Position Index (TPI) for a group of Digital Elevation Models (DEMs) and I need to export each computed TPI in a separate raster file. How can I do it? See my written code below:
base_dir = 'D:/Selected DEMs'
fnames = [os.path.join(base_dir, fname) for fname in os.listdir(base_dir)]
dfs_names = (os.listdir(base_dir))
for i in range(len (fnames)):
print (i)
tpi = processing.run("saga:topographicpositionindextpi", {'DEM':fnames[i],'TPI':'TEMPORARY_OUTPUT','STANDARD':False,'DW_WEIGHTING':0,'DW_IDW_POWER':2,'DW_BANDWIDTH':75})