How to identify a 25 sq. m zone with a certain slope

284
1
09-06-2022 05:39 PM
Labels (1)
MinnaRubio
New Contributor

Hi there!

I'm doing a terrain analysis and looking to find zones in a global mosaic that are less than 10 degrees.

The area dimensions I'm interested in are 5m x 5m.

Any advice?

0 Kudos
1 Reply
JohannesLindner
MVP Frequent Contributor

Searching globally for a 5x5 meter cell? What are you doing?

Does it have to be a square or do you just care about area?

 

This works for a simple raster. Haven't tested on a mosaic, and I'm not sure how to handle the resampling on a mosaic if the rasters have different cell sizes.

import arcpy

# load the dem
dem = arcpy.sa.Raster("MosaicPath")

# resample to cellsize of 5m
in_cell_size = dem.getRasterInfo().getCellSize()
resampled_dem = arcpy.sa.Resample(dem, "Bilinear", in_cell_size, 5)

# calculate slope
slope = arcpy.sa.Slope(resampled_dem)

# create a binary raster of slope < 10 (1) or >= 10 (0)
low_slope = arcpy.sa.Con(slope, 1, 0, "VALUE < 10")

# save the result
low_slope.save("C:/Path/low_slope.tif")

 

Each cell of low_slope is 5x5 meters. Each cell with Value 1 has a slope of < 10°.

 

DEM:

JohannesLindner_0-1662560546679.png

 

Output:

JohannesLindner_1-1662560648603.png

 


Have a great day!
Johannes
0 Kudos