landlab.ca.boundaries package#

Submodules#

landlab.ca.boundaries.hex_lattice_tectonicizer module#

hex_lattice_tectonicizer.py.

Models discrete normal-fault offset on a 2D hex lattice with a rectangular node layout and with one orientation of the nodes being vertical.

The intention here is to use a particle (LCA) model to represent the evolution of a 2D hillslope, with the hex_lattice_tectonicizer serving to shift the nodes either upward (simple vertical uplift relative to baselevel), or up and sideways (representing motion on a fault plane).

Created on Mon Nov 17 08:01:49 2014

@author: gtucker

class HexLatticeTectonicizer(grid=None, node_state=None, propid=None, prop_data=None, prop_reset_value=None)[source]#

Bases: object

Handles tectonics and baselevel for CellLab-CTS models.

This is the base class from which classes to represent particular baselevel/fault geometries are derived.

Examples

>>> hlt = HexLatticeTectonicizer()
>>> hlt.grid.number_of_nodes
25
>>> hlt.nr
5
>>> hlt.nc
5

Create and initialize a HexLatticeTectonicizer.

Examples

>>> from landlab import HexModelGrid
>>> hg = HexModelGrid((6, 6), node_layout="rect")
>>> hlt = HexLatticeTectonicizer()
>>> hlt.grid.number_of_nodes
25
>>> hlt.nr
5
>>> hlt.nc
5
__init__(grid=None, node_state=None, propid=None, prop_data=None, prop_reset_value=None)[source]#

Create and initialize a HexLatticeTectonicizer.

Examples

>>> from landlab import HexModelGrid
>>> hg = HexModelGrid((6, 6), node_layout="rect")
>>> hlt = HexLatticeTectonicizer()
>>> hlt.grid.number_of_nodes
25
>>> hlt.nr
5
>>> hlt.nc
5
class LatticeNormalFault(fault_x_intercept=0.0, grid=None, node_state=None, propid=None, prop_data=None, prop_reset_value=None)[source]#

Bases: HexLatticeTectonicizer

Handles normal-fault displacement in CellLab-CTS models.

Represents a 60 degree, left-dipping normal fault, and handles discrete offsets for a hex grid with vertical columns and rectangular node_layout.

Examples

