Skip to content

refactor!: strip Clustering to minimal wrapper#655

Merged
FBumann merged 1 commit intorefactor/tsam-xarrayfrom
refactor/tsam-xarray-simplify
Apr 1, 2026
Merged

refactor!: strip Clustering to minimal wrapper#655
FBumann merged 1 commit intorefactor/tsam-xarrayfrom
refactor/tsam-xarray-simplify

Conversation

@FBumann
Copy link
Copy Markdown
Member

@FBumann FBumann commented Apr 1, 2026

Summary

Builds on #654. Further strips the Clustering class to a minimal wrapper around tsam_xarray.

  • Remove ClusteringPlotAccessor entirely (~370 lines) — users can plot with tsam_xarray's DataArrays directly
  • Remove original_data, aggregated_data, _metrics from Clustering — no longer stored or serialized
  • Remove include_original_data parameter from to_dataset()/to_netcdf()
  • Remove build_metrics() from _ReducedFlowSystemBuilder
  • Simplify _create_reference_structure() to just serialize ClusteringResult.to_dict() + original_timesteps
  • Move xr and np imports to TYPE_CHECKING (no longer needed at runtime in base.py)

base.py: 1633 → 393 lines (-76%)

Test plan

  • All clustering tests pass (213)
  • CI

🤖 Generated with Claude Code

…lude_original_data

BREAKING CHANGES:
- Remove ClusteringPlotAccessor (compare, heatmap, clusters methods)
- Remove original_data and aggregated_data from Clustering
- Remove _metrics from Clustering (use aggregation_result.accuracy instead)
- Remove include_original_data parameter from to_dataset/to_netcdf
- Simplify _create_reference_structure to just serialize ClusteringResult dict
- Remove build_metrics from _ReducedFlowSystemBuilder

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08ed49ae-ad50-4b68-90f6-015eab22e711

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/tsam-xarray-simplify

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@FBumann FBumann merged commit cf0caf4 into refactor/tsam-xarray Apr 1, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant