Skip to content

Make leap_day=True default for PSM3 (duplicated) #1500

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

Closed
wants to merge 4 commits into from
Closed
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
12 changes: 2 additions & 10 deletions pvlib/iotools/psm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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, timeout=30):
"""
Retrieve NSRDB PSM3 timeseries weather data from the PSM3 API. The NSRDB
Expand Down Expand Up @@ -75,7 +75,7 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
``pvlib.iotools.psm3.ATTRIBUTES``. See references [2]_, [3]_, and [4]_
for lists of available fields. Alternatively, pvlib names may also be
used (e.g. 'ghi' rather than 'GHI'); see :const:`VARIABLE_MAP`.
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 @@ -165,14 +165,6 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
attributes = [amap.get(a, a) for a in attributes]
attributes = list(set(attributes)) # remove duplicate values

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
15 changes: 1 addition & 14 deletions pvlib/tests/iotools/test_psm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ def test_get_psm3_check_leap_day(nrel_api_key):
])
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_get_psm3_tmy_errors(
latitude, longitude, api_key, names, interval
):
def test_get_psm3_tmy_errors(latitude, longitude, api_key, names, interval):
"""Test get_psm3() for multiple erroneous input scenarios.

These scenarios include:
Expand Down Expand Up @@ -201,14 +199,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)