Skip to content

Commit ddb1c8e

Browse files
authored
Make leap_day=True default for PSM3 (new) (#1991)
* Set leap_day=True * Add whatsnew entry
1 parent 07d5c9f commit ddb1c8e

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Breaking changes
99
~~~~~~~~~~~~~~~~
1010
* The deprecated ``pvlib.modelchain.basic_chain`` has now been removed. (:pull:`1862`)
1111
* Remove the `poa_horizontal_ratio` function and all of its references. (:issue:`1697`, :pull:`2021`)
12+
* The `leap_day` parameter in :py:func:`~pvlib.iotools.get_psm3`
13+
now defaults to True instead of False. (:issue:`1481`, :pull:`1991`)
1214

1315

1416
Deprecations

pvlib/iotools/psm3.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363

6464
def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
65-
attributes=ATTRIBUTES, leap_day=None, full_name=PVLIB_PYTHON,
65+
attributes=ATTRIBUTES, leap_day=True, full_name=PVLIB_PYTHON,
6666
affiliation=PVLIB_PYTHON, map_variables=None, url=None,
6767
timeout=30):
6868
"""
@@ -105,7 +105,7 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
105105
for lists of available fields. Alternatively, pvlib names may also be
106106
used (e.g. 'ghi' rather than 'GHI'); see :const:`REQUEST_VARIABLE_MAP`.
107107
To retrieve all available fields, set ``attributes=[]``.
108-
leap_day : boolean, default False
108+
leap_day : boolean, default : True
109109
include leap day in the results. Only used for single-year requests
110110
(i.e., it is ignored for tmy/tgy/tdy requests).
111111
full_name : str, default 'pvlib python'
@@ -179,14 +179,6 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
179179
# convert pvlib names in attributes to psm3 convention
180180
attributes = [REQUEST_VARIABLE_MAP.get(a, a) for a in attributes]
181181

182-
if (leap_day is None) and (not names.startswith('t')):
183-
warnings.warn(
184-
'The ``get_psm3`` function will default to leap_day=True '
185-
'starting in pvlib 0.11.0. Specify leap_day=True '
186-
'to enable this behavior now, or specify leap_day=False '
187-
'to hide this warning.', pvlibDeprecationWarning)
188-
leap_day = False
189-
190182
# required query-string parameters for request to PSM3 API
191183
params = {
192184
'api_key': api_key,

pvlib/tests/iotools/test_psm3.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,3 @@ def test_get_psm3_attribute_mapping(nrel_api_key):
203203
def test_psm3_variable_map_deprecation_warning(nrel_api_key):
204204
with pytest.warns(pvlibDeprecationWarning, match='names will be renamed'):
205205
_ = psm3.read_psm3(MANUAL_TEST_DATA)
206-
207-
208-
@pytest.mark.remote_data
209-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
210-
def test_psm3_leap_day_deprecation_warning(nrel_api_key):
211-
with pytest.warns(pvlibDeprecationWarning,
212-
match='default to leap_day=True'):
213-
_, _ = psm3.get_psm3(LATITUDE, LONGITUDE, nrel_api_key, PVLIB_EMAIL,
214-
names=2019, interval=60,
215-
attributes=['ghi', 'wind_speed'],
216-
map_variables=True)

0 commit comments

Comments
 (0)