diff --git a/docs/sphinx/source/whatsnew/v0.12.1.rst b/docs/sphinx/source/whatsnew/v0.12.1.rst index 223c037f75..53320967cd 100644 --- a/docs/sphinx/source/whatsnew/v0.12.1.rst +++ b/docs/sphinx/source/whatsnew/v0.12.1.rst @@ -16,6 +16,10 @@ Deprecations - :py:func:`~pvlib.iotools.parse_psm3` - :py:func:`~pvlib.iotools.parse_cams` +* The ``server`` parameter in :py:func:`~pvlib.iotools.get_cams` has been renamed + to ``url`` to be consistent with the other iotools. + :pull:`2463` + Bug fixes ~~~~~~~~~ diff --git a/pvlib/iotools/sodapro.py b/pvlib/iotools/sodapro.py index 524db942ac..18972a4c7b 100644 --- a/pvlib/iotools/sodapro.py +++ b/pvlib/iotools/sodapro.py @@ -9,7 +9,7 @@ import warnings from pvlib import tools -from pvlib._deprecation import deprecated +from pvlib._deprecation import deprecated, renamed_kwarg_warning URL = 'api.soda-solardata.com' @@ -45,10 +45,15 @@ '0 year 1 month 0 day 0 h 0 min 0 s': '1M'} +@renamed_kwarg_warning( + since='0.13.0', + old_param_name='server', + new_param_name='url', + removal="0.14.0") def get_cams(latitude, longitude, start, end, email, identifier='mcclear', altitude=None, time_step='1h', time_ref='UT', verbose=False, integrated=False, label=None, map_variables=True, - server=URL, timeout=30): + url=URL, timeout=30): """Retrieve irradiance and clear-sky time series from CAMS. 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', map_variables: bool, default: True When true, renames columns of the DataFrame to pvlib variable names where applicable. See variable :const:`VARIABLE_MAP`. - server: str, default: :const:`pvlib.iotools.sodapro.URL` + url: str, default: :const:`pvlib.iotools.sodapro.URL` Base url of the SoDa Pro CAMS Radiation API. timeout : int, default: 30 Time in seconds to wait for server response before timeout @@ -199,7 +204,7 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear', email = email.replace('@', '%2540') # Format email address identifier = 'get_{}'.format(identifier.lower()) # Format identifier str - base_url = f"https://{server}/service/wps" + base_url = f"https://{url}/service/wps" data_inputs_dict = { 'latitude': latitude, diff --git a/tests/iotools/test_sodapro.py b/tests/iotools/test_sodapro.py index 9bda1d8f16..7105e9ac98 100644 --- a/tests/iotools/test_sodapro.py +++ b/tests/iotools/test_sodapro.py @@ -253,7 +253,7 @@ def test_get_cams(requests_mock, testfile, index, columns, values, dtypes, def test_get_cams_bad_request(requests_mock): """Test that a the correct errors/warnings ares raised for invalid - requests inputs. Also tests if the specified server url gets used""" + requests inputs. Also tests if the specified url gets used""" # Subset of an xml file returned for errornous requests mock_response_bad_text = """ @@ -281,7 +281,7 @@ def test_get_cams_bad_request(requests_mock): time_ref='TST', verbose=False, time_step='1h', - server='pro.soda-is.com') + url='pro.soda-is.com') # Test if value error is raised if incorrect identifier is specified with pytest.raises(ValueError, match='Identifier must be either'): _ = sodapro.get_cams( @@ -291,7 +291,7 @@ def test_get_cams_bad_request(requests_mock): longitude=12.5251, email='test@test.com', identifier='test', # incorrect identifier - server='pro.soda-is.com') + url='pro.soda-is.com') # Test if value error is raised if incorrect time step is specified with pytest.raises(ValueError, match='Time step not recognized'): _ = sodapro.get_cams( @@ -302,4 +302,4 @@ def test_get_cams_bad_request(requests_mock): email='test@test.com', identifier='mcclear', time_step='test', # incorrect time step - server='pro.soda-is.com') + url='pro.soda-is.com')