Skip to content

model

initialise_later = object() module-attribute

DataStructure dataclass

Source code in process/core/model.py
 9
10
11
12
13
14
15
16
@dataclass(kw_only=True)
class DataStructure:
    water_use: WaterUseData = initialise_later

    def __post_init__(self):
        for f in fields(self):
            if getattr(self, f.name) is initialise_later:
                setattr(self, f.name, f.type())

water_use = initialise_later class-attribute instance-attribute

Model

Bases: ABC

Source code in process/core/model.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Model(abc.ABC):
    data: DataStructure

    @abc.abstractmethod
    def run(self) -> None:
        """Run the model.

        The run method is resposible for 'running' the model, ensuring it updates the data
        structure with variables that subsequent models will require.
        """

    @abc.abstractmethod
    def output(self) -> None:
        """Output model data.

        This method will always be called after run method and should output the model data to the
        output files.
        """

data instance-attribute

run() abstractmethod

Run the model.

The run method is resposible for 'running' the model, ensuring it updates the data structure with variables that subsequent models will require.

Source code in process/core/model.py
22
23
24
25
26
27
28
@abc.abstractmethod
def run(self) -> None:
    """Run the model.

    The run method is resposible for 'running' the model, ensuring it updates the data
    structure with variables that subsequent models will require.
    """

output() abstractmethod

Output model data.

This method will always be called after run method and should output the model data to the output files.

Source code in process/core/model.py
30
31
32
33
34
35
36
@abc.abstractmethod
def output(self) -> None:
    """Output model data.

    This method will always be called after run method and should output the model data to the
    output files.
    """