landlab.components.network_sediment_transporter.sediment_pulser_each_parcel¶
- class SedimentPulserEachParcel[source]¶
Bases:
SedimentPulserBase
Send pulses of sediment to specific point locations within the channel network and divide the pulses into parcels. Pulses may be any volume. Parcels must be less than or equal to a user specified maximum volume.
SedimentPulserEachParcel is instantiated by specifying the network model grid it will pulse the parcels into
SedimentPulserEachParcel is run (adds parcels to DataRecrod) by calling the SedimentPulserEachParcel instance with the time that pulses are added to the channel network and a sediment pulse table (PulseDF)
PulseDF is a pandas dataframe. At a minimum, the dataframe must have columns ‘Link#’ ‘normalized_downstream_distance’ and ‘pulse_volume’. Optionally, the parcel volume that the pulse is divided into and grain characteristics of each pulse can also be specified in PulseDF.
Examples
>>> import numpy as np >>> import pandas as pd >>> from landlab import NetworkModelGrid
Create the network model grid. Pulses are added to the links of the network model grid.
>>> y_of_node = (0, 100, 200, 200, 300, 400, 400, 125) >>> x_of_node = (0, 0, 100, -50, -100, 50, -150, -100) >>> nodes_at_link = ((1, 0), (2, 1), (1, 7), (3, 1), (3, 4), (4, 5), (4, 6)) >>> grid = NetworkModelGrid((y_of_node, x_of_node), nodes_at_link) >>> grid.at_link["channel_width"] = np.full(grid.number_of_links, 1.0) # m >>> grid.at_link["channel_slope"] = np.full(grid.number_of_links, 0.01) # m / m >>> grid.at_link["reach_length"] = np.full(grid.number_of_links, 100.0) # m
Instantiate ‘SedimentPulserEachParcel’
>>> make_pulse = SedimentPulserEachParcel(grid)
Define the PulseDF and time of the pulse
>>> PulseDF = pd.DataFrame( ... { ... "pulse_volume": [0.2, 1, 1.1, 0.5], ... "link_#": [1, 3, 5, 2], ... "normalized_downstream_distance": [0.8, 0.7, 0.5, 0.2], ... } ... ) >>> time = 7
Run the instance
>>> parcels = make_pulse(time, PulseDF)
This should yield a UserWarning: Parcels not provided, created a new DataRecord
check element_id of each parcel
>>> print(parcels.dataset["element_id"].values) [[1] [3] [3] [5] [5] [5] [2]]
instantiate SedimentPulserEachParcel
- Parameters:
grid (ModelGrid) – landlab ModelGrid to place sediment parcels on.
parcels (landlab DataRecord, optional) – Tracks parcel location and attributes
D50 (float, optional) – median grain size [m]
D84_D50 (float, optional) – ratio of 84th percentile grain size to the median grain size
rho_sediment (float, optional) – Sediment grain density [kg/m^3].
parcel_volume (float, optional) – parcel volume [m^3]
abrasion_rate (float, optional) – volumetric abrasion exponent [1/m]
- __call__(time, PulseDF=None)[source]¶
specify the location and attributes of each pulse of material added to a Network Model Grid DataRecord
- Parameters:
time (integer or datetime64 value equal to nst.time) – time that the pulse is triggered in the network sediment transporter
PulseDF (pandas dataframe) – each row contains information on the deposition location and volume of a single pulse of sediment. The pulse is divided into ‘n’ number of parcels, where ‘n’ equals the np.ceil(pulse volume / parcel volume) For details on the format of the DataFrame, see the docstring for function _sediment_pulse_dataframe
- Returns:
a DataRecord containing all information on each individual parcel
- Return type:
self._parcels
- __init__(grid, parcels=None, D50=0.05, D84_D50=2.1, rho_sediment=2650.0, parcel_volume=0.5, abrasion_rate=0.0, rng=None)[source]¶
instantiate SedimentPulserEachParcel
- Parameters:
grid (ModelGrid) – landlab ModelGrid to place sediment parcels on.
parcels (landlab DataRecord, optional) – Tracks parcel location and attributes
D50 (float, optional) – median grain size [m]
D84_D50 (float, optional) – ratio of 84th percentile grain size to the median grain size
rho_sediment (float, optional) – Sediment grain density [kg/m^3].
parcel_volume (float, optional) – parcel volume [m^3]
abrasion_rate (float, optional) – volumetric abrasion exponent [1/m]
- static __new__(cls, *args, **kwds)¶
- cite_as = ''¶
- property coords¶
Return the coordinates of nodes on grid attached to the component.
- property current_time¶
Current time.
Some components may keep track of the current time. In this case, the
current_time
attribute is incremented. Otherwise it is set to None.- Return type:
current_time
- definitions = ()¶
- classmethod from_path(grid, path)¶
Create a component from an input file.
- property grid¶
Return the grid attached to the component.
- initialize_optional_output_fields()¶
Create fields for a component based on its optional field outputs, if declared in _optional_var_names.
This method will create new fields (without overwrite) for any fields output by the component as optional. New fields are initialized to zero. New fields are created as arrays of floats, unless the component also contains the specifying property _var_type.
- initialize_output_fields(values_per_element=None)¶
Create fields for a component based on its input and output var names.
This method will create new fields (without overwrite) for any fields output by, but not supplied to, the component. New fields are initialized to zero. Ignores optional fields. New fields are created as arrays of floats, unless the component specifies the variable type.
- Parameters:
values_per_element (int (optional)) – On occasion, it is necessary to create a field that is of size (n_grid_elements, values_per_element) instead of the default size (n_grid_elements,). Use this keyword argument to acomplish this task.
- input_var_names = ()¶
- name = 'SedimentPulserEachParcel'¶
- optional_var_names = ()¶
- output_var_names = ()¶
- property shape¶
Return the grid shape attached to the component, if defined.
- unit_agnostic = False¶
- units = ()¶
- classmethod var_definition(name)¶
Get a description of a particular field.
- Parameters:
name (str) – A field name.
- Returns:
A description of each field.
- Return type:
tuple of (name, *description*)
- classmethod var_help(name)¶
Print a help message for a particular field.
- Parameters:
name (str) – A field name.
- classmethod var_loc(name)¶
Location where a particular variable is defined.
- var_mapping = ()¶