How do I reclassify many rasters in ModelBuilder when each raster has its own unique values?
For example, when you create a model in ModelBuilder and you add the Reclassify tool you may want to reclass several rasters with the Iterate Raster tool as an input. However, when you open the Reclass toolbox you choose a value for reclassification and then name it as an output raster. The problem is how can you, when iterating the raster, reclass with several reclassification values for each raster? This is what I am trying to do.
@Michael Miles-Stimson Here is the python I copied and paste here.
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Reclassify2006.py
# Created on: 2014-06-23 16:22:40.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy
# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")
# Load required toolboxes
arcpy.ImportToolbox("Model Functions")
# Local variables:
Final_NDVI = "E:\\FY2013_projects\\PMC_project\\USGS EarthExplorer\\2006\\Final_NDVI"
v_outFGDB___Value__new = "E:\\FY2013_projects\\PMC_project\\USGS EarthExplorer\\2006\\Vectors\\NDVI_reclassify.gdb"
v_Name_ = "E:\\FY2013_projects\\PMC_project\\USGS EarthExplorer\\2006\\reclassify\\%Name%"
v_Value__new = "E:\\FY2013_projects\\PMC_project\\USGS EarthExplorer\\2006\\Vectors\\NDVI_reclassify.gdb\\%Value%.shp"
Name = "ast_l1b_00302032006175500_20101030104009_12125_ndvi"
v_Value__new__2_ = "E:\\FY2013_projects\\PMC_project\\USGS EarthExplorer\\2006\\Vectors\\NDVI_reclassify.gdb\\%Value%.shp"
ast_l1b_00302032006175500_20101030104009_12125_ndvi_img = "E:\\FY2013_projects\\PMC_project\\USGS EarthExplorer\\2006\\Final_NDVI\\ast_l1b_00302032006175500_20101030104009_12125_ndvi.img"
# Process: Iterate Rasters
arcpy.IterateRasters_mb(Final_NDVI, "a*", "", "NOT_RECURSIVE")
# Process: Reclassify
arcpy.gp.Reclassify_sa(ast_l1b_00302032006175500_20101030104009_12125_ndvi_img, "Value", "-0.17647059261798859 0.022727273404598236 1;0.022727273404598236 0.10313901305198669 2;0.10313901305198669 0.1428571492433548 3;0.1428571492433548 0.16883116960525513 4;0.16883116960525513 0.19117647409439087 5;0.19117647409439087 0.21538461744785309 6;0.21538461744785309 0.24324324727058411 7;0.24324324727058411 0.29870128631591797 8;0.29870128631591797 0.56451612710952759 9", v_Name_, "DATA")
# Process: Parse Path
arcpy.ParsePath_mb(Name, "NAME")
# Process: Raster to Polygon
tempEnvironment0 = arcpy.env.parallelProcessingFactor
arcpy.env.parallelProcessingFactor = "ast_l1b_00302032006175500_20101030104009_12125_ndvi"
arcpy.RasterToPolygon_conversion(v_Name_, v_Value__new, "SIMPLIFY", "VALUE")
arcpy.env.parallelProcessingFactor = tempEnvironment0
# Process: Add Field
arcpy.AddField_management(v_Value__new, "Acres", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
# Process: Calculate Field
arcpy.CalculateField_management(v_Value__new__2_, "Acres", "[Shape_Area]", "VB", "")