Skip to content

substrate.py

Substrates


              flowchart TD
              erosionfront.geomorphic.substrate.Substrates[Substrates]

              

              click erosionfront.geomorphic.substrate.Substrates href "" "erosionfront.geomorphic.substrate.Substrates"
            

Substrate type enumeration.

Attributes

L1: str = "single-layer" Uniform substrate.

str = "double-layer"

Two-layer (horizontal) sandwich substrate model.

str = "multi-layer"

Multilayer (horizontal) sandwich substrate model.

BaseSubstrate dataclass

BaseSubstrate(
    type: str = "",
    label: str = "",
    η_upperlayer: float = 0.1,
    η_hardtopbase: float = 1e-06,
    nz_hardtop: int = 10,
    do_hardtop: bool = True,
    do_hardbase: bool = True,
)

Container for bedrock substrate info.

Parameters

η_upperlayer: float = 0.1 Erodibility (ξ function scaling constant) of upper layer, assuming a two-layer sandwich substrate. Usually the upper layer is stronger than the lower layer, so this number is <1 by default. η_hardtopbase: float = 1e-6 Erodibility of thin upper cap and lower base layer, usually set to be very low so as to prevent substantial erosion of the mesa top and suppress spurious boundary effects at the base. nz_hardtop: int = 10 Number of (vertical) pixels defining thickness of the cap layer. do_hardtop: bool = True Choose whether to implement the hard cap or not. do_hardbase: bool = True Choose whether to implement the hard base or not.

Attributes

type: str = "" Substrate type (long-form). One of: single-layer, double-layer, multi-layer. Set by choose_substrate. label: str = "" Substrate type (short-form). Set by choose_substrate. η_upperlayer: float = 0.1 Erodibility (ξ function scaling constant) of upper layer, assuming a two-layer sandwich substrate. Usually the upper layer is stronger than the lower layer, so this number is <1 by default. η_hardtopbase: float = 1e-6 Erodibility of thin upper cap and lower base layer, usually set to be very low so as to prevent substantial erosion of the mesa top and suppress spurious boundary effects at the base. nz_hardtop: int = 10 Number of (vertical) pixels defining thickness of the cap layer. do_hardtop: bool = True Choose whether to implement the hard cap or not. do_hardbase: bool = True Choose whether to implement the hard base or not.

Methods:

  • __post_init__

    Supply default values for unspecified parameters. Generate bounds etc.

__post_init__

__post_init__() -> None

Supply default values for unspecified parameters. Generate bounds etc.

Source code in erosionfront/geomorphic/substrate.py
def __post_init__(self) -> None:
    """
    Supply default values for unspecified parameters. Generate bounds etc.
    """
    if self.type not in Substrates._value2member_map_.keys():
        raise ValueError("Invalid substrate type")
    substrate_labels: dict = {
        Substrates.L1: "1L",
        Substrates.L2: "2L",
        Substrates.LM: "ML"
    }
    self.label = substrate_labels[self.type]

OneLayerSubstrate dataclass

OneLayerSubstrate(
    type: str = "",
    label: str = "",
    η_upperlayer: float = 0.1,
    η_hardtopbase: float = 1e-06,
    nz_hardtop: int = 10,
    do_hardtop: bool = True,
    do_hardbase: bool = True,
)

              flowchart TD
              erosionfront.geomorphic.substrate.OneLayerSubstrate[OneLayerSubstrate]
              erosionfront.geomorphic.substrate.BaseSubstrate[BaseSubstrate]

                              erosionfront.geomorphic.substrate.BaseSubstrate --> erosionfront.geomorphic.substrate.OneLayerSubstrate
                


              click erosionfront.geomorphic.substrate.OneLayerSubstrate href "" "erosionfront.geomorphic.substrate.OneLayerSubstrate"
              click erosionfront.geomorphic.substrate.BaseSubstrate href "" "erosionfront.geomorphic.substrate.BaseSubstrate"
            

Single-layer, homogeneous substrate.

Functionality entirely inherited from base class BaseSubstrate.

Methods:

  • __post_init__

    Supply default values for unspecified parameters. Generate bounds etc.

__post_init__

__post_init__() -> None

Supply default values for unspecified parameters. Generate bounds etc.

Source code in erosionfront/geomorphic/substrate.py
def __post_init__(self) -> None:
    """
    Supply default values for unspecified parameters. Generate bounds etc.
    """
    if self.type not in Substrates._value2member_map_.keys():
        raise ValueError("Invalid substrate type")
    substrate_labels: dict = {
        Substrates.L1: "1L",
        Substrates.L2: "2L",
        Substrates.LM: "ML"
    }
    self.label = substrate_labels[self.type]

TwoLayerSubstrate dataclass

