msmasnadi / OPGEEv4

OPGEE v4
Other
10 stars 4 forks source link

Add validation code to Process subclasses #16

Closed rjplevin closed 1 month ago

rjplevin commented 1 month ago

Subclasses of the Process class (mainly defined in the "processes" subdirectory) should define values for class variables _required_inputs and _required_outputs. The default values are defined as class variables in the Process class itself.

Note that subclasses should not alter the values of the defaults (i.e., Process._required_inputs or Process._required_outputs) as this would affect all subclasses. Instead, they should set self._required_inputs and self._required_outputs in the class's __init__() method.

The value of each variable must be a list containing any mix of strings or tuples of strings. String elements identify the contents of a required input or output stream, used by the methods find_input_stream() or find_output_stream(). Tuple elements define a set of content names of which one or more must be present.

Examples can be found in processes/bitumen_mining.py and processes/acid_gas_removal.py.

See "Model Validation" in OPGEEv4/docs/source/architecture.rst for more info (after my pull request has been merged...)

rjplevin commented 1 month ago

Implemented and merged.