>>> import numpy as np
>>> from landlab import HexModelGrid
>>> from landlab.ca.boundaries.hex_lattice_tectonicizer import LatticeNormalFault
>>> pid = np.arange(25, dtype=int)
>>> pdata = np.arange(25)
>>> ns = np.arange(25, dtype=int)
>>> grid = HexModelGrid(
...     (5, 5), spacing=1.0, orientation='vertical', node_layout='rect'
... )
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> lnf.first_fw_col
1
>>> lnf.num_fw_rows
array([0, 1, 3, 4, 5])
>>> lnf.incoming_node
array([1, 3, 4, 6])
>>> lnf.outgoing_node
array([12, 17, 19, 22])
>>> pid = np.arange(16, dtype=int)
>>> ns = np.arange(16, dtype=int)
>>> pdata = np.arange(16)
>>> grid = HexModelGrid(
...     (4, 4), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> lnf.num_fw_rows
array([0, 1, 3, 4])
>>> lnf.incoming_node
array([1, 2, 5])
>>> lnf.outgoing_node
array([ 7, 11, 15])
>>> lnf.do_offset(rock_state=16)
>>> ns
array([ 0, 16, 16, 16,  4, 16,  6,  1,  8,  2, 10,  5, 12, 13, 14,  9])
>>> lnf.propid
array([ 0,  7, 11,  3,  4, 15,  6,  1,  8,  2, 10,  5, 12, 13, 14,  9])
>>> pid = np.arange(20, dtype=int)
>>> ns = np.arange(20, dtype=int)
>>> pdata = np.arange(20)
>>> grid = HexModelGrid(
...     (4, 5), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> lnf.incoming_node
array([1, 3, 4, 6])
>>> lnf.outgoing_node
array([12, 14, 17, 19])
>>> lnf.do_offset(rock_state=20)
>>> ns
array([ 0, 20, 20, 20, 20,  5, 20, 20,  8,  1, 10,  3,  4, 13,  6, 15, 16,
        9, 18, 11])
>>> lnf.propid
array([ 0, 12,  2, 14, 17,  5, 19,  7,  8,  1, 10,  3,  4, 13,  6, 15, 16,
        9, 18, 11])

Create and initialize a LatticeNormalFault object.

Examples

>>> import numpy as np
>>> from landlab import HexModelGrid
>>> from landlab.ca.boundaries.hex_lattice_tectonicizer import LatticeNormalFault
>>> pid = np.arange(25, dtype=int)
>>> pdata = np.arange(25)
>>> ns = np.arange(25, dtype=int)
>>> grid = HexModelGrid(
...     (5, 5), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(-0.01, grid, ns, pid, pdata, 0.0)
>>> lnf.first_fw_col
0
>>> lnf.num_fw_rows
array([1, 2, 4, 5, 5])
>>> lnf.incoming_node
array([0, 1, 3, 4, 6])
>>> lnf.outgoing_node
array([12, 17, 19, 22, 24])
>>> pid = np.arange(16, dtype=int)
>>> pdata = np.arange(16)
>>> ns = np.arange(16, dtype=int)
>>> grid = HexModelGrid(
...     (4, 4), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> lnf.first_fw_col
1
>>> lnf.num_fw_rows
array([0, 1, 3, 4])
>>> lnf.incoming_node
array([1, 2, 5])
>>> lnf.outgoing_node
array([ 7, 11, 15])
>>> pid = np.arange(45, dtype=int)
>>> pdata = np.arange(45)
>>> ns = np.arange(45, dtype=int)
>>> grid = HexModelGrid(
...     (5, 9), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> lnf.first_fw_col
1
>>> lnf.num_fw_rows
array([0, 1, 3, 4, 5, 5, 5, 5, 5])
>>> lnf.incoming_node
array([ 1,  2,  3,  5,  6,  7,  8, 10, 11, 12])
>>> lnf.outgoing_node
array([22, 31, 33, 34, 35, 38, 39, 40, 43, 44])
__init__(fault_x_intercept=0.0, grid=None, node_state=None, propid=None, prop_data=None, prop_reset_value=None)[source]#

Create and initialize a LatticeNormalFault object.

Examples

>>> import numpy as np
>>> from landlab import HexModelGrid
>>> from landlab.ca.boundaries.hex_lattice_tectonicizer import LatticeNormalFault
>>> pid = np.arange(25, dtype=int)
>>> pdata = np.arange(25)
>>> ns = np.arange(25, dtype=int)
>>> grid = HexModelGrid(
...     (5, 5), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(-0.01, grid, ns, pid, pdata, 0.0)
>>> lnf.first_fw_col
0
>>> lnf.num_fw_rows
array([1, 2, 4, 5, 5])
>>> lnf.incoming_node
array([0, 1, 3, 4, 6])
>>> lnf.outgoing_node
array([12, 17, 19, 22, 24])
>>> pid = np.arange(16, dtype=int)
>>> pdata = np.arange(16)
>>> ns = np.arange(16, dtype=int)
>>> grid = HexModelGrid(
...     (4, 4), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> lnf.first_fw_col
1
>>> lnf.num_fw_rows
array([0, 1, 3, 4])
>>> lnf.incoming_node
array([1, 2, 5])
>>> lnf.outgoing_node
array([ 7, 11, 15])
>>> pid = np.arange(45, dtype=int)
>>> pdata = np.arange(45)
>>> ns = np.arange(45, dtype=int)
>>> grid = HexModelGrid(
...     (5, 9), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> lnf.first_fw_col
1
>>> lnf.num_fw_rows
array([0, 1, 3, 4, 5, 5, 5, 5, 5])
>>> lnf.incoming_node
array([ 1,  2,  3,  5,  6,  7,  8, 10, 11, 12])
>>> lnf.outgoing_node
array([22, 31, 33, 34, 35, 38, 39, 40, 43, 44])

Update state and schedule new transition for given link.

do_offset(ca=None, current_time=0.0, rock_state=1)[source]#

Apply 60-degree normal-fault offset.

Offset is applied to a hexagonal grid with vertical node orientation and rectangular arrangement of nodes.

Parameters

rock_state (int) – State code to apply to new cells introduced along bottom row.

Examples

>>> import numpy as np
>>> from landlab.ca.boundaries.hex_lattice_tectonicizer import LatticeNormalFault
>>> from landlab import HexModelGrid
>>> from landlab.ca.oriented_hex_cts import OrientedHexCTS
>>> from landlab.ca.celllab_cts import Transition
>>> pid = np.arange(25, dtype=int)
>>> pdata = np.arange(25)
>>> ns = np.arange(25, dtype=int)
>>> grid = HexModelGrid(
...     (5, 5), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> lnf.do_offset(rock_state=25)
>>> ns
array([ 0, 25, 25, 25, 25,  5, 25, 25,  8,  1, 10,  3,  4, 13,  6, 15, 16,
        9, 18, 11, 20, 21, 14, 23, 24])
>>> lnf.propid
array([ 0, 12,  2, 17, 19,  5, 22,  7,  8,  1, 10,  3,  4, 13,  6, 15, 16,
        9, 18, 11, 20, 21, 14, 23, 24])
>>> ns[5:] = 0
>>> ns[:5] = 1
>>> nsd = {0 : 'yes', 1 : 'no'}
>>> xnlist = []
>>> xnlist.append(Transition((0,0,0), (1,1,0), 1.0, 'test'))
>>> ohcts = OrientedHexCTS(grid, nsd, xnlist, ns)
>>> lnf = LatticeNormalFault(0.0, grid, ns, pid, pdata, 0.0)
>>> ohcts.link_state[5:33]
array([2, 0, 0, 6, 9, 0, 2, 2, 4, 8, 4, 8, 0, 0, 0, 8, 4, 8, 4, 0, 0, 4,
       8, 4, 8, 0, 0, 0])
>>> lnf.do_offset(ca=ohcts, current_time=0.0, rock_state=1)
>>> ohcts.link_state[5:33]
array([ 3,  0,  0,  7, 11,  0,  2,  3,  4,  9,  7, 11,  0,  3,  0,  8,  5,
       11,  7,  0,  2,  4,  9,  6,  9,  0,  2,  0])

Shift link data up and right.

Examples

>>> from landlab import HexModelGrid
>>> from landlab.ca.oriented_hex_cts import OrientedHexCTS
>>> from landlab.ca.celllab_cts import Transition
>>> import numpy as np
>>> mg = HexModelGrid(
...     (5, 5), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> nsd = {0 : 'yes', 1 : 'no'}
>>> xnlist = []
>>> xnlist.append(Transition((1,0,0), (1,1,0), 1.0, 'frogging'))
>>> xnlist.append(Transition((1,0,1), (1,1,1), 1.0, 'frogging'))
>>> xnlist.append(Transition((1,0,2), (1,1,2), 1.0, 'frogging'))
>>> nsg = mg.add_zeros('node', 'node_state_grid')
>>> nsg[:10] = 1
>>> pid = np.arange(25, dtype=int)
>>> pdata = np.arange(25)
>>> ohcts = OrientedHexCTS(mg, nsd, xnlist, nsg)
>>> ohcts.link_state
array([ 0,  0,  0,  0,  0,  3,  0,  0,  7, 11,  0,  3,  3,  7, 11,  7, 11,
        0,  2,  0,  9,  6,  9,  6,  2,  2,  4,  8,  4,  8,  0,  0,  0,  8,
        4,  8,  4,  0,  0,  4,  8,  4,  8,  0,  0,  0,  8,  4,  8,  4,  0,
        0,  0,  0,  0,  0])
>>> lnf = LatticeNormalFault(-0.01, mg, nsg, pid, pdata, 0.0)
>>> lnf.first_link_shifted_from
14
>>> lnf.link_offset_id
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 35, 15, 16,
       17, 38, 19, 20, 41, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
       34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
       51, 52, 53, 54, 55])
>>> lnf.shift_link_states(ohcts, 0.0)
>>> ohcts.link_state
array([ 0,  0,  0,  0,  0,  3,  0,  0,  7, 11,  0,  3,  3,  7, 11,  7, 11,
        0,  2,  0,  9,  6,  9,  6,  2,  2,  4,  8,  4,  8,  0,  0,  0,  8,
        4, 11,  4,  0,  2,  4,  8,  6,  8,  0,  0,  0,  8,  4,  8,  4,  0,
        0,  0,  0,  0,  0])
shift_scheduled_transitions(ca, current_time)[source]#

Update link IDs in scheduled events at offset links.

Examples

>>> from landlab import HexModelGrid
>>> from landlab.ca.oriented_hex_cts import OrientedHexCTS
>>> from landlab.ca.celllab_cts import Transition
>>> import numpy as np
>>> mg = HexModelGrid(
...     (5, 5), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> nsd = {0 : 'yes', 1 : 'no'}
>>> xnlist = []
>>> xnlist.append(Transition((0,0,0), (1,1,0), 1.0, 'test'))
>>> xnlist.append(Transition((0,0,1), (1,1,1), 1.0, 'test'))
>>> xnlist.append(Transition((0,0,2), (1,1,2), 1.0, 'test'))
>>> nsg = mg.add_zeros('node', 'node_state_grid')
>>> pid = np.arange(25, dtype=int)
>>> pdata = np.arange(25)
>>> ohcts = OrientedHexCTS(mg, nsd, xnlist, nsg)
>>> lnf = LatticeNormalFault(-0.1, grid=mg)
>>> pq = ohcts.priority_queue._queue
>>> (int(1000 * pq[11][0]), pq[11][1:])
(752, (11, 21))
>>> (int(1000 * pq[12][0]), pq[12][1:])
(483, (9, 18))
>>> (int(1000 * pq[30][0]), pq[30][1:])
(575, (6, 14))
>>> lnf.do_offset(ca=ohcts)
>>> (int(1000 * pq[48][0]), pq[48][1:])
(752, (11, 41))
>>> (int(1000 * pq[54][0]), pq[54][1:])
(483, (9, 38))
>>> (int(1000 * pq[61][0]), pq[61][1:])
(575, (6, 35))
class LatticeUplifter(grid=None, node_state=None, propid=None, prop_data=None, prop_reset_value=None, opt_block_layer=False, block_ID=9, block_layer_dip_angle=0.0, block_layer_thickness=1.0, layer_left_x=0.0, y0_top=0.0)[source]#

Bases: HexLatticeTectonicizer

Handles vertical uplift of interior (not edges) for a hexagonal lattice with vertical node orientation and rectangular node arrangement.

Create and initialize a LatticeUplifter.

Examples

>>> lu = LatticeUplifter()
>>> lu.inner_base_row_nodes
array([1, 3, 4])
>>> hg = HexModelGrid(
...     (5, 6), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lu = LatticeUplifter(grid=hg)
>>> lu.inner_base_row_nodes
array([1, 2, 3, 4])
__init__(grid=None, node_state=None, propid=None, prop_data=None, prop_reset_value=None, opt_block_layer=False, block_ID=9, block_layer_dip_angle=0.0, block_layer_thickness=1.0, layer_left_x=0.0, y0_top=0.0)[source]#

Create and initialize a LatticeUplifter.

Examples

>>> lu = LatticeUplifter()
>>> lu.inner_base_row_nodes
array([1, 3, 4])
>>> hg = HexModelGrid(
...     (5, 6), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> lu = LatticeUplifter(grid=hg)
>>> lu.inner_base_row_nodes
array([1, 2, 3, 4])

Applies uplift to links and transitions.

For each link that lies above the y = 1.5 cells line, assign the properties of the link one row down.

(For an example, see unit test:

test_shift_link_and_transition_data_upward)

uplift_interior_nodes(ca, current_time, rock_state=1)[source]#

Simulate ‘vertical’ displacement by shifting contents of node_state.

Examples

>>> import numpy as np
>>> from landlab import HexModelGrid
>>> from landlab.ca.hex_cts import HexCTS
>>> from landlab.ca.celllab_cts import Transition
>>> mg = HexModelGrid(
...     (5, 5), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> nsd = {}
>>> for i in range(26):
...     nsd[i] = i
>>> xnlist = []
>>> xnlist.append(Transition((0,0,0), (1,1,0), 1.0, 'frogging', True))
>>> nsg = mg.add_zeros('node', 'node_state_grid')
>>> ca = HexCTS(mg, nsd, xnlist, nsg)
>>> pd = mg.add_zeros('node', 'propdata')
>>> lu = LatticeUplifter(propid=ca.propid, prop_data=pd)
>>> lu.node_state[:] = np.arange(len(lu.node_state))
>>> lu.uplift_interior_nodes(ca, rock_state=25, current_time=0.0)
>>> lu.node_state 
array([ 0, 25,  2, 25, 25,
        5,  1,  7,  3,  4,
       10,  6, 12,  8,  9,
       15, 11, 17, 13, 14,
       20, 16, 22, 18, 19])
>>> lu.propid 
array([ 0, 21,  2, 23, 24,
        5,  1,  7,  3,  4,
       10,  6, 12,  8,  9,
       15, 11, 17, 13, 14,
       20, 16, 22, 18, 19])
uplift_property_ids()[source]#

Shift property IDs upward by one row.

Return True if both nodes are core; False otherwise.

Return True if both nodes are boundaries; False otherwise.

Examples

>>> from landlab import HexModelGrid
>>> import numpy as np
>>> mg = HexModelGrid(
...     (3, 4), spacing=1.0, orientation="vertical", node_layout="rect"
... )
>>> is_perim_link(1, mg)
True
>>> is_perim_link(11, mg)
False

Module contents#