sequence.sequence_model module#

Build a SequenceModelGrid model from collection of components.

class sequence.sequence_model.SequenceModel(grid: SequenceModelGrid, clock: dict | None = None, processes: dict | None = None, output: dict | None = None)[source]#

Bases: object

Orchestrate a set of components that operate on a SequenceModelGrid.

ALL_PROCESSES = ('sea_level', 'subsidence', 'compaction', 'submarine_diffusion', 'fluvial', 'flexure')#
DEFAULT_PARAMS = {'bathymetry': {'filepath': 'bathymetry.csv', 'kind': 'linear'}, 'clock': {'start': 0.0, 'step': 100.0, 'stop': 600000.0}, 'compaction': {'c': 5e-08, 'porosity_max': 0.5, 'porosity_min': 0.01, 'rho_grain': 2650.0, 'rho_void': 1000.0}, 'flexure': {'isostasytime': 0, 'method': 'flexure', 'rho_mantle': 3300.0}, 'grid': {'shape': (1, 100), 'spacing': (1.0, 1000.0)}, 'output': {'clobber': True, 'fields': ['sediment_deposit__thickness', 'bedrock_surface__elevation'], 'filepath': 'sequence.nc', 'interval': 10}, 'sea_level': {'amplitude': 10.0, 'linear': 0.0, 'phase': 0.0, 'wave_length': 200000.0}, 'sediments': {'hemipelagic': 0.0, 'layers': 2, 'mud': 0.006, 'mud_density': 2720.0, 'sand': 1.0, 'sand_density': 2650.0, 'sand_frac': 0.5}, 'submarine_diffusion': {'alpha': 0.0005, 'basin_width': 500000.0, 'load_sealevel': 0.0, 'plain_slope': 0.0008, 'sediment_load': 3.0, 'shelf_slope': 0.001, 'shoreface_height': 15.0, 'wave_base': 60.0}, 'subsidence': {'filepath': 'subsidence.csv'}}#
LONG_NAME = {'z': 'topographic__elevation', 'z0': 'bedrock_surface__elevation'}#
__init__(grid: SequenceModelGrid, clock: dict | None = None, processes: dict | None = None, output: dict | None = None)[source]#

Create a model on a SequenceModelGrid.

Parameters:
  • grid (SequenceModelGrid) – The grid on which the model is run.

  • clock (dict) – Parameters for the model’s clock.

  • processes (iterable of components) – A list of the components to run as part of the model.

  • output (component) – A component used to write output files.

advance_components(dt: float) None[source]#

Update each of the components by a time step.

Parameters:

dt (float) – The time step to advance the components.

property clock: TimeStepper#

Return the model’s clock.

property components: tuple#

Return the name of enabled components.

property grid: SequenceModelGrid#

Return the model’s grid.

layer_properties() dict[str, _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]][source]#

Return the properties being tracked at each layer.

Returns:

properties – A dictionary of the tracked properties where the keys are the names of properties and the values are the property values at each column.

Return type:

dict

layer_reducers() dict[str, Any][source]#

Return layer-reducers for each property.

Returns:

reducers – A dictionary of reducers where keys are property names and values are functions that act as layer reducers for those quantities.

Return type:

dict

static load_grid(params: dict, bathymetry: dict | None = None) SequenceModelGrid[source]#

Load a SequenceModelGrid.

Parameters:
  • params (dict) – Parameters used to create the grid.

  • bathymetry (dict, optional) – Parameters used to set the initial bathymetry of the grid.

static load_processes(grid: SequenceModelGrid, processes: Iterable[str], context: dict[str, dict]) dict[source]#

Instantiate processes.

Parameters:
  • grid (SequenceModelGrid) – A Sequence grid.

  • processes (Iterable[str], optional) – List of the names of the processes to create.

  • context (dict) – A context from which to draw parameters to create the processes.

run() None[source]#

Run the model until complete.

run_one_step(dt: float | None = None) None[source]#

Run each component for one time step.

set_params(params: dict[str, dict]) None[source]#

Update the parameters for the model’s processes.

Parameters:

params (dict) – The new parameters for the processes.

timer: dict[str, float]#