Calculate the height of vertical DEM areas

912
1
02-10-2017 03:21 AM
AnnetteStephani
New Contributor

Hi,

is there a way to calculate the height of the vertical (or almost vertical) areas in a DEM?

I need it to determine the resistance of the terrain for the dispersal of tortoises. As tortoises are able to cope with some step heights but limited as soon as a certain value is reached, the vertical features can be crucial for the fragmentation of a terrain (from a tortoise point of view ).

Many thanks in advance for any ideas & inputs,

Annette

0 Kudos
1 Reply
DanPatterson_Retired
MVP Emeritus

This is a bit out of the box, but you can convert a raster to a numpy array which makes the task a bit easier

>>> import numpy as np
>>> a = np.ones((4,5),dtype=int)
>>> b = np.ones((4,5), dtype=int)*5
>>>
>>> # This is a constructed 'cliff'
>>>
>>> cliff = np.c_[(a,b)]
>>> cliff
array([[1, 1, 1, 1, 1, 5, 5, 5, 5, 5],
       [1, 1, 1, 1, 1, 5, 5, 5, 5, 5],
       [1, 1, 1, 1, 1, 5, 5, 5, 5, 5],
       [1, 1, 1, 1, 1, 5, 5, 5, 5, 5]])
>>> 
>>> np.diff(cliff)
array([[0, 0, 0, 0, 4, 0, 0, 0, 0],
       [0, 0, 0, 0, 4, 0, 0, 0, 0],
       [0, 0, 0, 0, 4, 0, 0, 0, 0],
       [0, 0, 0, 0, 4, 0, 0, 0, 0]])
>>>
>>> # note that the elevation and its value are readily visible
>>>
>>> # a different cliff
>>> a = np.arange(10).reshape(5,2)
>>> b = a[::-1]
>>> cliff = np.c_[(a,b)]
>>> 
>>> cliff
array([[0, 1, 8, 9],
       [2, 3, 6, 7],
       [4, 5, 4, 5],
       [6, 7, 2, 3],
       [8, 9, 0, 1]])
>>> np.diff(cliff)
array([[ 1,  7,  1],
       [ 1,  3,  1],
       [ 1, -1,  1],
       [ 1, -5,  1],
       [ 1, -9,  1]])
>>> np.abs(np.diff(cliff))  # now take the abs if direction is to be removed
array([[1, 7, 1],
       [1, 3, 1],
       [1, 1, 1],
       [1, 5, 1],
       [1, 9, 1]])
>>> 

you can mess around with the concepts.  In the above examples, a first order difference is obtained between adjoining raster cells.  Slope sort of does this, but with numpy arrays, you can really play with the outputs. and decide what you consider a threshold value for a 'cliff'.  If you need to return an array of the exact size, this can also be accomplished, but it is basically a small detail.

So once you have decided on you approach, you can examine the 'slope' and/or 'curvature' functions built within arcmap itself which can be used to a similar affect if you don't want to go to rastertonumpyarray then numpyarraytoraster for the conversions.

0 Kudos