Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/sphinx/source/whatsnew/v0.16.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Documentation
* Fix the :py:func:`pvlib.spa.solar_position` docstring, which listed
outputs ``elevation`` and ``apparent_elevation`` in the wrong order.
(:issue:`2886`, :pull:`2887`)
* Document in :py:func:`pvlib.iotools.read_epw` that each record is labelled

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pvlib uses US English

Suggested change
* Document in :py:func:`pvlib.iotools.read_epw` that each record is labelled
* Document in :py:func:`pvlib.iotools.read_epw` that each record is labeled

with the start of its hour, unlike :py:func:`pvlib.iotools.read_tmy3`, and
how to label it with the time given in the EPW file. (:issue:`1156`,
:pull:`2894`)


Testing
Expand All @@ -56,6 +60,7 @@ Contributors
* Chen Yi (:ghuser:`chenyi6758-source`)
* Rajiv Daxini (:ghuser:`rdaxini`)
* jason-writer (:ghuser:`jason-writer`)
* Christoph Deil (:ghuser:`cdeil`)



11 changes: 11 additions & 0 deletions pvlib/iotools/epw.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,17 @@ def read_epw(filename, coerce_year=None):
| | liquid precipitation depth field, hour |
+-------------------------------+-----------------------------------------+

.. warning:: EPW irradiance and illuminance values are totals over the
hour *ending* at the time in the file, while temperatures, humidity
and pressure are values *at* that time [1]_. ``read_epw`` labels
each record with the *start* of its hour: EPW hour 1 (00:00-01:00)
becomes 00:00, so a full year runs from 00:00 on 1 January to 23:00
on 31 December. :py:func:`~pvlib.iotools.read_tmy3` labels each record
with the *end* of its hour instead, so the same data read from an EPW
file and from a TMY3 file are one hour apart. To label the records
with the time given in the EPW file, add one hour to the index:
``data.index = data.index + pd.Timedelta('1h')``.

Comment on lines +211 to +221

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, illuminance values are averages, not totals.
Suggested some minor clarification regarding time labels and year-end record too.

Suggested change
.. warning:: EPW irradiance and illuminance values are totals over the
hour *ending* at the time in the file, while temperatures, humidity
and pressure are values *at* that time [1]_. ``read_epw`` labels
each record with the *start* of its hour: EPW hour 1 (00:00-01:00)
becomes 00:00, so a full year runs from 00:00 on 1 January to 23:00
on 31 December. :py:func:`~pvlib.iotools.read_tmy3` labels each record
with the *end* of its hour instead, so the same data read from an EPW
file and from a TMY3 file are one hour apart. To label the records
with the time given in the EPW file, add one hour to the index:
``data.index = data.index + pd.Timedelta('1h')``.
.. warning:: In hourly EPW files, radiation totals and illuminance
averages cover the hour *ending* at the file time; temperature,
humidity and pressure are values *at* that time [1]_.
``read_epw`` labels all fields with the *start* of the hour (EPW
hour 1 becomes 00:00), while :py:func:`~pvlib.iotools.read_tmy3`
uses the *end*.
To use end-of-hour labels, add one hour to the index:
``data.index = data.index + pd.Timedelta('1h')``. The record for
31 December's final hour then has the label 1 January 00:00 of
the following year. No records are added or removed.


References
----------
Expand Down