Time Series
The gat ts commands process time-indexed data: SCADA telemetry, load profiles, generation schedules, and renewable forecasts. Operations include resampling, joining, aggregation, and preparation for multi-period dispatch.
Overview
| Command | Purpose |
|---|---|
gat ts resample | Resample to fixed intervals |
gat ts join | Join multiple time series |
gat ts agg | Aggregate by groups |
gat ts fill | Fill missing values |
gat ts validate | Check data quality |
gat ts slice | Extract time windows |
Quick Start
Resample Telemetry Data
# Resample irregular SCADA data to 5-minute intervals
Join Multiple Sources
# Align load and solar data on timestamp
Aggregate by Category
# Sum load by region
Time Series File Format
Expected Schema
GAT time series commands expect:
| Column | Type | Description |
|---|---|---|
timestamp | datetime | ISO 8601 timestamp (configurable name) |
value | float | Measurement value (configurable name) |
| (optional) | any | Additional columns preserved |
Example Data
Supported Formats
- Parquet (recommended) — Fast columnar storage with type preservation
- CSV — Human-readable, auto-parsed timestamps
- Arrow IPC — In-memory transfer format
Resample
gat ts resample
Convert irregular timestamps to fixed intervals:
Resampling Rules
| Rule | Description | Example |
|---|---|---|
1s | 1 second | Real-time telemetry |
1min | 1 minute | SCADA polling |
5min | 5 minutes | Standard intervals |
15min | 15 minutes | Market intervals |
1h | 1 hour | Hourly dispatch |
1d | 1 day | Daily summaries |
Aggregation Methods
| Method | Description |
|---|---|
mean | Average value in bucket (default) |
sum | Sum of values |
min | Minimum value |
max | Maximum value |
first | First value in bucket |
last | Last value in bucket |
count | Number of values |
Output Schema
Resampling produces:
| Column | Description |
|---|---|
bucket_start | Start of time bucket |
bucket_end | End of time bucket |
count | Number of raw values in bucket |
mean_value | Average (if agg=mean) |
min_value | Minimum value |
max_value | Maximum value |
Examples
15-minute load profile:
Daily peak extraction:
Hourly energy totals:
Join
gat ts join
Align multiple time series on timestamp:
Join Types
| Type | Description |
|---|---|
outer | Keep all timestamps from both files |
inner | Keep only matching timestamps |
left | Keep all from first file |
Handling Missing Values
After outer join, missing values appear as null. Fill them:
# Join then fill
Examples
Combine load and weather:
Merge multiple generators:
Aggregate
gat ts agg
Group and aggregate time series data:
Aggregation Functions
| Function | Description |
|---|---|
sum | Total value |
mean | Average |
min | Minimum |
max | Maximum |
count | Number of records |
std | Standard deviation |
Multiple Aggregations
Examples
Regional load summary:
Hourly statistics by generator:
# First resample to hourly
# Then aggregate by generator
Fleet-level generation by fuel:
Fill Missing Values
gat ts fill
Handle gaps in time series:
Fill Methods
| Method | Description |
|---|---|
forward | Fill with last known value |
backward | Fill with next known value |
linear | Linear interpolation |
zero | Fill with zero |
mean | Fill with column mean |
Examples
Forward fill SCADA dropouts:
Interpolate missing weather:
Validate Data Quality
gat ts validate
Check time series for issues:
Output:
Time Series Validation
──────────────────────
Records: 8,760
Time range: 2024-01-01 to 2024-12-31
Interval: 1h (detected)
Issues found:
Missing values: 24 (0.27%)
Duplicate times: 0
Out-of-order: 0
Outliers (3σ): 12 (0.14%)
Statistics:
Min: 85.2 MW
Max: 425.8 MW
Mean: 215.3 MW
Std: 62.1 MW
Options
Slice Time Windows
gat ts slice
Extract specific time periods:
Examples
Peak summer week:
Last 24 hours:
Practical Workflows
Multi-Period OPF Preparation
Prepare time series data for multi-period optimal power flow:
#!/bin/bash
# prepare_multiperiod.sh - Create dispatch inputs
# 1. Resample load to hourly
# 2. Resample renewable forecasts
# 3. Join into single timeline
# 4. Validate completeness
# 5. Run multi-period OPF
State Estimation Pipeline
Prepare measurements for state estimation:
#!/bin/bash
# se_data_prep.sh - Prepare SE measurements
# 1. Resample all telemetry to common interval
for; do
done
# 2. Join all measurements
# 3. Fill short gaps (< 5 min)
# 4. Validate data quality
# 5. Extract latest snapshot for SE
Load Forecasting Feature Engineering
Create ML features from time series:
#!/bin/bash
# load_features.sh - Feature engineering for load forecasting
INPUT="historical_load.parquet"
OUTPUT="load_features.parquet"
# Create lagged features and aggregations
Real-Time Dashboard Data
Prepare streaming data for visualization:
#!/bin/bash
# dashboard_data.sh - Real-time dashboard refresh
while ; do
# Get latest 15 minutes
# Compute current statistics
# Update load profile chart
done
Python Integration
"""Resample time series using GAT."""
return
"""Join multiple time series files."""
= + +
return
# Example usage
=
=
Troubleshooting
"Timestamp parse error"
Cause: Non-standard timestamp format
Solution:
# Specify format explicitly
Large gaps in resampled data
Cause: Source data has long gaps
Solution:
# Check for gaps first
# Fill gaps before resampling
Memory issues with large files
Solution:
# Process in chunks
# Repeat for other months, then join
Misaligned timestamps after join
Cause: Different time zones or precision
Solution:
# Normalize to UTC first
Related Commands
- State Estimation — Process measurement time series
- OPF — Multi-period optimal dispatch
- Batch Analysis — Time-varying scenario analysis
- DERMS — DER schedule optimization