Skip to content

model_input_schemas

AbstractScenarioModel

Bases: DataFrameModel

Base schema for scenario dataframe as used when creating a model.

Structure: - Index: datetime (time series) - Columns: - load_ (float): load in Amperes for each circuit (e.g., load_circuit1, load_circuit2, etc.) - ambient_temperature (float): ambient temperature in degrees Celsius

Config

Configuration for the schema model.

check_datetime_index classmethod

check_datetime_index(df: DataFrame)

Ensure index is datetime-like or timedelta-like.

Source code in cable_thermal_model/model/schemas/model_input_schemas.py
33
34
35
36
37
@pa.dataframe_check(error="Scenario index must be either datetime-like or timedelta-like..")
@classmethod
def check_datetime_index(cls, df: pd.DataFrame):
    """Ensure index is datetime-like or timedelta-like."""
    return pd.api.types.is_datetime64_any_dtype(df.index) or pd.api.types.is_timedelta64_dtype(df.index)

check_no_missing_values classmethod

check_no_missing_values(df: DataFrame)

Ensure there are no missing values in the scenario dataframe.

Source code in cable_thermal_model/model/schemas/model_input_schemas.py
39
40
41
42
43
@pa.dataframe_check(error="Scenario dataframe must not contain missing values.")
@classmethod
def check_no_missing_values(cls, df: pd.DataFrame):
    """Ensure there are no missing values in the scenario dataframe."""
    return not df.isna().any().any()

ScenarioModelAir

Bases: AbstractScenarioModel

Air scenario schema extending the base scenario schema.

ScenarioModelSoil

Bases: AbstractScenarioModel

Soil scenario schema extending the base scenario schema.