Skip to content

Commit 247d2f1

Browse files
authored
Update SoDa Pro / CAMS url (#1740)
* Update url * Update v0.9.6.rst * Update server docstring & add URL constant
1 parent 275e671 commit 247d2f1

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Deprecations
1111

1212
Enhancements
1313
~~~~~~~~~~~~
14+
* Update the URL used in the :py:func:`pvlib.iotools.get_cams` function. The new URL supports load-balancing
15+
and redirects to the fastest server. (:issue:`1688`, :pull:`1740`)
1416

1517

1618
Bug fixes

pvlib/iotools/sodapro.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import warnings
1010

1111

12+
URL = 'api.soda-solardata.com'
13+
1214
CAMS_INTEGRATED_COLUMNS = [
1315
'TOA', 'Clear sky GHI', 'Clear sky BHI', 'Clear sky DHI', 'Clear sky BNI',
1416
'GHI', 'BHI', 'DHI', 'BNI',
@@ -44,7 +46,7 @@
4446
def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
4547
altitude=None, time_step='1h', time_ref='UT', verbose=False,
4648
integrated=False, label=None, map_variables=True,
47-
server='www.soda-is.com', timeout=30):
49+
server=URL, timeout=30):
4850
"""
4951
Retrieve time-series of radiation and/or clear-sky global, beam, and
5052
diffuse radiation from CAMS (see [1]_). Data is retrieved from SoDa [2]_.
@@ -91,8 +93,8 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
9193
map_variables: bool, default: True
9294
When true, renames columns of the DataFrame to pvlib variable names
9395
where applicable. See variable :const:`VARIABLE_MAP`.
94-
server: str, default: 'www.soda-is.com'
95-
Main server (www.soda-is.com) or backup mirror server (pro.soda-is.com)
96+
server: str, default: :const:`pvlib.iotools.sodapro.URL`
97+
Base url of the SoDa Pro CAMS Radiation API.
9698
timeout : int, default: 30
9799
Time in seconds to wait for server response before timeout
98100
@@ -344,13 +346,13 @@ def read_cams(filename, integrated=False, label=None, map_variables=True):
344346
all time steps except for '1M' which has a default of 'right'.
345347
map_variables: bool, default: True
346348
When true, renames columns of the Dataframe to pvlib variable names
347-
where applicable. See variable VARIABLE_MAP.
349+
where applicable. See variable :const:`VARIABLE_MAP`.
348350
349351
Returns
350352
-------
351353
data: pandas.DataFrame
352-
Timeseries data from CAMS Radiation or McClear
353-
:func:`pvlib.iotools.get_cams` for fields
354+
Timeseries data from CAMS Radiation or McClear.
355+
See :func:`pvlib.iotools.get_cams` for fields.
354356
metadata: dict
355357
Metadata available in the file.
356358

pvlib/tests/iotools/test_sodapro.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_get_cams(requests_mock, testfile, index, columns, values, dtypes,
209209
mock_response = test_file.read()
210210
# Specify the full URI of a specific example, this ensures that all of the
211211
# inputs are passing on correctly
212-
url_test_cams = f'https://www.soda-is.com/service/wps?DataInputs=latitude=55.7906;longitude=12.5251;altitude=80;date_begin=2020-01-01;date_end=2020-05-04;time_ref=UT;summarization=P01M;username=pvlib-admin%2540googlegroups.com;verbose=false&Service=WPS&Request=Execute&Identifier=get_{identifier}&version=1.0.0&RawDataOutput=irradiation' # noqa: E501
212+
url_test_cams = f'https://api.soda-solardata.com/service/wps?DataInputs=latitude=55.7906;longitude=12.5251;altitude=80;date_begin=2020-01-01;date_end=2020-05-04;time_ref=UT;summarization=P01M;username=pvlib-admin%2540googlegroups.com;verbose=false&Service=WPS&Request=Execute&Identifier=get_{identifier}&version=1.0.0&RawDataOutput=irradiation' # noqa: E501
213213

214214
requests_mock.get(url_test_cams, text=mock_response,
215215
headers={'Content-Type': 'application/csv'})

0 commit comments

Comments
 (0)