analyze DEM raster to find largest area of elevation interval

965
7
11-27-2020 01:09 PM
Labels (1)
DoritProtze
New Contributor

Hello!

I have a DEM, which I would like to analyze. I need to find the range of 45 elevation-cm, which covers the largest area of my DEM.

It sounds like the answer lies in the histogram, but I've no idea how to find it and would be very happy about any kind of help...

Thanks already in advance,
Dorit

0 Kudos
7 Replies
DavidPike
MVP Frequent Contributor

Are you saying you want to calculate the amount of 45cm cell values in your DEM?

The method would be similar to this one:

Re: How to calculate percentage of land covered by... - GeoNet, The Esri Community

 

If you need the area, multiply the count by the pixel size.

0 Kudos
DoritProtze
New Contributor

Hey, David!

Thanks for answering. The answer to your question is no.

My problem is the following: I want to rewet an area. My goal is to lift the water level into a range from 15 below to 30 cm above ground level for the largest area possible. I want to know whether that optimal range of 45 cm is from 5.55 to 5.10 m NHN or 6.55 to 6.10 m NHN, as an example... I hope this explains it better...

0 Kudos
DavidPike
MVP Frequent Contributor

Not sure what NHN is, I think raising the water above ground level would take some of the Hydrology toolsets to model, but I'm not smart enough to advise on those.  Also I'm sorry, I really don't understand the question either, maybe its a translation issue.  Good luck.

0 Kudos
DanPatterson
MVP Esteemed Contributor

Not quite sure on my interpretation either... but, if you want to get an elevation range, you query for it.  This yields a boolean array where 1 indicates the area is within the range and 0 otherwise.
Now when you mention the "largest area" for your dem.  I am not sure whether you mean in total or an area within your dem outline.

If it is is the former, I am suspecting that you are wanting a sliding query (eg. 0-45, 10-55, 20-65) to effectively produce a "histogram" albeit in raster format.
If it is the latter and you are looking for the largest area within the raster that meets the query, then you would want to use a RegionGroup on the query.  You will then have sequentially numbers all the areas within the total area that are classed as 1.  You then need to derive the largest area from that raster table.

If it is a combination of the two, that just gets a bit messier.

Of course, numpy is my goto demo for this

dem = np.random.randint(0, 50, size=(10, 10))  # --- let's make some terrain
w = np.logical_and(dem > 10, dem <= 20)  # --- query for an elevation range
# ----- lets have a look-see
dem  # --- elevations in Randomville
array([[44, 27,  4, 12, 14,  9, 34, 38,  7, 33],
       [ 6, 25, 15,  0, 44, 11, 22, 48, 30, 25],
       [10,  8, 32, 39, 49,  5, 27,  6, 41, 37],
       [43, 25, 45, 18, 16, 46, 29, 37,  6, 40],
       [46, 33, 48, 31,  0, 13, 30, 15, 18, 43],
       [49, 41, 27, 46,  3, 17, 45, 13,  7, 28],
       [44, 14,  7, 19,  0, 45, 14, 39, 33, 46],
       [11, 34, 19,  2,  8, 22, 39, 42, 28, 22],
       [ 3, 32, 45, 20,  8,  3, 10, 26,  6,  2],
       [48, 17, 13, 24, 28, 48, 35,  2, 47, 16]])

w  # ---- the "where" mask for the query
array([[0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
       [0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 1, 0, 1, 1, 0],
       [0, 0, 0, 0, 0, 1, 0, 1, 0, 0],
       [0, 1, 0, 1, 0, 0, 1, 0, 0, 0],
       [1, 0, 1, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
       [0, 1, 1, 0, 0, 0, 0, 0, 0, 1]])

np.ma.masked_inside(dem, 10, 21)
masked_array(
  data=[[44, 27, 4, -, -, 9, 34, 38, 7, 33],
        [6, 25, -, 0, 44, -, 22, 48, 30, 25],
        [-, 8, 32, 39, 49, 5, 27, 6, 41, 37],
        [43, 25, 45, -, -, 46, 29, 37, 6, 40],
        [46, 33, 48, 31, 0, -, 30, -, -, 43],
        [49, 41, 27, 46, 3, -, 45, -, 7, 28],
        [44, -, 7, -, 0, 45, -, 39, 33, 46],
        [-, 34, -, 2, 8, 22, 39, 42, 28, 22],
        [3, 32, 45, -, 8, 3, -, 26, 6, 2],
        [48, -, -, 24, 28, 48, 35, 2, 47, -]],
  mask=[[0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
        [0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 1, 0, 1, 1, 0],
        [0, 0, 0, 0, 0, 1, 0, 1, 0, 0],
        [0, 1, 0, 1, 0, 0, 1, 0, 0, 0],
        [1, 0, 1, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 1, 0, 0, 1, 0, 0, 0],
        [0, 1, 1, 0, 0, 0, 0, 0, 0, 1]],
  fill_value=999999)

 

Then you can incrementally "slide" the elevation range, and redo, get the sums, largest contingent area and the like.

I am sure this can be implemented in the raster functions if you want to work within Pro and get maps of the outputs as you go along.  But this should give you an idea of what can be done, since a raster is nothing more than an array... and numpy is all about arrays


... sort of retired...
0 Kudos
DoritProtze
New Contributor

Hello, Dan!

Thank you for your detailed answer and I apologize for the insufficient description of my problem. I think your first suggestion is correct, that I'm looking for a sliding query. Sadly, I have no experience with Python or NumPy, so that I have decided to choose a different approach.

Thanks again and have a nice weekend,
Dorit

0 Kudos
DanPatterson
MVP Esteemed Contributor

perhaps

Contour (3D Analyst)—ArcGIS Pro | Documentation

The options there allow you to derive various contour data.  The contour polygon will give you a continuous slice across an elevation class (like a cumulative frequency) , whereas contour-shell-up does the separation by elevation class (histogram-ish)


... sort of retired...
0 Kudos
Amadeus111
Occasional Contributor II

There is a tool to calculate surface volume 

https://pro.arcgis.com/en/pro-app/tool-reference/3d-analyst/surface-volume.htm

A similar tool is also available in ArcMap

https://desktop.arcgis.com/en/arcmap/10.3/tools/3d-analyst-toolbox/surface-volume.htm

You don't need any coding experience just find the tool and use your DEM as your elevation surface. You can calculate 2D, 3D area, volumes for different elevations levels and see which one is more. I think that is what you looking for.

0 Kudos