TwoLayerSubstrate(
    type: str = "",
    label: str = "",
    η_upperlayer: float = 0.1,
    η_hardtopbase: float = 1e-06,
    nz_hardtop: int = 10,
    do_hardtop: bool = True,
    do_hardbase: bool = True,
)

              flowchart TD
              erosionfront.geomorphic.substrate.TwoLayerSubstrate[TwoLayerSubstrate]
              erosionfront.geomorphic.substrate.BaseSubstrate[BaseSubstrate]

                              erosionfront.geomorphic.substrate.BaseSubstrate --> erosionfront.geomorphic.substrate.TwoLayerSubstrate
                


              click erosionfront.geomorphic.substrate.TwoLayerSubstrate href "" "erosionfront.geomorphic.substrate.TwoLayerSubstrate"
              click erosionfront.geomorphic.substrate.BaseSubstrate href "" "erosionfront.geomorphic.substrate.BaseSubstrate"
            

Two-layer (horizontal sandwich) substrate BaseSubstrate.

Functionality entirely inherited from base class.

Methods:

  • __post_init__

    Supply default values for unspecified parameters. Generate bounds etc.

__post_init__

__post_init__() -> None

Supply default values for unspecified parameters. Generate bounds etc.

Source code in erosionfront/geomorphic/substrate.py
def __post_init__(self) -> None:
    """
    Supply default values for unspecified parameters. Generate bounds etc.
    """
    if self.type not in Substrates._value2member_map_.keys():
        raise ValueError("Invalid substrate type")
    substrate_labels: dict = {
        Substrates.L1: "1L",
        Substrates.L2: "2L",
        Substrates.LM: "ML"
    }
    self.label = substrate_labels[self.type]

MultiLayerSubstrate dataclass

MultiLayerSubstrate(
    type: str = "",
    label: str = "",
    η_upperlayer: float = 0.1,
    η_hardtopbase: float = 1e-06,
    nz_hardtop: int = 10,
    do_hardtop: bool = True,
    do_hardbase: bool = True,
)

              flowchart TD
              erosionfront.geomorphic.substrate.MultiLayerSubstrate[MultiLayerSubstrate]
              erosionfront.geomorphic.substrate.BaseSubstrate[BaseSubstrate]

                              erosionfront.geomorphic.substrate.BaseSubstrate --> erosionfront.geomorphic.substrate.MultiLayerSubstrate
                


              click erosionfront.geomorphic.substrate.MultiLayerSubstrate href "" "erosionfront.geomorphic.substrate.MultiLayerSubstrate"
              click erosionfront.geomorphic.substrate.BaseSubstrate href "" "erosionfront.geomorphic.substrate.BaseSubstrate"
            

Multi-layer (horizontal sandwich) substrate.

Functionality largely inherited from base class BaseSubstrate.

Parameters

multilayer_n_levels: int = 3 (Odd) number of sandwich layers. multilayer_dz: float | None = None Relative thickness of 'filling' sandwich layer(s) (for normalized height).

Attributes

multilayer_n_levels: int = 3 (Odd) number of sandwich layers. multilayer_dz: float | None = None Relative thickness of 'filling' sandwich layer(s) (for normalized height). multilayer_z_levels: NDArray Heights (z) of centerlines of layers. Just [0.5] for 3 layers.

choose_substrate

choose_substrate(
    parameters: dict,
) -> OneLayerSubstrate | TwoLayerSubstrate | MultiLayerSubstrate

Choose substrate model.

Parameters

dict: Dictionary of keyword arguments to be passed to instantiate a substrate class. Choice of substrate type is specified in the parameters['type'] element.

Returns

OneLayerSubstrate | TwoLayerSubstrate | MultiLayerSubstrate: An instance of these substrate classes. Instantiation takes **parameters as keyword arguments.

Source code in erosionfront/geomorphic/substrate.py
def choose_substrate(parameters: dict,) -> (
          OneLayerSubstrate 
        | TwoLayerSubstrate
        | MultiLayerSubstrate
    ):
    """
    Choose substrate model.

    Parameters
    ----------
    dict: 
        Dictionary of keyword arguments to be passed to instantiate
        a substrate class. Choice of substrate type is specified in
        the `parameters['type']` element.

    Returns
    -------
    OneLayerSubstrate | TwoLayerSubstrate | MultiLayerSubstrate:
        An instance of these substrate classes. 
        Instantiation takes `**parameters` as keyword arguments.

    """
    substrates: dict = {
        Substrates.L1 : OneLayerSubstrate,
        Substrates.L2 : TwoLayerSubstrate,
        Substrates.LM : MultiLayerSubstrate
    }
    return substrates[parameters["type"]](**parameters)