ESO / MTR API¶
High-performance parser for EnergyPlus .eso Standard Output and .mtr Meter
time-series files. The data dictionary is parsed eagerly; variable data is
extracted lazily with a single targeted scan (get_column), or all at once with
eager=True / .columns.
ESOResult¶
idfkit.simulation.parsers.eso.ESOResult
¶
Parsed EnergyPlus .eso / .mtr output file.
The data dictionary is parsed on construction; the data section is scanned
lazily on demand (see get_column). Pass eager=True to materialize
every column up front.
A file usually contains several environments — the sizing design days
followed by the weather run period. get_column returns the last one
(the run period) by default. To target a specific design day, read
environments to map each index to its title and pass that index
as environment_index:
eso = ESOResult.from_file("eplusout.eso")
for env in eso.environments:
print(env.index, env.title)
# 0 DENVER ... ANN HTG 99% CONDNS DB
# 1 DENVER ... ANN CLG 1% CONDNS DB=>MWB
# 2 RUN PERIOD 1
# the heating design day is index 0:
col = eso.get_column("Zone Mean Air Temperature", "ZONE ONE", environment_index=0)
Attributes:
| Name | Type | Description |
|---|---|---|
program_version |
The |
|
variables |
tuple[ESOVariable, ...]
|
All variables declared in the data dictionary. |
Source code in idfkit/simulation/parsers/eso.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | |
columns
property
¶
Every variable's time series across all environments (full parse).
Accessing this triggers (and caches) a full parse of the data section.
environments
property
¶
All environment periods in the file (lazily scanned and cached).
This is the index → title map for environment_index: each
ESOEnvironment has an
index (use it as environment_index in get_column) and a
title (the design-day / run-period name).
variables = tuple(self._by_id.values())
instance-attribute
¶
from_bytes(data, *, eager=False)
classmethod
¶
Parse an ESO/MTR file from raw bytes (the fastest entry point).
from_file(path, *, eager=False)
classmethod
¶
from_string(text, *, eager=False)
classmethod
¶
get_column(variable_name, key_value=None, frequency=None, environment_index=None)
¶
Extract one variable's time series with a single targeted scan.
The lookup must resolve to one reported series, as SQLResult.get_timeseries does: when a variable is reported for several keys (one per zone, say) or at several frequencies, name the one you want, and the error lists them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variable_name
|
str
|
Variable name to look up (case-insensitive). |
required |
key_value
|
str | None
|
Key value (e.g. zone name, case-insensitive). Needed only when the variable is reported for more than one key. |
None
|
frequency
|
str | None
|
Frequency (e.g. |
None
|
environment_index
|
int | None
|
Which environment to return. Defaults to the last
environment in the file (typically the run period), mirroring the
most common intent. To pick a specific design day, find its index
by title in |
None
|
Returns:
| Type | Description |
|---|---|
ESOColumn
|
The matching ESOColumn. Its |
ESOColumn
|
|
Raises:
| Type | Description |
|---|---|
ResultLookupError
|
A |
Source code in idfkit/simulation/parsers/eso.py
get_columns(series, environment_index=None)
¶
Extract several variables' time series in one scan of the file.
Each get_column call scans the whole data section, so a loop over many variables reads the file once per variable. This reads every requested series in a single pass (series already read are served from the cache).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series
|
Iterable[ESOSeriesSpec]
|
The series to read, each an |
required |
environment_index
|
int | None
|
Which environment to return for every series,
as in |
None
|
Returns:
| Type | Description |
|---|---|
list[ESOColumn]
|
One ESOColumn per item |
list[ESOColumn]
|
of series, in the same order. |
Raises:
| Type | Description |
|---|---|
ResultLookupError
|
If any series does not resolve to exactly one
reported series or has no data, as in |
Source code in idfkit/simulation/parsers/eso.py
get_variable(variable_name, key_value=None, frequency=None)
¶
Find a declared variable by name (case-insensitive) and optional key/frequency.
Returns the first match, or None; several may match when key_value or
frequency is left out. get_column
refuses such an ambiguous lookup instead.
Source code in idfkit/simulation/parsers/eso.py
to_dataframe(variable_name, key_value=None, frequency=None, environment_index=None)
¶
Extract a variable and return it as a pandas DataFrame.
Raises:
| Type | Description |
|---|---|
ResultLookupError
|
A |
ImportError
|
If pandas is not installed. |
Source code in idfkit/simulation/parsers/eso.py
ESOColumn¶
idfkit.simulation.parsers.eso.ESOColumn
dataclass
¶
One variable's time series within a single environment.
Attributes:
| Name | Type | Description |
|---|---|---|
variable |
ESOVariable
|
The ESOVariable this column belongs to. |
environment_index |
int
|
Index of the environment these values belong to.
Look it up in |
timestamps |
tuple[datetime, ...]
|
Timestamp for each data point. |
values |
tuple[float, ...]
|
The reported value for each data point (the primary value for aggregated daily/monthly records). |
Source code in idfkit/simulation/parsers/eso.py
environment_index
instance-attribute
¶
timestamps
instance-attribute
¶
values
instance-attribute
¶
variable
instance-attribute
¶
plot(*, backend=None, title=None)
¶
Plot this time series as a line chart.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend
|
PlotBackend | None
|
A PlotBackend instance. If not provided, auto-detects. |
None
|
title
|
str | None
|
Optional plot title. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A figure object from the backend. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If no plotting backend is available. |
Source code in idfkit/simulation/parsers/eso.py
to_dataframe()
¶
Convert to a pandas DataFrame.
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame with a |
DataFrame
|
variable. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If pandas is not installed. |
Source code in idfkit/simulation/parsers/eso.py
ESOVariable¶
idfkit.simulation.parsers.eso.ESOVariable
dataclass
¶
A reporting variable declared in an ESO/MTR data dictionary.
Attributes:
| Name | Type | Description |
|---|---|---|
report_id |
int
|
The integer id that prefixes this variable's data records. |
variable_name |
str
|
The output variable or meter name. |
key_value |
str
|
The key (e.g. zone or surface name); empty for meters. |
units |
str
|
The variable units (may be empty). |
frequency |
str
|
Normalized reporting frequency ( |
num_values |
int
|
Number of numeric values each data record carries (1 for detailed/hourly; more for aggregated daily/monthly min/max records). |
Source code in idfkit/simulation/parsers/eso.py
ESOEnvironment¶
idfkit.simulation.parsers.eso.ESOEnvironment
dataclass
¶
One environment period (design day or run period) within the file.
Environments appear in the order EnergyPlus ran them: sizing design days
first (in IDF order), then the weather run period(s). index is that
0-based order and is exactly the value used by environment_index
everywhere else (ESOResult.get_column and
ESOColumn.environment_index); title is the human-readable name.
To learn which index is which design day, read ESOResult.environments
and match on title — EnergyPlus does not encode an environment type
code in the ESO format, so the title is the only discriminator (e.g.
"... ANN HTG 99% CONDNS DB" vs "RUN PERIOD 1").
Attributes:
| Name | Type | Description |
|---|---|---|
index |
int
|
0-based order of appearance; pass it as |
title |
str
|
The environment title from the |
latitude |
float
|
Site latitude in degrees. |
longitude |
float
|
Site longitude in degrees. |
time_zone |
float
|
Site time zone in hours from GMT. |
elevation |
float
|
Site elevation in metres. |