packable
packable
Base class for packable scenario components.
Classes
Packable
Bases: BaseModel
Abstract base class for managing collections of scenarios.
Packable provides the foundation for organizing, processing, and exporting scenario data in various formats. It defines the common interface and utilities used by all specific packable implementations (inputs, queries, curves, etc.).
Subclasses should implement
- _build_dataframe_for_scenario: Extract data from single scenario
- from_dataframe: Import and apply data to scenarios
- Any specialized import/export logic
Functions
set_scenario_short_names
Set mapping of scenario IDs to short names for display purposes.
add
Add one or more scenarios to the packable, maintaining insertion order and uniqueness.
Source code in src/pyetm/models/packables/packable.py
discard
to_dataframe
from_dataframe
Should parse the df and call correct setters on identified scenarios
validate_config
classmethod
Optional validation hook for packable configurations. Override in subclasses that need validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Any
|
Configuration value to validate |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Tuple of (validated_config, warnings) |
List[str]
|
|
Tuple[Any, List[str]]
|
|
Source code in src/pyetm/models/packables/packable.py
resolve_scenario
Resolve a scenario from various label formats (short name, identifier, or numeric ID).
Source code in src/pyetm/models/packables/packable.py
add_to_workbook
Add this pack's data to an Excel workbook as a sheet.
Source code in src/pyetm/models/packables/packable.py
import_from_excel
Import pack data from Excel file. Subclasses should override this to implement specific import logic.
Source code in src/pyetm/models/packables/packable.py
log_scenario_warnings
Log warnings from scenario attributes if available.