I'm trying to mask a group of raster files and save the new rasters in a different folder using the same name of the original files.
It doesn't sound as a difficult task, but I'm having trouble saving-naming each masked raster inside the "for" loop. Here is what I have so far:
import arcpy from arcpy import env from arcpy.sa import * env.workspace = "C:/rasters/threshold" mask = "C:/GIS/mesoamerica.tif" rasterlist = arcpy.ListDatasets("*", "Raster") for i in rasterlist: outExtractByMask = ExtractByMask(i, mask) outExtractByMask.save("C:/SIG/MelasCA_30runs_avg/threshold/mesoamerica/" i)
I need to find a way to use the "i" variable in the outExtractByMask.save. Any idea?