openalea.metafspm.component.declare#
- openalea.metafspm.component.declare(unit: str, unit_comment: str, description: str, min_value: float, max_value: float, value_comment: str, references: str, DOI: list, variable_type: Literal['state_variable', 'plant_scale_state', 'input', 'parameter'], by: str, state_variable_type: Literal['massic_concentration', 'intensive', 'extensive', 'NonInertialExtensive', 'NonInertialIntensive', 'descriptor'], edit_by: Literal['user', 'dev'], default=None, default_factory=None)[source]#
Resulting from a consensus, this function is used to constrain component variables declaration in a dataclass in a commonly admitted way.
- Parameters:
default – Default value of the attribute if not superimposed by scenario of coupling.
unit – International system unit
unit_comment – More precision about unit (example : mol of … per g of …)
description – Full description of the variable purpose, scale and related hypotheses.
value_comment – Commentary if default value identified from literature has been overwritten, store original value and explain why it was changed.
references – References for value and hypotheses (format Author et al., Year).
DOI – DOIs of the referred papers, stored in a list of str.
variable_type – variable type according to component standards; -input- will be read as expected input from another model. If not coupled, the model will keep this default. -state_variable- are the segment scale state variables. -plant_scale_state- are the summed totals variables or the plant scale variables. -parameter- are the model parameters.
by – which model is provider of the considered variable?
state_variable_type – intensive (size invariant property) or extensive (size dependant property).
edit_by – Explicit whether the considered default value could be superimposed only by a developer or a user. This can be used to exposed more precisely certain parametrization sensitive variables for user.
- Raises:
BadDefaultError – If ‘(type(min_value)==float and default < min_value) or (type(max_value)==float and default > max_value)’:
BadUnitError – If ‘unit not in dir(UnitRegistry())’
BadVariableTypeError – If ‘variable_type not in (“input”, “state_variable”, “plant_scale_state”, “parameter”)’
BadStateTypeError – If ‘state_variable_type not in (“intensive”, “extensive”)’
BadEditError – If ‘edit_by not in (“user”, “developer”)’