I am writing a very simple code in ArcMap. but it does not run correctly. I want to put a majority filter on my input raster, then use fill tool and then subtract the filled one from the last one and then reclassify the result. the problem is that when I run the code line by line, It works but when I want to run all the code together, I see a bug before "Fill" line. anybody knows what is the problem?
import arcpy
from arcpy import env
env.workspace = r'C:\Users\Arsalan\Documents\ArcGIS'
import arcpy.sa
from arcpy.sa import *
MajorityFilter("Meet_Raster", "EIGHT", "MAJORITY")
MajorityFilter("Meet_Raster", "EIGHT", "MAJORITY")
MajOut = MajorityFilter("Meet_Raster", "EIGHT", "MAJORITY")
arcpy.CheckOutExtension("Spatial")
Fill("MajOut", 12)
FillOut = Fill("MajOut", 12)
RastCalc = Raster("FillOut") - Raster("MajOut")
RastReclass = Reclassify("RastCalc", "Value", RemapRange([[0,0,"NODATA"],[1,3,1],[4,9,2],[9,15,3]]))