Select to view content in your preferred language

SQL problem in extractbyattribut

1224
1
05-23-2013 12:01 AM
Labels (1)
paul-antoinecastel
New Contributor
Hello,
I have a problem with the fonction extractbyattribut:
I try to have just the minimale raster value as a layer.
So i tried that:

           distresult = arcpy.GetRasterProperties_management(extractbymaskflow, "MINIMUM")
         
           accumax = distresult.getOutput(0)

           valaccu=int(accumax)
           inSQLClause = "VALUE = valaccu"
           attExtract = ExtractByAttributes(extractbymaskflow, inSQLClause)
           attExtract.save("attExtract")

The problem seems to be "VALUE = valaccu"
I also tried with "VALUE=" +str(valaccu) for the same results.

I don't have error message with this method but the result is a raster with the size of the intial extractbymask with one value eqal to 0.

sorry if there is some faults but english is not my first language.

Thanks to read and answer me
Tags (2)
0 Kudos
1 Reply
ChristineDartiguenave
Esri Contributor
"VALUE=" + str(valaccu) is correct.

You are asking for the minimum value in your grid ("MINIMUM") so accumax probably comes back as 0. This is why you end up with the final grid containing only 0. If you want the maximum value in your grid, change the parameter to "MAXIMUM".

Christine Dartiguenave
Esri Water Resources Team
0 Kudos