import arcpy, os rasterValDict = {"raster1": 11.2, "raster2": 14.9, "raster3": 9.4, "raster4": 9.4, "raster5": 9.4} rasterDirPath = r'E:\Test\Criteria' outputDirPath = r'E:\Test\rastercalc' arcpy.env.workspace = rasterDirPath rasterList = arcpy.ListRasters() for raster in rasterList: rasterObj = arcpy.Raster(raster) if raster in rasterValDict: newRaster = rasterObj / rasterValDict[raster] * 100 newRaster.save(outputDirPath + "\\" + raster) else: print "ERROR: No matching entry in raster value look up dictionary!"
rasterValDict = {"raster1": 11.2, "raster2": 14.9, ..., "raster_37": 9.4} rasterDirPath = r"C:\temp\where_my_rasters_are" outputDirPath = r"C:\temp\output_dir" arcpy.env.workspace = rasterDirPath rasterList = arcpy.ListRasters() for raster in rasterList: rasterObj = arcpy.Raster(raster) if raster in rasterValDict: newRaster = rasterObj / rasterValDict[raster] * 100 newRaster.save(outputDirPath + "\\" + raster) else: print "ERROR: No matching entry in raster value look up dictionary!"
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.