Model component subpackages =========================== This section describes the package implementing a single model component. Each such package is a subpackage of ``pycopancore.model_components``. Subpackage structure -------------------- A component subpackage contains one interface module, one model module, and one implementation class module for each entity-type and process taxon that the component contributes to: :: implementation cell.py culture.py environment.py individual.py social_metabolism.py social system.py interface.py model.py Interface module ---------------- The interface module defines the attributes of all entity-types and process taxons contributed by this component. Each attribute is an instance of the class ``Variable`` or one of its subclasses such as ``ReferenceVariable`` (for references to at most one other entity, e.g. ``CEO``) or ``SetVariable`` (for references to sets of entities, e.g. ``residents``), either one imported from the master data model or another component, or a new instance. Basic structure of ``interface.py``, using attributes imported from the data model and self-defined variables: :: from pycopancore.master_data_model import C, ... class Model: name = '' description = '' requires = [] ... class Cell: = C. ... class SocialSystem: ... class Environment: ... Variables from the master data model must be used under the exact same name as they occur there. In turn, the modeling board must ensure that variable names in the master data model are reasonably short without losing distinguishability and descriptiveness. If some needed attribute is not (yet) defined in the master data model but is already defined in another component that this component necessarily *requires* (i.e., if the component may not be meaningfully used in any model without the other component), then the preferred choice is to import the attribute from the other component's *interface* (not implementation!) module as follows: :: import pycopancore.model_components..interface as O class Cell: = O.Cell. ... ... However, if the import is not possible since the other component's interface itself already imports this component's interface (either directly or indirectly via a sequence of imports), which would lead to an unallowed import cycle, then the respective attribute shall not specified in this component's interface at all. Instead, the implementation classes of this component shall reference the other component's attribute directly via the *other* component's interface (see below). Finally, if the needed attribute is not defined in either the master data model nor any components this component requires, it must be defined (instead of imported) as an instance of the ``Variable`` class, specifying the variable's metadata. We encourage using variable metadata from established catalogues of variables such as the `CF Conventions Standard Names`_ for climate-related quantities or the `World Bank's CETS list`_ of socio-economic indicators wherever possible, ideally via the ``Variable`` class' subclasses ``CFVariable``, ``CETSVariable``, etc., but renaming the variable according to copan\:CORE's naming standards if necessary (e.g. for a ``CETSVariable`` or for a ``CFVariable`` with too lengthy names). :: _`CF Conventions Standard Names`: http://cfconventions.org/Data/cf-standard-names/37/build/cf-standard-name-table.html :: _`World Bank's CETS list`: https://datahelpdesk.worldbank.org/knowledgebase/articles/201175-how-does-the-world-bank-code-its-indicators Example: :: from pycopancore import Variable, ReferenceVariable, SetVariable import pycopancore.base.interface as B ... class Cell: = Variable("