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!"
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.