Skip to content

Document the index convention of read_epw - #2894

Open
cdeil wants to merge 2 commits into
pvlib:mainfrom
cdeil:epw-index-convention
Open

cdeil wants to merge 2 commits into
pvlib:mainfrom
cdeil:epw-index-convention

Conversation

@cdeil

@cdeil cdeil commented Oct 9, 2026

Copy link
Copy Markdown

read_epw labels each EPW record with the start of its hour (EPW hour 1 becomes 00:00, from hour - 1 in _parse_epw), but the docstring only says "Days run from 0-23h". EPW irradiance and illuminance are totals over the hour ending at the time in the file, while temperature, humidity and pressure are values at that time, and read_tmy3 labels its records with the end of the hour and warns about it. So the same data read with read_epw and read_tmy3 are one hour apart, which is what #1156 reports.

This PR documents the convention with a warning like the one in read_tmy3, including the one-line shift that labels the records with the time given in the file. Changing the index itself would break existing users; if you would rather do that (perhaps behind a parameter), I'm happy to follow up with a PR. I ran into this while aligning EPW weather for a building simulation side project.

Checked: read_epw on tests/data/NLD_Amsterdam062400_IWEC.epw with coerce_year=2001 gives 2001-01-01 00:00 for EPW hour 1 and 2001-12-31 23:00 for the last record; tests/iotools/test_epw.py passes; flake8 is clean. I'll add the :pull: reference to the what's-new entry once this has a number.

Prepared with AI assistance (Claude); I reviewed it.

read_epw labels each EPW record with the start of its hour (EPW hour 1
becomes 00:00), while read_tmy3 labels each record with the end of its
hour, so the same data read from an EPW and a TMY3 file are one hour
apart. Say so in a warning, as read_tmy3 does, and show how to label
the records with the time given in the EPW file. See pvlib#1156.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Hey @cdeil! 🎉

Thanks for opening your first pull request! We appreciate your
contribution. Please ensure you have reviewed and understood the
contributing guidelines.

If AI is used for any portion of this PR, you must vet the content
for technical accuracy.

Finally, be sure the PR description includes the PR
checklist,
and complete the items you are able to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant