Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion docs/sphinx/source/whatsnew/v0.12.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Copy link
Contributor

@echedey-ls echedey-ls May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be moved to the section down below, "Deprecations" (IMO)

Copy link
Member Author

@AdamRJensen AdamRJensen May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. It's first when it is completely removed that it should be listed in the "Breaking changes" section.


Deprecations
~~~~~~~~~~~~
Expand Down
13 changes: 9 additions & 4 deletions pvlib/iotools/sodapro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions tests/iotools/test_sodapro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """<?xml version="1.0" encoding="utf-8"?>
Expand Down Expand Up @@ -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(
Expand All @@ -291,7 +291,7 @@ def test_get_cams_bad_request(requests_mock):
longitude=12.5251,
email='[email protected]',
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(
Expand All @@ -302,4 +302,4 @@ def test_get_cams_bad_request(requests_mock):
email='[email protected]',
identifier='mcclear',
time_step='test', # incorrect time step
server='pro.soda-is.com')
url='pro.soda-is.com')
Loading