Defines the base component class from which Landlab components inherit.
from_path (grid, path) |
Create a component from an input file. |
landlab.core.model_component.Component.name |
|
units |
|
landlab.core.model_component.Component.definitions |
|
input_var_names |
|
output_var_names |
|
optional_var_names |
|
var_type (name) |
Returns the dtype of a field (float, int, bool, str...), if declared. |
var_units (name) |
Get the units of a particular field. |
var_definition (name) |
Get a description of a particular field. |
landlab.core.model_component.Component.var_mapping |
|
var_loc (name) |
Location where a particular variable is defined. |
var_help (name) |
Print a help message for a particular field. |
initialize_output_fields () |
Create fields for a component based on its input and output var names. |
initialize_optional_output_fields () |
Create fields for a component based on its optional field outputs, if declared in _optional_var_names. |
shape |
Return the grid shape attached to the component, if defined. |
grid |
Return the grid attached to the component. |
coords |
Return the coordinates of nodes on grid attached to the component. |
imshow (name, \*\*kwds) |
Plot data on the grid attached to the component. |
Component
(grid, map_vars=None, **kwds)[source]¶Bases: object
Defines the base component class from which Landlab components inherit.
from_path (grid, path) |
Create a component from an input file. |
landlab.core.model_component.Component.name |
|
units |
|
landlab.core.model_component.Component.definitions |
|
input_var_names |
|
output_var_names |
|
optional_var_names |
|
var_type (name) |
Returns the dtype of a field (float, int, bool, str...), if declared. |
var_units (name) |
Get the units of a particular field. |
var_definition (name) |
Get a description of a particular field. |
landlab.core.model_component.Component.var_mapping |
|
var_loc (name) |
Location where a particular variable is defined. |
var_help (name) |
Print a help message for a particular field. |
initialize_output_fields () |
Create fields for a component based on its input and output var names. |
initialize_optional_output_fields () |
Create fields for a component based on its optional field outputs, if declared in _optional_var_names. |
shape |
Return the grid shape attached to the component, if defined. |
grid |
Return the grid attached to the component. |
coords |
Return the coordinates of nodes on grid attached to the component. |
imshow (name, \*\*kwds) |
Plot data on the grid attached to the component. |
coords
¶Return the coordinates of nodes on grid attached to the component.
definitions
¶classmethod(function) -> method
Convert a function to be a class method.
A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:
- class C:
@classmethod def f(cls, arg1, arg2, ...):
...
It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.
Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
from_path
(grid, path)[source]¶Create a component from an input file.
Parameters: | grid : ModelGrid
path : str or file_like
|
---|---|
Returns: | Component
|
grid
¶Return the grid attached to the component.
initialize_optional_output_fields
()[source]¶Create fields for a component based on its optional field outputs, if declared in _optional_var_names.
This method will create new fields (without overwrite) for any fields output by the component as optional. New fields are initialized to zero. New fields are created as arrays of floats, unless the component also contains the specifying property _var_type.
initialize_output_fields
()[source]¶Create fields for a component based on its input and output var names.
This method will create new fields (without overwrite) for any fields output by, but not supplied to, the component. New fields are initialized to zero. Ignores optional fields, if specified by _optional_var_names. New fields are created as arrays of floats, unless the component also contains the specifying property _var_type.
input_var_names
= ()¶name
¶classmethod(function) -> method
Convert a function to be a class method.
A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:
- class C:
@classmethod def f(cls, arg1, arg2, ...):
...
It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.
Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
optional_var_names
= ()¶output_var_names
= ()¶shape
¶Return the grid shape attached to the component, if defined.
units
= ()¶var_definition
(name)[source]¶Get a description of a particular field.
Parameters: | name : str
|
---|---|
Returns: | tuple of (name, description)
|
var_help
(name)[source]¶Print a help message for a particular field.
Parameters: | name : str
|
---|
var_loc
(name)[source]¶Location where a particular variable is defined.
Parameters: | name : str
|
---|---|
Returns: | str
|
var_mapping
¶classmethod(function) -> method
Convert a function to be a class method.
A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:
- class C:
@classmethod def f(cls, arg1, arg2, ...):
...
It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.
Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.