Skip to content

Commit ae90ddc

Browse files
authored
chore: add process definitions for aspect and slope (non-standard) processes (#432)
Co-authored-by: dsamaey <diether.samaey@vito.be>
1 parent 61013cc commit ae90ddc

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

openeo_driver/ProcessGraphDeserializer.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,6 +2616,51 @@ def collect(args: ProcessArgs, env: EvalEnv):
26162616
return env[ENV_FINAL_RESULT][0]
26172617

26182618

2619+
@non_standard_process(
2620+
ProcessSpec(
2621+
id="aspect",
2622+
description="Computes the aspect from elevation data. Aspect is the direction component of a gradient vector. It is the direction in degrees of which direction the maximum change in direction is pointing at a given point. Horn's method is used to compute the aspect based on estimates of the partial derivatives dz/dx and dz/dy.",
2623+
extra={
2624+
"summary": "Compute aspect on elevation data",
2625+
"categories": ["cubes", "elevation"],
2626+
"experimental": True
2627+
}
2628+
)
2629+
.param('data',
2630+
description="Data cube containing elevation data.",
2631+
schema={"type": "object", "subtype": "raster-cube"})
2632+
.returns(
2633+
description="A data cube with calculated aspects for each band, the band names are the original band names with a '_aspect' suffix.",
2634+
schema={"type": "object", "subtype": "raster-cube"})
2635+
2636+
)
2637+
def aspect(args: ProcessArgs, env: EvalEnv) -> DriverDataCube:
2638+
cube: DriverDataCube = args.get_required("data", expected_type=DriverDataCube)
2639+
return cube.aspect()
2640+
2641+
@non_standard_process(
2642+
ProcessSpec(
2643+
id="slope",
2644+
description="Computes the slope from elevation data. Slope is the magnitude portion of the gradient vector. It is the maximum change of elevation from a raster cell to any immediate neighbor. Horn's method is used to compute the slope based on estimates of the partial derivatives dz/dx and dz/dy.",
2645+
extra={
2646+
"summary": "Compute slope on elevation data",
2647+
"categories": ["cubes", "elevation"],
2648+
"experimental": True
2649+
}
2650+
)
2651+
.param('data',
2652+
description="Data cube containing elevation data.",
2653+
schema={"type": "object", "subtype": "raster-cube"})
2654+
.returns(
2655+
description="A data cube with calculated slopes for each band, the band names are the original band names with a '_slope' suffix.",
2656+
schema={"type": "object", "subtype": "raster-cube"})
2657+
2658+
)
2659+
def slope(args: ProcessArgs, env: EvalEnv) -> DriverDataCube:
2660+
cube: DriverDataCube = args.get_required("data", expected_type=DriverDataCube)
2661+
return cube.slope()
2662+
2663+
26192664
# Finally: register some fallback implementation if possible
26202665
_register_fallback_implementations_by_process_graph(process_registry_100)
26212666
_register_fallback_implementations_by_process_graph(process_registry_2xx)

0 commit comments

Comments
 (0)