Overview
This module handles the extraction of power plant generation data from OFEI text files. The data contains information about agents (power companies), plant names, types, and 24-hour time series generation data.Data Source Format
The OFEI files follow a specific text format:- Agent information marked with
AGENTE:prefix - Plant records containing type
Dwith comma-separated values - 24 hourly generation values per plant
Parsing Implementation
Parsing Logic
Agent Detection
The parser maintains state by tracking the current agent:Plant Record Extraction
Records with typeD are parsed:
Record Structure
Each record combines:- Agent name (from previous
AGENTE:line) - Type (D = generation type)
- Plant name
- 24 hourly values (Hora_1 through Hora_24)
Output DataFrame Structure
| Column | Description | Type |
|---|---|---|
| Agente | Power company name | string |
| Tipo | Plant type (D) | string |
| Planta | Plant identifier | string |
| Hora_1 to Hora_24 | Hourly generation values (MW) | float |
Sample Output
File Encoding
Note the use oflatin-1 encoding to handle special characters in Colombian power plant names: