Skip to content

Commit 3b35261

Browse files
authored
Change server parameter to url in get_cams (#2463)
* Change server parameter to url in get_cams * Update test_sodapro.py * Update v0.12.1.rst * Move whatsnew to deprecations
1 parent f33be83 commit 3b35261

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Deprecations
1616
- :py:func:`~pvlib.iotools.parse_psm3`
1717
- :py:func:`~pvlib.iotools.parse_cams`
1818

19+
* The ``server`` parameter in :py:func:`~pvlib.iotools.get_cams` has been renamed
20+
to ``url`` to be consistent with the other iotools.
21+
:pull:`2463`
22+
1923

2024
Bug fixes
2125
~~~~~~~~~

pvlib/iotools/sodapro.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import warnings
1010
from pvlib import tools
1111

12-
from pvlib._deprecation import deprecated
12+
from pvlib._deprecation import deprecated, renamed_kwarg_warning
1313

1414
URL = 'api.soda-solardata.com'
1515

@@ -45,10 +45,15 @@
4545
'0 year 1 month 0 day 0 h 0 min 0 s': '1M'}
4646

4747

48+
@renamed_kwarg_warning(
49+
since='0.13.0',
50+
old_param_name='server',
51+
new_param_name='url',
52+
removal="0.14.0")
4853
def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
4954
altitude=None, time_step='1h', time_ref='UT', verbose=False,
5055
integrated=False, label=None, map_variables=True,
51-
server=URL, timeout=30):
56+
url=URL, timeout=30):
5257
"""Retrieve irradiance and clear-sky time series from CAMS.
5358
5459
Time-series of radiation and/or clear-sky global, beam, and
@@ -98,7 +103,7 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
98103
map_variables: bool, default: True
99104
When true, renames columns of the DataFrame to pvlib variable names
100105
where applicable. See variable :const:`VARIABLE_MAP`.
101-
server: str, default: :const:`pvlib.iotools.sodapro.URL`
106+
url: str, default: :const:`pvlib.iotools.sodapro.URL`
102107
Base url of the SoDa Pro CAMS Radiation API.
103108
timeout : int, default: 30
104109
Time in seconds to wait for server response before timeout
@@ -199,7 +204,7 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
199204
email = email.replace('@', '%2540') # Format email address
200205
identifier = 'get_{}'.format(identifier.lower()) # Format identifier str
201206

202-
base_url = f"https://{server}/service/wps"
207+
base_url = f"https://{url}/service/wps"
203208

204209
data_inputs_dict = {
205210
'latitude': latitude,

tests/iotools/test_sodapro.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def test_get_cams(requests_mock, testfile, index, columns, values, dtypes,
253253

254254
def test_get_cams_bad_request(requests_mock):
255255
"""Test that a the correct errors/warnings ares raised for invalid
256-
requests inputs. Also tests if the specified server url gets used"""
256+
requests inputs. Also tests if the specified url gets used"""
257257

258258
# Subset of an xml file returned for errornous requests
259259
mock_response_bad_text = """<?xml version="1.0" encoding="utf-8"?>
@@ -281,7 +281,7 @@ def test_get_cams_bad_request(requests_mock):
281281
time_ref='TST',
282282
verbose=False,
283283
time_step='1h',
284-
server='pro.soda-is.com')
284+
url='pro.soda-is.com')
285285
# Test if value error is raised if incorrect identifier is specified
286286
with pytest.raises(ValueError, match='Identifier must be either'):
287287
_ = sodapro.get_cams(
@@ -291,7 +291,7 @@ def test_get_cams_bad_request(requests_mock):
291291
longitude=12.5251,
292292
293293
identifier='test', # incorrect identifier
294-
server='pro.soda-is.com')
294+
url='pro.soda-is.com')
295295
# Test if value error is raised if incorrect time step is specified
296296
with pytest.raises(ValueError, match='Time step not recognized'):
297297
_ = sodapro.get_cams(
@@ -302,4 +302,4 @@ def test_get_cams_bad_request(requests_mock):
302302
303303
identifier='mcclear',
304304
time_step='test', # incorrect time step
305-
server='pro.soda-is.com')
305+
url='pro.soda-is.com')

0 commit comments

Comments
 (0)