tsam_xarray
An xarray wrapper for tsam — multi-dimensional time series aggregation with labeled arrays.
FBumann/tsam_xarray An xarray wrapper for tsam — multi-dimensional time series aggregation with labeled arrays.tsam_xarray is a small side project — a thin xarray wrapper around tsam. tsam aggregates time series, but it expects flat DataFrames. Energy data rarely is: it spans variables, regions, scenarios, and years. Running tsam over it means looping across slices, converting to and from DataFrames, and hoping the dimensions still line up afterwards.
tsam_xarray takes that boilerplate away — DataArray in, DataArray out. You declare which dimensions should be clustered together and which should be aggregated independently, and the representatives, accuracy metrics, and the clustering itself all come back as labeled xarray objects. A saved clustering can be re-applied to new data or used to disaggregate optimization results.