I'm using ArcGIS 10.4.1, arcPy and NumPy. I'm trying to create a list of tuples that identify all entries in a NumPy array (DEM) who's value is lower than all adjacent neighbors (I.e. It's a depression). Ideally I'll find a way to create a list of tuples with col, row and cell value that I can ultimately sort from highest to lowest cell value.

Any thoughts?

My end goal is to also determine the outlet point (pour point) for each of these sinks, but I'm learning one step at a time.

So far I've got:

import arcpy
from arcpy.sa import *
import numpy as np

lowerLeft = arcpy.Point(inDEM.extent.XMin,inDEM.extent.YMin)
arcpy.env.extent = inDEM
outSink = Sink(FlowDirection(inDEM))

SinkArray = arcpy.RasterToNumPyArray(outSink, lowerLeft)

a,b = np.where(SinkArray >= 1)
x = zip(a,b)

del SinkArray

Which gives me a list (x) of row/cols where sinks exist, but i'm sure there is a way to just import my initial DEM and identify local minima.

  • As only a second time poster be sure to take the Tour to learn about our focussed Q&A format. I recommend not thinking about GIS SE as being some sort of online GIS tutor. For your questions to be answered here they should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. For questions that involve code there is an edit button beneath your question which will enable you to provide a code snippet and a {} button that enables you to format any highlighted code nicely.
    – PolyGeo
    Aug 30, 2016 at 20:42
  • @PolyGeo my apologies if I came across as an ungrateful code mooch. I know that it can be accomplished in ArcGIS with flow direction, sink, raster to point, extract values to points etc. But that seems very inefficient.
    – Jae
    Aug 30, 2016 at 21:05
  • So the way to proceed may be to show a code snippet that illustrates your current procedure and its inefficiency, so that potential answerers can see what you have tried and where you are stuck.
    – PolyGeo
    Aug 30, 2016 at 21:14
  • 1
    Focal statistics (MINIMUM) will achieve this in no time.
    – FelixIP
    Aug 31, 2016 at 2:49


Your Answer

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