From 2d69b21142e939a181175f0a0017a27e9f611a60 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 02:24:42 +0200 Subject: [PATCH 1/3] Update url --- pvlib/iotools/sodapro.py | 2 +- pvlib/tests/iotools/test_sodapro.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pvlib/iotools/sodapro.py b/pvlib/iotools/sodapro.py index c57052b254..d0fb180b92 100644 --- a/pvlib/iotools/sodapro.py +++ b/pvlib/iotools/sodapro.py @@ -44,7 +44,7 @@ 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='www.soda-is.com', timeout=30): + server='api.soda-solardata.com', timeout=30): """ Retrieve time-series of radiation and/or clear-sky global, beam, and diffuse radiation from CAMS (see [1]_). Data is retrieved from SoDa [2]_. diff --git a/pvlib/tests/iotools/test_sodapro.py b/pvlib/tests/iotools/test_sodapro.py index 24e5ebbfcf..ff17691a98 100644 --- a/pvlib/tests/iotools/test_sodapro.py +++ b/pvlib/tests/iotools/test_sodapro.py @@ -209,7 +209,7 @@ def test_get_cams(requests_mock, testfile, index, columns, values, dtypes, mock_response = test_file.read() # Specify the full URI of a specific example, this ensures that all of the # inputs are passing on correctly - 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 + 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 requests_mock.get(url_test_cams, text=mock_response, headers={'Content-Type': 'application/csv'}) From 8965a7a3cba3290fd411de01b3e342903c0c6b78 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 02:28:49 +0200 Subject: [PATCH 2/3] Update v0.9.6.rst --- docs/sphinx/source/whatsnew/v0.9.6.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.9.6.rst b/docs/sphinx/source/whatsnew/v0.9.6.rst index 7d1271086f..61e4557fff 100644 --- a/docs/sphinx/source/whatsnew/v0.9.6.rst +++ b/docs/sphinx/source/whatsnew/v0.9.6.rst @@ -11,6 +11,8 @@ Deprecations Enhancements ~~~~~~~~~~~~ +* Update the URL used in the :py:func:`pvlib.iotools.get_cams` function. The new URL supports load-balancing + and redirects to the fastest server. (:issue:`1688`, :pull:`1740`) Bug fixes From 0ecc3970cacf2203249371d63f3c14ee22d9ce7d Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Fri, 19 May 2023 10:32:23 +0200 Subject: [PATCH 3/3] Update server docstring & add URL constant --- pvlib/iotools/sodapro.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pvlib/iotools/sodapro.py b/pvlib/iotools/sodapro.py index d0fb180b92..9fb4602e09 100644 --- a/pvlib/iotools/sodapro.py +++ b/pvlib/iotools/sodapro.py @@ -9,6 +9,8 @@ import warnings +URL = 'api.soda-solardata.com' + CAMS_INTEGRATED_COLUMNS = [ 'TOA', 'Clear sky GHI', 'Clear sky BHI', 'Clear sky DHI', 'Clear sky BNI', 'GHI', 'BHI', 'DHI', 'BNI', @@ -44,7 +46,7 @@ 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='api.soda-solardata.com', timeout=30): + server=URL, timeout=30): """ Retrieve time-series of radiation and/or clear-sky global, beam, and 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', 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: 'www.soda-is.com' - Main server (www.soda-is.com) or backup mirror server (pro.soda-is.com) + server: 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 @@ -344,13 +346,13 @@ def read_cams(filename, integrated=False, label=None, map_variables=True): all time steps except for '1M' which has a default of 'right'. map_variables: bool, default: True When true, renames columns of the Dataframe to pvlib variable names - where applicable. See variable VARIABLE_MAP. + where applicable. See variable :const:`VARIABLE_MAP`. Returns ------- data: pandas.DataFrame - Timeseries data from CAMS Radiation or McClear - :func:`pvlib.iotools.get_cams` for fields + Timeseries data from CAMS Radiation or McClear. + See :func:`pvlib.iotools.get_cams` for fields. metadata: dict Metadata available in the file.