shared_tools¶
The tools are defined in pyDeltaRCM.shared_tools
.
Shared functions¶

pyDeltaRCM.shared_tools.
set_random_seed
(_seed)¶

pyDeltaRCM.shared_tools.
get_random_uniform
(limit)¶

pyDeltaRCM.shared_tools.
get_start_indices
(inlet, inlet_weights, num_starts)¶

pyDeltaRCM.shared_tools.
get_steps
(new_cells, iwalk, jwalk)¶ Find the values giving the next step.

pyDeltaRCM.shared_tools.
random_pick
(prob)¶ Pick number from weighted array.
Randomly pick a number weighted by array probabilities (len 9) Return the index of the selected weight in array probs Takes a numpy array that is the precalculated probability around the cell flattened to 1D.

pyDeltaRCM.shared_tools.
custom_unravel
(i, shape)¶ Unravel indexes for 2D array.

pyDeltaRCM.shared_tools.
custom_ravel
(tup, shape)¶ Ravel indexes for 2D array.

pyDeltaRCM.shared_tools.
get_weight_sfc_int
(stage, stage_nbrs, qx, qy, ivec, jvec, distances)¶ Determine random walk weight surfaces.
Determines the surfaces for weighting the random walks based on the stage and discharge fields.

pyDeltaRCM.shared_tools.
_get_version
()¶ Extract version from file.
Extract version number from single file, and make it availabe everywhere.
Time scaling functions¶

pyDeltaRCM.shared_tools.
scale_model_time
(time, If=1, units='seconds')¶ Scale the model time to “real” time.
Model time is executed as assumed flooding conditions, and executed at the persecond level, with a multisecond timestep. This model design implicitly assumes that the delta is always receiving a large volume of sediment and water at the inlet. This is unrealistic, given that rivers flood only during a small portion of the year, and this is when morphodynamic activity is largest. See Time in pyDeltaRCM for a complete description of this assumption, and how to work with the assumption in configuring the model.
Using this assumption, it is possible to scale up model time to “real” time, by assuming an intermittency factor. This intermittency factor is the fraction of unittime that a river is assumed to be flooding.
where is the model time (
time
), is the “real” scaled time, is the intermittency factor, and is the scale factor to convert base units of seconds to units specified as an input argument. Note that this function uses_scale_factor
internally for this conversion. Parameters
time (
float
) – The model time, in seconds.If (
float
, optional) – Intermittency factor, fraction of time represented by morphodynamic activity. Should be in interval (0, 1]. Defaults to 1 if not provided, i.e., no scaling is performed.units (
str
, optional) – The units to convert the scaled time to. Default is to return the scaled time in seconds (seconds), but optionally supply argument days or years for unit conversion.
 Returns
scaled – Scaled time, in
units
, assuming the intermittency factorIf
. Return type
float
 Raises
ValueError – if the value for intermittency is not
0 < If <= 1
.

pyDeltaRCM.shared_tools.
_scale_factor
(If, units)¶ Scaling factor between model time and “real” time.
The scaling factor relates the model time to a real worl time, by the assumed intermittency factor and the userspecified units for output.
 Parameters
If (
float
) – Intermittency factor, fraction of time represented by morphodynamic activity. Must be in interval (0, 1].units (
str
) – The units to convert the scaled time to. Must be a string in [‘seconds’, ‘days’, ‘years’].