Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make leap_day=True default for PSM3 (new) #1991

Merged
merged 4 commits into from
Jun 2, 2024
Merged
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
2 changes: 2 additions & 0 deletions docs/sphinx/source/whatsnew/v0.11.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Breaking changes
~~~~~~~~~~~~~~~~
* The deprecated ``pvlib.modelchain.basic_chain`` has now been removed. (:pull:`1862`)
* Remove the `poa_horizontal_ratio` function and all of its references. (:issue:`1697`, :pull:`2021`)
* The `leap_day` parameter in :py:func:`~pvlib.iotools.get_psm3`
now defaults to True instead of False. (:issue:`1481`, :pull:`1991`)


Deprecations
Expand Down
12 changes: 2 additions & 10 deletions pvlib/iotools/psm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 0 additions & 11 deletions pvlib/tests/iotools/test_psm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading