0

I am trying to run the focal statistics tool on this raster for some reason I am getting this name error, even though the script ran fine a moment earlier.

FocStatCalc = arcpy.sa.FocalStatistics(MajFilCalc2, NbrCicle(3, "CELL"), "MAJORITY")
FocStatCalc1 = r"N:\geog327\python15\Project\Results\FocStatCalc.tif"
FocStatCalc.save(FocStatCalc1)
FocStatCalc2 = arcpy.Raster(r"N:\geog327\python15\Project\Results\FocStatCalc.tif")
4
  • 1
    You have a typo: NbrCicle should be NbrCircle
    – Bera
    Commented May 2, 2017 at 8:01
  • I am still getting the error after the typo was fixed
    – Noah P
    Commented May 2, 2017 at 8:08
  • 1
    Have you import the module?: import arcpy and also: from arcpy.sa import *? Or you need to: arcpy.sa.NbrCircle(...
    – Bera
    Commented May 2, 2017 at 8:10
  • That solved it. It pretty strange that I had to do that even though at the beginning of the bigger block of code I have arcpy.CheckOutExtension("spatial"), I just assumed I wouldn't need to import the sa tools again even if a license was already checked out.
    – Noah P
    Commented May 2, 2017 at 8:13

1 Answer 1

2

You have a typo: NbrCicle should be NbrCircle

Also make sure you have imported the modules:

import arcpy
from arcpy.sa import *

Or NbrCircle will not be recognized. You can also do:

arcpy.sa.NbrCircle(...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.