Collections of components
Arena[source]¶Bases: landlab.framework.collections.Collection
A collection of component instances.
connect(user_name, provider_name, var_name)[source]¶Connect two components through a variable. user_name is the name of the component that uses var_name and provider_name is the name of the component that provides var_name.
If the arena doesn’t contain either user_name or provider_name,
UnknownComponentError() is raised.
instantiate(cls, name)[source]¶Instantiate a component and call it name. The component, cls, is either an instance of a BMI-like object or a class that implements the BMI. If cls is a class, it is instantiated by calling it’s __init__ method without any arguments.
walk(root, tree=None)[source]¶Walk a connected set of components.
Walk a connected set of components with the component named root. If the tree keyword is given, treat it as a list of components already in the tree and add to that list. If a component is already in the tree, do not iterate through that component. This function returns a list of component names in the order they are visited by the walk.
BadVarNameError(var_name)[source]¶Bases: landlab.framework.collections.Error
Raise this exception if a variable name is not found for a component.
Collection(**kwds)[source]¶Bases: dict
A collection of components that implement a BmiBase
find_connections()[source]¶Find connections between components that use and provide variables. The returned dictionary will have keys that are names of components that provide varaibles. Its keys will be a dictionary of variable names and list of components that use the variable.
find_provider(var_name)[source]¶Find a component in the collection that provides the CSDMS standard name, var_name. The returned list contains the names of the components providing var_name.
MultipleProvidersError(var_name)[source]¶Bases: landlab.framework.collections.Error
Raise this exception if multiple components provide the same variable
NoProvidersError(var_name)[source]¶Bases: landlab.framework.collections.Error
Raise this exception if no components provide the a variable
Palette(*args, **kwds)[source]¶Bases: landlab.framework.collections.Collection
A collection of component classes that have yet to be instantiated.
UnknownComponentError(name)[source]¶Bases: landlab.framework.collections.Error
Raise this exception when requesting a component unknown to the framework
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.
See also
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.
See also
Decorators for TheLandlab package.
Implements(*interfaces)[source]¶Bases: object
Decorator to indicate if a class implements interfaces. Similar to the ImplementsOrRaise decorator except that this decorator silently ignores implemention errors. If the class does implement the interface, decorate it with a __implements__ data mamber that is a tuple of the interfaces it implements. Otherwise, don’t do anything.
ImplementsOrRaise(*interfaces)[source]¶Bases: object
Decorator to indicate if a class implements interfaces. If the class does not implement the interface, raise an InterfaceImplementationError. If the class does implement the interface, decorate it with a __implements__ data mamber that is a tuple of the interfaces it implements.
InterfaceImplementationError(cls, interface)[source]¶Bases: landlab.framework.decorators.Error
Raise this error if the class does not implement an interface.
camel_case(text, sep=None)[source]¶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('camel case')
'CamelCase'
>>> camel_case('camel_case', sep='_')
'CamelCase'
The Basic Modeling Interface.
BadVarNameError(name)[source]¶Bases: landlab.framework.interfaces.Error
Exception to indicate a bad input/output variable name
BmiBase[source]¶Bases: object
Definition of the Basic Modeling Interface
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 | 
|---|
BmiGridType[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 | 
BmiUniformRectilinear[source]¶Bases: object
BMI for a model that exposes a uniform rectilinear grid.
FatalError[source]¶Bases: exceptions.Exception
Raise this exception if an unrecoverable error was found
MissingModelAttributeError(attrib)[source]¶Bases: landlab.framework.interfaces.Error
Raise this exception if a component is missing a required attribute.
TimeBoundsError[source]¶Bases: landlab.framework.interfaces.Error
Raise this exception if a component updates beyond its time horizon
The Landlab modeling framework.