Repository navigation
Read .eso files whose run period starts on a holiday - #37
Merged
Merged
Conversation
EnergyPlus writes each step's day type, so a run period that starts on a
holiday or special day reports 'Holiday', 'SpecialDay1', 'CustomDay2' and
so on instead of a weekday. The year was worked out from the first step
alone, so such files raised ValueError ("Failed to automatically find
year ... day='Holiday'"), or StartDayMismatch with an explicit year. Many
reference buildings start on New Year's Day and failed this way.
first_calendar_day() now picks the first step with a weekday (or design
day) before the first year boundary, and both seek_year and validate_year
use it. With no such step (a run of special days only), the year defaults
to 2002 as for monthly-only data.
Adds unit tests and a 1-7 January EnergyPlus 26.2 fixture that starts on
a New Years Day holiday, with its IDF in resources/.
Fixes #36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36.
Problem
EnergyPlus writes each step's day type, so a run period that starts on a holiday or special day reports
Holiday,SpecialDay1,CustomDay2and so on instead of a weekday.convert_raw_date_datatook the year from the first step's day type alone. Such files therefore raisedValueError: Failed to automatically find year ... day='Holiday', orStartDayMismatchwhenyear=was given. Reference buildings that start on New Year's Day failed this way.Fix
first_calendar_day()inprocessing/esofile_time.pyreturns the first step whose day type is a weekday or a design day, looking only at steps before the first year boundary so the date belongs to the data's first year. Both theseek_yearpath and thevalidate_yearpath use it. If there is no such step (a run made only of special days), the year defaults to 2002, as it already does for monthly-only data. Files that start on a normal weekday behave exactly as before. The new code is plain Python 2.7-compatible, for IronPython.Tests
tests/test_esofile_time.py::TestRunPeriodStartingOnSpecialDay:StartDayMismatch;tests/test_eso_versions.py::TestHolidayStart: a real EnergyPlus 26.2 file,tests/test_files/262_1ZoneUncontrolledHolidayStart.eso(592 KB). It comes from the newresources/262_1ZoneUncontrolledHolidayStart.idf, which is252_1ZoneUncontrolledwith a 1–7 January run period and a New Years DayRunPeriodControl:SpecialDays. The file loads, the run period starts on Tuesday 1 January, and it has 168 hourly steps.*.esois git-ignored, so the fixture is force-added like the existing ones.What I ran
uv run pytest tests -q: 232 passed.ruff check .,ruff format --check .andpylint db_eplusout_reader(10.00/10) all pass.RefBldgLargeOfficeNew2004_Chicago.idf, run annually with EnergyPlus 26.2 (a 16 MB.eso), raised the ValueError loading an .eso whose run period starts on a holiday (e.g. reference buildings) #36 error before this change. With it, the file loads in 0.9 s and gives 8,760 hourly steps from Sunday 2017-01-01. That matches the IDF's "Sunday" start day.What I did not run
Most of the added lines are the
.esofixture.🤖 Generated with Claude Code