Single Node Baselevel Handler

SingleNodeBaselevelHandler changes elevation for a boundary node.

class SingleNodeBaselevelHandler(grid, outlet_id=0, modify_outlet_id=True, lowering_rate=None, lowering_file_path=None, model_end_elevation=None, **kwargs)[source]

Bases: object

Control the elevation of a single open boundary node.

The SingleNodeBaselevelHandler controls the elevation of a single open boundary node, referred to here as the outlet. The outlet lowering rate is specified either as a constant or through a time or through a text file that specifies the elevation change through time.

The SingleNodeBaselevelHandler expects that topographic__elevation is an at-node model grid field. It will modify this field and, if it exists, the field bedrock__elevation.

Note that SingleNodeBaselevelHandler increments time at the end of the run_one_step method.

__init__(grid, outlet_id=0, modify_outlet_id=True, lowering_rate=None, lowering_file_path=None, model_end_elevation=None, **kwargs)[source]
Parameters
  • grid (landlab model grid) –

  • outlet_id (int, optional) – Node ID of the outlet node. Default value is 0.

  • modify_outlet_id (boolean, optional) – Flag to indicate if the outlet node or all other nodes will be modified. Default is True, indicating that the outlet node will be modified.

  • lowering_rate (float, optional) – Lowering rate of the outlet node. One of lowering_rate and lowering_file_path is required. Units are implied by the model grids spatial scale and the time units of step. Negative values mean that the outlet lowers.

  • lowering_file_path (str, optional) – Lowering lowering history file path. One of lowering_rate and lowering_file_path is required. Units are implied by the model grids spatial scale and the time units of step. This file should be readable with np.loadtxt(filename, skiprows=1, delimiter=",") Its first column is time and its second column is the elevation change at the outlet since the onset of the model run. Negative values mean the outlet lowers.

  • model_end_elevation (float, optional) – Elevation of the outlet at the end of the model run duration. When the outlet is lowered based on a lowering_file_path, a model_end_elevation can be set such that lowering is scaled based on the starting and ending outlet elevation. Default behavior is to not scale the lowering pattern.

Examples

Start by creating a landlab model grid.

>>> from landlab import RasterModelGrid
>>> mg = RasterModelGrid((5, 5))
>>> z = mg.add_zeros("node", "topographic__elevation")
>>> print(z.reshape(mg.shape))
[[ 0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.]]

Now import the SingleNodeBaselevelHandler and instantiate.

>>> from terrainbento.boundary_handlers import (
...                                         SingleNodeBaselevelHandler)
>>> bh = SingleNodeBaselevelHandler(mg,
...                                 outlet_id = 0,
...                                 lowering_rate = -0.1)
>>> bh.run_one_step(10.0)

We should expect that node 0 has lowered by one, to an elevation of -1.

>>> print(z.reshape(mg.shape))
[[-1.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.]]

More complex baselevel histories can be provided with a lowering_file_path.

run_one_step(step)[source]

Run SingleNodeBaselevelHandler to update outlet node elevation.

The run_one_step method provides a consistent interface to update the terrainbento boundary condition handlers.

In the run_one_step routine, the SingleNodeBaselevelHandler will change the elevation of the outlet node based on inputs specified at instantiation.

Note that SingleNodeBaselevelHandler increments time at the end of the run_one_step method.

Parameters

step (float) – Duration of model time to advance forward.