fastscapelib.FlowKernelEroder

class fastscapelib.FlowKernelEroder(flow_graph, **kwargs)

Abstract flow kernel eroder class.

This helper class is for implementing a custom eroder based on a Numba flow kernel. It has the following abstract methods that must be implemented in subclasses:

  • kernel_func is the kernel function (see also create_flow_kernel())

  • param_spec and input_spec should return the names and types of the eroder parameters and inputs, respectively.

  • kernel_apply_dir should return the direction / order in which the kernel function is applied on the flow graph.

This class provides one pre-defined “erosion” output variable for the flow kernel function. It also provides the same API than other eroder classes in Fastscapelib, i.e., an erode method that takes input variable values as arguments and that returns the amount erosion computed for one time step.

Eroder parameter values should be passed as arguments of the subclass’ __init__ method, in addition to the parameters below. Those parameters may also be exposed as properties of the eroder subclass.

Parameters:
__init__(flow_graph, **kwargs)

Methods

__init__(flow_graph, **kwargs)

erode(**kwargs)

Compute and returns the amount of erosion for one time step.

input_spec()

Returns a dictionary with input variable names and their (numba) value type.

kernel_apply_dir()

Returns the kernel application direction and order.

kernel_func(node)

The eroder flow kernel function.

param_spec()

Returns a dictionary with parameter names and their (numba) value type.

Attributes

flow_graph

Returns the flow graph object used by this eroder.

kernel

Returns the (Numba) flow kernel object used by this eroder.

kernel_data

Returns the (Numba) flow kernel data object used by this eroder.

abstract static param_spec()

Returns a dictionary with parameter names and their (numba) value type.

Return type:

dict[str, Type | tuple[Type, Any]]

abstract static input_spec()

Returns a dictionary with input variable names and their (numba) value type.

Return type:

dict[str, Type | tuple[Type, Any]]

abstract static kernel_apply_dir()

Returns the kernel application direction and order.

Return type:

FlowGraphTraversalDir

abstract static kernel_func(node)

The eroder flow kernel function.

Return type:

int | None

erode(**kwargs)

Compute and returns the amount of erosion for one time step.

Return type:

ndarray

property flow_graph: FlowGraph

Returns the flow graph object used by this eroder.

property kernel: NumbaFlowKernel

Returns the (Numba) flow kernel object used by this eroder.

property kernel_data: NumbaFlowKernelData

Returns the (Numba) flow kernel data object used by this eroder.