r-barnes / richdem

High-performance Terrain and Hydrology Analysis
GNU General Public License v3.0
271 stars 69 forks source link

Maximum DEM size for slope calculation? #55

Open JamesSample opened 2 years ago

JamesSample commented 2 years ago

Is there a limit to the size of the grids that can be handled by the slope calculations in rd.TerrainAttribute?

I'm attempting to calculate a slope map from the ArcticDEM datasets. Using the 1 km resolution grid works fine, but the 100 m resolution grid is incorrectly truncated.

The 1 km dataset is here (87 MB compressed; 220 MB in memory) and the 100 m dataset is here (7.8 GB compressed; 22 GB in memory).

A notebook illustrating successful processing of the 1 km dataset is here. However, with the higher resolution data I get the following:

import richdem as rd

dem_path = r"./arcticDEM/arcticdem_mosaic_100m_v3.0.tif"
dem = rd.LoadGDAL(dem_path)
rd.rdShow(dem, axes=False, cmap="terrain", figsize=(8, 5.5));

image

slope = rd.TerrainAttribute(dem, attrib="slope_degrees")
print("Max. slope:", slope.max(), "degrees.")
rd.rdShow(slope, axes=False, cmap="magma", figsize=(8, 5.5));

image

Does anyone have any suggestions for settings I can tweak to avoid the lower portion of the slope map being truncated like this, please? Or ideas for possible causes?

I have access to a large machine (960 GB of RAM). My code all completes without error and peak memory consumption is never more than about 150 GB, so I'm not running out of memory.

Any suggestions gratefully received!

Thanks :-)