Landlab Framework#

Submodules#

landlab.framework.component module#

Utility functions for loading components for The Landlab.

iscomponent(value, cls)[source]#

Check if value is a component for The Landlab. value is a component if it implements the cls or it is an instance of cls.

Returns True if value is a component, otherwise False.

load_components(cls, paths=None)[source]#

Load components from a series of directories.

Components found earlier in the search path order override those discovered later. Use the paths keyword to specify a list of paths to search for components.

load_components_from_dir(path, cls)[source]#

Look for components for Landlab in path.

Identify components as being an instance of cls. Returns a dictionary of discovered component names as keys and component classes as values.

load_landlab_components(paths=None)[source]#

Load components for The Landlab. These are classes that implement BmiBase. See load_components_from_dir for the meaning of paths keyword.

landlab.framework.decorators module#

Decorators for TheLandlab package.

camel_case(text, sep=None)[source]#

Convert to camel case.

Convert text to camel case. Use the sep keyword to specify the word separator. The default is to split on whitespace.

>>> from landlab.framework.decorators import camel_case
>>> camel_case("eric idle")
'EricIdle'
>>> camel_case("terry_gilliam", sep="_")
'TerryGilliam'
>>> camel_case("MONTY Python")
'MONTYPython'
>>> camel_case("GrahamChapman")
'GrahamChapman'
snake_case(text)[source]#

Convert camel case to snake case.

Examples

>>> from landlab.framework.decorators import snake_case
>>> snake_case("EricIdle")
'eric_idle'
>>> snake_case("MONTYPython")
'monty_python'

landlab.framework.interfaces module#

The Basic Modeling Interface.

exception BadVarNameError(name)[source]#

Bases: Error

Exception to indicate a bad input/output variable name.

class BmiBase[source]#

Bases: object

Definition of the Basic Modeling Interface.

finalize()[source]#

Clean-up model.

get_current_time()[source]#

Current time of model.

get_end_time()[source]#

Model stop time.

get_input_var_names()[source]#

Get names of input variables to the model as standard names.

Returns:

A list of input standard names as strings

get_output_var_names()[source]#

Get names of output variables to the model as standard names.

Returns:

A list of output standard names as strings

get_start_time()[source]#

Model start time.

get_time_step()[source]#

Model time step.

get_var_rank(var_name)[source]#

Rank of exchange item.

get_var_type(var_name)[source]#

Get type of an exchange item.

get_var_units(var_name)[source]#

Get units of an exchange item.

initialize(file_name)[source]#

Initialize model.

File_name:

String of configuration file

update(**kwds)[source]#

Update model by one time step.

class BmiExtendedBase[source]#

Bases: object

An extension interface for a BMI.

run_model()[source]#

Initialize, run, and finalize a model.

update_until(time)[source]#

Update model until some time.

Time:

Update duration

class BmiGridType(code, name)[source]#

Bases: int

Base type to indicate the type of a BMI model’s grid.

Code:

Grid type code as an int

Name:

Name of the grid type as a string

class BmiNoGrid[source]#

Bases: object

BMI for a model that does not have a grid.

class BmiRectilinear[source]#

Bases: object

BMI for a model that uses a rectilinear grid.

get_columns(name)[source]#

Get coordinates of grid columns.

get_grid_shape(name)[source]#

Get shape of grid for variable, name.

Name:

Standard name

get_rows(name)[source]#

Get coordinates of grid rows.

class BmiStructured[source]#

Bases: object

BMI for a model that uses a structured grid.

get_grid_shape(name)[source]#

Get shape of grid for variable, name.

Name:

Standard name

get_x(name)[source]#

Get x-coordinates of grid nodes.

get_y(name)[source]#

Get y-coordinates of grid nodes.

class BmiUniformRectilinear[source]#

Bases: object

BMI for a model that exposes a uniform rectilinear grid.

get_grid_origin(name)[source]#

Get origin of grid for variable, name.

Name:

Standard name

get_grid_shape(name)[source]#

Get shape of grid for variable, name.

Name:

Standard name

get_grid_spacing(name)[source]#

Get spacing of grid for variable, name.

Name:

Standard name

class BmiUnstructured[source]#

Bases: object

BMI for a model that uses an unstructured grid.

get_connectivity(name)[source]#

Get cell connectivity.

get_offset(name)[source]#

Get cell offset.

get_x(name)[source]#

Get x-coordinates of grid nodes.

get_y(name)[source]#

Get y-coordinates of grid nodes.

exception Error[source]#

Bases: Exception

Base class for BMI exceptions.

exception FatalError[source]#

Bases: Exception

Raise this exception if an unrecoverable error was found.

exception MissingModelAttributeError(attrib)[source]#

Bases: Error

Raise this exception if a component is missing a required attribute.

exception TimeBoundsError[source]#

Bases: Error

Raise this exception if a component updates beyond its time horizon.

Module contents#

The Landlab modeling framework.