Skip to content

i_model

Module for IModel Interface

!!! interfaces IModel

!!! classes ModelStatus

IModel (ABC)

Interface for models

Source code in entities/i_model.py
class IModel(ABC):
    """Interface for models"""

    @property
    @abstractmethod
    def name(self) -> str:
        """Name of the model"""

    @property
    @abstractmethod
    def status(self) -> ModelStatus:
        """Status of the model"""

    @status.setter
    @abstractmethod
    def status(self, status: ModelStatus):
        """Status of the model"""

    @property
    @abstractmethod
    def input_datasets(self) -> List[_xr.Dataset]:
        """Input datasets for the model"""

    @property
    @abstractmethod
    def output_dataset(self) -> _xr.Dataset:
        """Output dataset produced by this model"""

    @property
    def partition(self) -> str:
        """partition of the model"""

    @partition.setter
    def partition(self, partition: str):
        """partition of the model"""

    @abstractmethod
    def validate(self, logger: ILogger) -> bool:
        """Validates the model"""

    @abstractmethod
    def initialize(self, logger: ILogger) -> None:
        """Initializes the model"""

    @abstractmethod
    def execute(self, logger: ILogger) -> None:
        """Executes the model"""

    @abstractmethod
    def finalize(self, logger: ILogger) -> None:
        """Finalizes the model"""

input_datasets: List[xarray.core.dataset.Dataset] property readonly

Input datasets for the model

name: str property readonly

Name of the model

output_dataset: Dataset property readonly

Output dataset produced by this model

partition: str property writable

partition of the model

status: ModelStatus property writable

Status of the model

execute(self, logger)

Executes the model

Source code in entities/i_model.py
@abstractmethod
def execute(self, logger: ILogger) -> None:
    """Executes the model"""

finalize(self, logger)

Finalizes the model

Source code in entities/i_model.py
@abstractmethod
def finalize(self, logger: ILogger) -> None:
    """Finalizes the model"""

initialize(self, logger)

Initializes the model

Source code in entities/i_model.py
@abstractmethod
def initialize(self, logger: ILogger) -> None:
    """Initializes the model"""

validate(self, logger)

Validates the model

Source code in entities/i_model.py
@abstractmethod
def validate(self, logger: ILogger) -> bool:
    """Validates the model"""

ModelStatus (Enum)

Enum for the model status

Source code in entities/i_model.py
class ModelStatus(Enum):
    """Enum for the model status"""

    CREATED = auto()
    INITIALIZING = auto()
    INITIALIZED = auto()
    EXECUTING = auto()
    EXECUTED = auto()
    FINALIZING = auto()
    FINALIZED = auto()
    FAILED = auto()
    VALIDATING = auto()
    VALIDATED = auto()