I have 60 raster files and I need to find the top 5 values in each cell.

Now I know that if I had to find the highest value, I could just use the maximum function in cell statistics. But I am not able to find the top 5 in each cell nor can I find a solution through which I can identify the top 5.

Is there any toolbox or any other method that I could use?

  • Read all 60 bands to an arcpy array then iterate the values to find the highest 5 or 10 or 20. Do you need to be able to find which raster each of the top values comes from? – Michael Stimson Dec 5 '18 at 3:28
  • @MichaelStimson yes, I need to be able to find which raster the top 5 come from. Also, I have never used python. Would there be any tutorial where I can learn how to do this in arcpy? – tish Dec 5 '18 at 5:15
  • 1
    This is a little too advanced for a beginner, have a read of arcpy.RasterToNumPyArray resources.arcgis.com/en/help/main/10.2/index.html#//… then for each index (cell) make a dictionary from the band data and sort like stackoverflow.com/questions/613183/… then grab the first 5 keys and their values. The ArcGIS help has many examples of basic code to get you started; if you're an absolute beginner then google 'learn python' before getting into arcpy to get some basis on the language. – Michael Stimson Dec 5 '18 at 5:58
  • 1
    The real question how do you want your result? – FelixIP Dec 5 '18 at 8:01
  • 1
    Perhaps run 7 times rank tool on your set of rasters desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/… – FelixIP Dec 5 '18 at 8:34

Your Answer

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

Browse other questions tagged or ask your own question.