Skip to content

Commit fb1ab53

Browse files
authored
fix tmy3 leapyear in February handling, coerce_year raises exception (pvlib#866)
* create test for GH865 * checks if there is a 2/29 in the parsed output * checks if can use coerce year * check it's really greensboro * also check that year is actually coerced * check if the TMY Feb contains a leapyear * then change 2/29 to 3/1 * add sanity check, indices should increase monotonically, by 1hr, except perhaps the last hour, which might be the previous year. * add FIXME for coerce_year, should last hour be Jan1 of the next year? * add data file, update what's new * stickler space around operator in test * move warning after notes * oops, copy and paste error * remove redundant Greensboro meta check * use improved snippet from Kevin Anderson * remove dateutil import * remove _parsedate * use 'h' unit string in pd.to_timedelta for min req pandas-0.18.1 * fix first and last hour issue are 1AM and midnite * elaborate on warning regarding definition of TMY and possibly unexpected behavior when coercing the year * add more comments * use mod instead of subtracting hour to change midnite from 24 to zero * shift all midnite rows one day forward * check for leapday (2/29) and shift to March 1st * add copious comments and a note that if pandas is updated to 0.24 then we can use the `array` property to detect leapday * add test to confirm that TMY3 1st hour is 1AM and last hour is midnite * remove unneeded numpy import in iotools/tmy * update what's new to explain that tmy3 dataframe now has original Date and Time columns used to parse the indices * more explicit test for 2/29/1996 in tmy3 * wait to set index to avoid error in py35-min * ValueError: cannot reindex from a duplicate axis * try pandas datetime instead of index * no need to convert data_ymd to datetime * it ALREADY IS! ha ha ha
1 parent 363884d commit fb1ab53

File tree

4 files changed

+8839
-19
lines changed

4 files changed

+8839
-19
lines changed

docs/sphinx/source/whatsnew/v0.7.2.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
v0.7.2 (Month day, year)
44
-------------------------
55

6+
Enhancements
7+
~~~~~~~~~~~~
8+
* TMY3 dataframe returned by :py:func:`~pvlib.iotools.read_tmy3` now contains
9+
the original ``Date (MM/DD/YYYY)`` and ``Time (HH:MM)`` columns that the
10+
indices were parsed from (:pull:`866`)
11+
12+
Bug fixes
13+
~~~~~~~~~
14+
* Fix :py:func:`~pvlib.iotools.read_tmy3` parsing when February contains
15+
a leap year (:pull:`866`)
16+
617
Documentation
718
~~~~~~~~~~~~~
819
* Add NumFOCUS affiliation to Sphinx documentation :pull:`862`

0 commit comments

Comments
 (0)