From e146ff974eef774bb7cc4dd8aff8d4f02d38d8a4 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Tue, 12 Mar 2024 12:17:59 +0100 Subject: [PATCH 1/2] Set leap_day=True --- pvlib/iotools/psm3.py | 12 ++---------- pvlib/tests/iotools/test_psm3.py | 11 ----------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/pvlib/iotools/psm3.py b/pvlib/iotools/psm3.py index 35fb2d362b..35141e3593 100644 --- a/pvlib/iotools/psm3.py +++ b/pvlib/iotools/psm3.py @@ -62,7 +62,7 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60, - attributes=ATTRIBUTES, leap_day=None, full_name=PVLIB_PYTHON, + attributes=ATTRIBUTES, leap_day=True, full_name=PVLIB_PYTHON, affiliation=PVLIB_PYTHON, map_variables=None, url=None, timeout=30): """ @@ -105,7 +105,7 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60, for lists of available fields. Alternatively, pvlib names may also be used (e.g. 'ghi' rather than 'GHI'); see :const:`REQUEST_VARIABLE_MAP`. To retrieve all available fields, set ``attributes=[]``. - leap_day : boolean, default False + leap_day : boolean, default : True include leap day in the results. Only used for single-year requests (i.e., it is ignored for tmy/tgy/tdy requests). full_name : str, default 'pvlib python' @@ -179,14 +179,6 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60, # convert pvlib names in attributes to psm3 convention attributes = [REQUEST_VARIABLE_MAP.get(a, a) for a in attributes] - if (leap_day is None) and (not names.startswith('t')): - warnings.warn( - 'The ``get_psm3`` function will default to leap_day=True ' - 'starting in pvlib 0.11.0. Specify leap_day=True ' - 'to enable this behavior now, or specify leap_day=False ' - 'to hide this warning.', pvlibDeprecationWarning) - leap_day = False - # required query-string parameters for request to PSM3 API params = { 'api_key': api_key, diff --git a/pvlib/tests/iotools/test_psm3.py b/pvlib/tests/iotools/test_psm3.py index 91bba7a830..cde88af851 100644 --- a/pvlib/tests/iotools/test_psm3.py +++ b/pvlib/tests/iotools/test_psm3.py @@ -203,14 +203,3 @@ def test_get_psm3_attribute_mapping(nrel_api_key): def test_psm3_variable_map_deprecation_warning(nrel_api_key): with pytest.warns(pvlibDeprecationWarning, match='names will be renamed'): _ = psm3.read_psm3(MANUAL_TEST_DATA) - - -@pytest.mark.remote_data -@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) -def test_psm3_leap_day_deprecation_warning(nrel_api_key): - with pytest.warns(pvlibDeprecationWarning, - match='default to leap_day=True'): - _, _ = psm3.get_psm3(LATITUDE, LONGITUDE, nrel_api_key, PVLIB_EMAIL, - names=2019, interval=60, - attributes=['ghi', 'wind_speed'], - map_variables=True) From 00114017e7212f880ff6fa83a71fde3f9e3cfc17 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Fri, 24 May 2024 11:05:50 +0200 Subject: [PATCH 2/2] Add whatsnew entry --- docs/sphinx/source/whatsnew/v0.11.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.11.0.rst b/docs/sphinx/source/whatsnew/v0.11.0.rst index 142974ea78..7c536219db 100644 --- a/docs/sphinx/source/whatsnew/v0.11.0.rst +++ b/docs/sphinx/source/whatsnew/v0.11.0.rst @@ -15,6 +15,8 @@ Deprecations Enhancements ~~~~~~~~~~~~ +* The `leap_day` parameter in :py:func:`~pvlib.iotools.get_psm3` + now defaults to True instead of False. (:issue:`1481`, :pull:`1991`) Bug fixes