A Unified Framework for Representative Period Selection in Multi-Variate Time-Series Spaces

Unified Framework Fully Modular Protocol-Based

Decompose any time-series aggregation method into five interchangeable components. Pick one implementation per pillar, wire them together, and run.

J F M A M J J A S O N D Load Wind Solar weight 4x weight 2x weight 3x weight 3x

Why this package?

Energy system models, capacity expansion studies, and other time-series-heavy applications often need to reduce a full year (or even multi-year horizon) of hourly data to a small set of representative periods (days, weeks, months, or years) without losing what matters.

There are plenty of methods for this (k-means, k-medoids, MILP-based selection, genetic algorithms, ...), but they tend to bundle several decisions into one procedure: how to represent data, what to optimize, how to search. This project helps you understand the problem of representative period selection, provides a unified framework that untangles these decisions, and gives you modular tools to mix, compare, and adapt methods to your specific problem.

A Unified Framework

Breaks down any time-series aggregation method into five interchangeable components. Every established methodology is just a specific combination of these building blocks, which gives you a common language for describing, comparing, and mixing methods.

Read the Unified Framework

A Modular Python Package

Implements the framework as a library of composable, protocol-based modules. Pick one implementation per component, wire them together, and run. Want to add a new algorithm or score metric? Just implement one protocol, while everything else can stay the same.

Browse all modules

The Five Components

Any time-series aggregation method decomposes into these five pillars. Mix and match implementations to build the exact workflow you need.

F

Feature Space

How raw time-series are transformed into comparable representations

O

Objective

How candidate selections are scored for quality

S

Selection Space

What is being selected (historical subsets, synthetic archetypes, etc.)

R

Representation Model

How selected periods represent the full dataset

A

Search Algorithm

The engine that finds optimal selections

How It Works

Define your problem, pick one implementation per component, wire them into a workflow, and run. The result contains the selected periods, their weights, and all objective scores.

Quick Start Full walkthrough →

Implemented Modules

A growing library of composable components. Each implements a protocol — swap any module without touching the rest of your pipeline.

Feature Engineering

StandardStatsFeatureEngineer PCAFeatureEngineer FeaturePipeline

Transform raw time-series into statistical summaries, PCA projections, or chained multi-step feature pipelines.

Score Components

WassersteinFidelity CorrelationFidelity DurationCurveFidelity DiversityReward ...

Evaluate candidate selections on distribution similarity, correlation preservation, diversity, and more. 10 components and counting.

Combination Generators

ExhaustiveCombiGen GroupQuotaCombiGen HierarchicalCombiGen

Define the selection space: enumerate all k-of-n combinations, enforce group quotas (e.g. one per season), or compose hierarchically.

Representation Models

UniformRepresentationModel KMedoidsClustersizeRepresentation BlendedRepresentationModel

Assign responsibility weights: equal 1/k, cluster-membership proportional, or soft blended assignment where every period contributes.

Search Algorithms

ObjectiveDrivenCombinatorialSearchAlgorithm
WeightedSumPolicy ParetoMaxMinStrategy

Generate-and-test search with pluggable selection policies: weighted sum, Pareto front, or custom strategies.

Diagnostics

ResponsibilityBars FeatureRadar ScoreHeatmap

Interactive Plotly visualizations for feature distributions, score comparisons, and responsibility weight analysis.

Project Family

All open-source projects by Helge Esch for energy system analysis, scenario comparison, and modeling support.

mesqual

+ ecosystem

A Pythonic framework for energy scenario comparison and quantitative analysis. Platform-agnostic, fully modular, and built to extend.

A unified framework and modular Python package for representative period selection in multi-variate time-series spaces.

Create beautiful, customizable, animated SVG arrows for web interfaces with just a few lines of Python code.