dem_slope — DEM surface op

• Data kinds: depth → image2d

• Call: import fullseye as fs; fs.ledger.dem_slope(dem, cell_size, method='horn', units='degrees') (to call the implementation directly, import demops; demops.dem_slope(dem, cell_size, method='horn', units='degrees'); from the registry, opsdem.get("dem_slope"))

Usage

Slope angle. units is "degrees" / "radians" / "percent".

On a plane it agrees with the closed form atan(|grad|) (measured 1e-13 or less).

Procedure: from the 3x3 neighbourhood take dz/dx (eastward) and dz/dy (northward = direction of decreasing row), then g = hypot(dz/dx, dz/dy). "degrees" gives atan(g) in degrees, "radians" in radians, "percent" gives 100 g (45 degrees = 100 %). Edges are padded by replicating the border values (pad mode="edge"), so the outermost 1 cell comes out gentler than the interior.

• dem: (H, W) elevation [m], 3x3 or larger, real, no inf. Pass missing data as nan ―― if sentinel values like -9999 are left in (<= -9000 present and no nan), it is rejected. nan propagates over the 3x3 range.

• cell_size: cell edge length [m], positive finite. bool / strings rejected. For lat/lon grids use dem_geodetic_slope instead.

• method: "horn" (Horn 1981 3x3 weighted difference, default) / "central" (Zevenbergen–Thorne central difference).

• Return value: (H, W) float64. degrees is in [0, 90).

• All failures are ValueError (shape, sentinel values, cell_size, choices).

Used together with dem_aspect. dem_hillshade builds shading from these 2.

Detailed usage guide

• dem_terrain_analysis family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• dem_geodesy_tour — py -3.11 examples/dem_geodesy_tour.py

• poc_crop_phenotyping — py -3.11 examples/poc_crop_phenotyping.py

• poc_dem_terrain — py -3.11 examples/poc_dem_terrain.py

• poc_geodetic_height_frames — py -3.11 examples/poc_geodetic_height_frames.py

• poc_lidar_terrain_change — py -3.11 examples/poc_lidar_terrain_change.py

• poc_multibeam_bathymetry — py -3.11 examples/poc_multibeam_bathymetry.py

• poc_stockpile_volume — py -3.11 examples/poc_stockpile_volume.py

Ops the type connects to (they accept image2d as input)

—

Same category (surface)

dem_aspect · dem_curvature · dem_roughness · dem_tpi


*Provenance: demops.py — DEM operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.