Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions flixopt/clustering/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,11 @@
print(f'Dims: {clustering.dims}') # e.g., ('period', 'scenario')
print(f'Coords: {clustering.coords}') # e.g., {'period': [2024, 2025]}

# Access tsam AggregationResult for detailed analysis
# Access tsam_xarray AggregationResult for detailed analysis
# NOTE: Only available BEFORE saving/loading. Lost after IO.
result = clustering.sel(period=2024, scenario='high')
result.cluster_representatives # DataFrame with aggregated time series
result = clustering.aggregation_result
result.cluster_representatives # DataArray with aggregated time series
result.accuracy # AccuracyMetrics (rmse, mae)
result.plot.compare() # tsam's built-in comparison plot

# Iterate over all results (only before IO)
for key, result in clustering.items():
print(f'{key}: {result.n_clusters} clusters')

# Save and load - structure preserved, AggregationResult access lost
fs_clustered.to_netcdf('system.nc')
Expand Down
Loading
Loading