I keep getting "Fatal Error (GETMAP) Bad NBIT Argument" error for the following sample script:

fields = ['Value', 'Class_Name']
cursor = arcpy.da.SearchCursor(LuTable, fields)
for row in cursor:
    sqlQuery = "Value = " + str(row[0])
    print (sqlQuery)
    rasExtract = ExtractByAttributes(inRaster, sqlQuery)
    outCon = Con(IsNull(rasExtract),0,1)
    outAgg = Aggregate(outCon, 10, "SUM", "EXPAND", "DATA")
del row, cursor

I cannot find much documentation on this error. I have checked all the input rasters, output paths and set workspace and scratch space manually not included in the script. After inspecting it step-by-step, the extract by attribute tool creates a blank raster and then abruptly stops. The only reference I found is this but they are talking about features not rasters. Has anyone experienced this error message?

  • Is it possible that your look up table has a value in it that does not exist in the raster you are extracting from? Are some rasters created or does it fail on the first attempt in the loop? – Hornbydd Jan 26 '17 at 17:15
  • I checked it contains 16 categories and all them are present in the raster I am extracting from. It fails after initiating first raster. The result is a blank raster in the scratch directory. – cptpython Jan 26 '17 at 17:31

Not exactly an answer, but recreating the data and re-running it resolved the issue. Also, I suggest rechecking raster environments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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