From 02cf2e20acf66f96c1bdf242a5d0830d6c10bd40 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Sun, 25 May 2025 22:07:31 -0600 Subject: [PATCH 1/4] Change server parameter to url in get_cams --- pvlib/iotools/sodapro.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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, From c6cc7c467af3694dfea26719fedc132e1f3d32aa Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Sun, 25 May 2025 22:09:46 -0600 Subject: [PATCH 2/4] Update test_sodapro.py --- tests/iotools/test_sodapro.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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') From f67bdf8fdfcc2b6290589916391bf329780d3548 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Sun, 25 May 2025 22:11:06 -0600 Subject: [PATCH 3/4] Update v0.12.1.rst --- docs/sphinx/source/whatsnew/v0.12.1.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.12.1.rst b/docs/sphinx/source/whatsnew/v0.12.1.rst index 223c037f75..3a8a32f391 100644 --- a/docs/sphinx/source/whatsnew/v0.12.1.rst +++ b/docs/sphinx/source/whatsnew/v0.12.1.rst @@ -6,7 +6,9 @@ v0.12.1 (XXXX, 2025) Breaking Changes ~~~~~~~~~~~~~~~~ - +* The ``server`` parameter in :py:func:`~pvlib.iotools.get_cams` has been renamed + to ``url`` to be consistent with the other iotoools. + :pull:`2463` Deprecations ~~~~~~~~~~~~ From 6db5e501e60ce12fc04badd4e9ee412bd8e0c6c6 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Mon, 26 May 2025 20:56:34 -0600 Subject: [PATCH 4/4] Move whatsnew to deprecations --- docs/sphinx/source/whatsnew/v0.12.1.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.12.1.rst b/docs/sphinx/source/whatsnew/v0.12.1.rst index 3a8a32f391..53320967cd 100644 --- a/docs/sphinx/source/whatsnew/v0.12.1.rst +++ b/docs/sphinx/source/whatsnew/v0.12.1.rst @@ -6,9 +6,7 @@ v0.12.1 (XXXX, 2025) Breaking Changes ~~~~~~~~~~~~~~~~ -* The ``server`` parameter in :py:func:`~pvlib.iotools.get_cams` has been renamed - to ``url`` to be consistent with the other iotoools. - :pull:`2463` + Deprecations ~~~~~~~~~~~~ @@ -18,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 ~~~~~~~~~