How to use raster calculator in ModelBuilder to batch reclassify hundreds of rasters?

المشرف العام

Administrator
طاقم الإدارة
I'm not sure what the problem is here. I'm attempting to use iterate by raster to feed all the files through a simple map algebra expression (I'm looking at data that indicates probability of salamander habitat) so I want to reclassify the raster data and get output that separates 0 probability of habitat vs. greater than 0 probability.

After many hours of geoprocessing, I just realized that all the habitat extents are identical.



# ---------------------------------------------------------------------------# reclassifymodel.txt# Created on: 2013-12-02 05:29:53.00000# (generated by ArcGIS/ModelBuilder)# Usage: reclassifymodel # Description: # This model reclassifies all TIF rasters to binary probability# ---------------------------------------------------------------------------# Import arcpy moduleimport arcpy# Check out any necessary licensesarcpy.CheckOutExtension("spatial")# Load required toolboxesarcpy.ImportToolbox("Model Functions")# Script argumentsSalamanderData = arcpy.GetParameterAsText(0)if SalamanderData == '#' or not SalamanderData: SalamanderData = "C:\\Users\\mkcar_000\\Desktop\\SalamanderData" # provide a default value if unspecified# Local variables:Raster = SalamanderDatareclassified = Rasterpolygon = reclassifiedpolyselect = polygonextent__Name_feat_shp = polyselectpathname = RasterName = SalamanderData# Process: Iterate Rastersarcpy.IterateRasters_mb(SalamanderData, "", "TIF", "RECURSIVE")# Process: Parse Patharcpy.ParsePath_mb(Raster, "PATH")# Process: Raster Calculatorarcpy.gp.RasterCalculator_sa("outraster = Con(\"%Raster%\" > 0, 1, 0)", reclassified)# Process: Raster to Polygonarcpy.RasterToPolygon_conversion(reclassified, polygon, "SIMPLIFY", "Value")# Process: Selectarcpy.Select_analysis(polygon, polyselect, "\"grid_code\" = 1")# Process: Copy Featuresarcpy.CopyFeatures_management(polyselect, extent__Name_feat_shp, "", "0", "0", "0")

أكثر...
 
أعلى