Advertisement
PasteBinKT

HelpWithSavingEachFileInCode

Jan 31st, 2023
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import arcpy
  2. import os
  3. import glob
  4. from arcpy import env
  5. from arcpy.sa import *
  6.  
  7. arcpy.CheckOutExtension("Spatial")
  8.  
  9. env.workspace = r"File_pathway"
  10. arcpy.env.extent = r"File_pathway2"
  11. indef_file = "File_pathway3"
  12.  
  13. inRasters = glob.glob(r"File_pathway4\\*.tif")
  14. inMaskData = "Quads"
  15. extraction_area = "OUTSIDE"
  16. analysis_extent = "Quads"
  17.  
  18. for inRaster in inRasters:
  19. outExtractByMask = ExtractByMask(inRaster, inMaskData)
  20. classifiedraster = ClassifyRaster(outExtractByMask, indef_file)
  21. classifiedraster.save = (r"File_pathway")
  22. newname = inRaster + "CF"
  23. arcpy.management.Rename(classifiedraster,newname)
  24. outCellstats = CellStatistics([classifiedraster], "SUM", "DATA")
  25. outCellstats.save=(r"file_pathway")
  26. newname2 = inRaster + "CS"a
  27. arcpy.management.Rename(outCellstats, newname2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement