Carina
Carina

Reputation: 39

python calculate slope raster from DEM

I need the slope for 4 points in austria. I have the coordinates and the DEM (from opendata Austria). I found this tutorial (https://www.earthdatascience.org/tutorials/get-slope-aspect-from-digital-elevation-model/) and tried the code. But the results that I get are values like 30000.788 ... that cannot be degree? do I miss a transformation into meter? I use this code:

import richdem as rd
shasta_dem = rd.LoadGDAL(f'{project_data}dem_au.tif')
slope = rd.TerrainAttribute(shasta_dem, attrib='slope_riserun')
rd.SaveGDAL(f'{project_data}dem_slope.tif', slope)

the picture looks great, but the values... I do not understand them! Slope-Map for Austria

The Dem has values from 105 to 3736, if that would be meter it is correct for Austria, but in the describtion it says the DEM scale units are degrees? DEM Austria Can someone explain that to me,please?

Upvotes: 1

Views: 3124

Answers (2)

Shawn
Shawn

Reputation: 382

For your original question the issue was likely with the scale. In richdem you can use the zscale argument when the pixel resolution unit does not match the elevation unit, for example with the pixel resolution is in degrees (lat/lon) and the elevation unit is in meters.

Here is an explanation from the same function in gdal.

If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can use scale=111120 if the vertical units are meters (or scale=370400 if they are in feet).

Upvotes: 1

Carina
Carina

Reputation: 39

I managed to calculate the slope! The problem was the DEM. It had strange dimensions, with another, more precise DEM from open data it worked fine : )

Upvotes: 0

Related Questions