Source code for pycif.utils.classes.datavects
from types import MethodType
from ...utils.check.errclass import PluginError
from .baseclass import Plugin
[docs]
class DataVect(Plugin):
"""Plugin type for data vectors.
Initialises the hierarchical component/parameter data structure shared by
the control vector and the observation vector. Each ``component`` groups
related tracers (e.g. ``fluxes``, ``concs``, ``inicond``) and each
``parameter`` within a component refers to a specific species or sector.
Concrete implementations live in ``pycif/plugins/datavects/``.
"""
[docs]
def initiate_template(self):
"""Initialise the DataVect plugin template.
Loads the registered data-vector module and attaches all standard
methods (``state2inputs``, ``outputs2state``, ``control2native``,
``native2control``, ``sqrtbprod``, ``sqrtbprod_ad``, ``dump``,
``load``) as bound methods on this instance.
"""
super(DataVect, self).initiate_template(
plg_type="datavect"
)
[docs]
@classmethod
def register_plugin(cls, name, version, module, subtype="", **kwargs):
"""Register a module for a plugin and version with possibly options
Args:
name (str): name of the plugin
version (str): version of the plugin
module (types.ModuleType): module defining the interface
between pyCIF and the plugin
plugin_type (str): type of plugin
**kwargs (dictionary): default options for module
"""
super(DataVect, cls).register_plugin(
name, version, module, plugin_type="datavect", subtype=subtype
)