-
class
RandomPrecipitator
¶
RandomPrecipitator¶
terrainbento RandomPrecipitator.
-
class
RandomPrecipitator
(grid, distribution='uniform', **kwargs)[source]¶ Bases:
object
Generate random precipitation.
RandomPrecipitator populates the at-node field “rainfall__flux” with random values drawn from a distribution. All distributions provided in the numpy.random submodule are supported.
Examples
>>> import numpy as np >>> np.random.seed(42) >>> from landlab import RasterModelGrid >>> from terrainbento import RandomPrecipitator >>> grid = RasterModelGrid((5,5)) >>> precipitator = RandomPrecipitator(grid) >>> np.round( ... grid.at_node["rainfall__flux"].reshape(grid.shape), ... decimals=2) array([[ 0.37, 0.95, 0.73, 0.6 , 0.16], [ 0.16, 0.06, 0.87, 0.6 , 0.71], [ 0.02, 0.97, 0.83, 0.21, 0.18], [ 0.18, 0.3 , 0.52, 0.43, 0.29], [ 0.61, 0.14, 0.29, 0.37, 0.46]]) >>> precipitator.run_one_step(10) >>> np.round( ... grid.at_node["rainfall__flux"].reshape(grid.shape), ... decimals=2) array([[ 0.79, 0.2 , 0.51, 0.59, 0.05], [ 0.61, 0.17, 0.07, 0.95, 0.97], [ 0.81, 0.3 , 0.1 , 0.68, 0.44], [ 0.12, 0.5 , 0.03, 0.91, 0.26], [ 0.66, 0.31, 0.52, 0.55, 0.18]])