Skip to content

Update cams links #1529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion docs/sphinx/source/whatsnew/v0.9.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ Testing
* Speed up CI setup using micromamba instead of conda (:pull:`1493`)
* Drop python 3.6 (reached end of life Dec 2021) and add 3.10 to test matrix (:pull:`1507`)


Documentation
~~~~~~~~~~~~~
* Added a reference to :py:func:`pvlib.inverter.sandia_multi`. (:pull:`1479`)
* Add gallery example of simulating rearside irradiance for a fixed-tilt
array with pvfactors (:pull:`1470`)
* Updated reference links to CAMS Radiation (:issue:`1515`, :pull:`1529`)

Benchmarking
~~~~~~~~~~~~~
Expand Down
53 changes: 23 additions & 30 deletions pvlib/iotools/sodapro.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'GHI no corr', 'BHI no corr', 'DHI no corr', 'BNI no corr']

# Dictionary mapping CAMS Radiation and McClear variables to pvlib names
CAMS_VARIABLE_MAP = {
VARIABLE_MAP = {
'TOA': 'ghi_extra',
'Clear sky GHI': 'ghi_clear',
'Clear sky BHI': 'bhi_clear',
Expand Down Expand Up @@ -47,12 +47,11 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
server='www.soda-is.com', timeout=30):
"""
Retrieve time-series of radiation and/or clear-sky global, beam, and
diffuse radiation from CAMS. Data from CAMS Radiation [1]_ and CAMS McClear
[2]_ are retrieved from SoDa [3]_.
diffuse radiation from CAMS (see [1]_). Data is retrieved from SoDa [2]_.

Time coverage: 2004-01-01 to two days ago

Access: free, but requires registration, see [1]_
Access: free, but requires registration, see [2]_

Requests: max. 100 per day
Geographical coverage: worldwide for CAMS McClear and approximately -66° to
Expand Down Expand Up @@ -91,7 +90,7 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
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 CAMS_VARIABLE_MAP.
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)
timeout : int, default: 30
Expand All @@ -107,7 +106,7 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
Notes
-----
In order to use the CAMS services, users must register for a free SoDa
account using an email address [1]_.
account using an email address [2]_.

The returned data DataFrame includes the following fields:

Expand All @@ -130,15 +129,14 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
======================== ====== =========================================

†Parameters only returned if identifier='cams_radiation'. For description
of additional output parameters in verbose mode, see [1]_ and [2]_.
of additional output parameters in verbose mode, see [1]_.

Note that it is recommended to specify the latitude and longitude to at
least the fourth decimal place.

Variables corresponding to standard pvlib variables are renamed,
e.g. `sza` becomes `solar_zenith`. See the
`pvlib.iotools.cams.CAMS_VARIABLE_MAP` dict for the complete
mapping.
e.g. `sza` becomes `solar_zenith`. See variable :const:`VARIABLE_MAP` for
the complete mapping.

See Also
--------
Expand All @@ -152,12 +150,10 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',

References
----------
.. [1] `CAMS Radiation Service Info
<https://www.soda-pro.com/web-services/radiation/cams-radiation-service/info>`_
.. [2] `CAMS McClear Service Info
<https://www.soda-pro.com/web-services/radiation/cams-mcclear/info>`_
.. [3] `CAMS McClear Automatic Access
<https://www.soda-pro.com/help/cams-services/cams-mcclear-service/automatic-access>`_
.. [1] `CAMS solar radiation documentation
<https://atmosphere.copernicus.eu/solar-radiation>`_
.. [2] `CAMS Radiation Automatic Access (SoDa)
<https://www.soda-pro.com/help/cams-services/cams-radiation-service/automatic-access>`_
"""
try:
time_step_str = TIME_STEPS_MAP[time_step]
Expand Down Expand Up @@ -233,7 +229,7 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
def parse_cams(fbuf, integrated=False, label=None, map_variables=True):
"""
Parse a file-like buffer with data in the format of a CAMS Radiation or
McClear file. The CAMS services are described in [1]_ and [2]_.
McClear file. The CAMS solar radiation services are described in [1]_.

Parameters
----------
Expand All @@ -247,7 +243,7 @@ def parse_cams(fbuf, 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 CAMS_VARIABLE_MAP.
where applicable. See variable :const:`VARIABLE_MAP`.

Returns
-------
Expand All @@ -262,10 +258,8 @@ def parse_cams(fbuf, integrated=False, label=None, map_variables=True):

References
----------
.. [1] `CAMS Radiation Service Info
<https://www.soda-pro.com/web-services/radiation/cams-radiation-service/info>`_
.. [2] `CAMS McClear Service Info
<https://www.soda-pro.com/web-services/radiation/cams-mcclear/info>`_
.. [1] `CAMS solar radiation documentation
<https://atmosphere.copernicus.eu/solar-radiation>`_
"""
metadata = {}
# Initial lines starting with # contain metadata
Expand Down Expand Up @@ -327,15 +321,16 @@ def parse_cams(fbuf, integrated=False, label=None, map_variables=True):
TIME_STEPS_IN_HOURS[time_step])
data.index.name = None # Set index name to None
if map_variables:
data = data.rename(columns=CAMS_VARIABLE_MAP)
data = data.rename(columns=VARIABLE_MAP)

return data, metadata


def read_cams(filename, integrated=False, label=None, map_variables=True):
"""
Read a CAMS Radiation or McClear file into a pandas DataFrame. CAMS
radiation and McClear are described in [1]_ and [2]_, respectively.
Read a CAMS Radiation or McClear file into a pandas DataFrame.

CAMS Radiation and McClear are described in [1]_.

Parameters
----------
Expand All @@ -349,7 +344,7 @@ 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 CAMS_VARIABLE_MAP.
where applicable. See variable VARIABLE_MAP.

Returns
-------
Expand All @@ -365,10 +360,8 @@ def read_cams(filename, integrated=False, label=None, map_variables=True):

References
----------
.. [1] `CAMS Radiation Service Info
<https://www.soda-pro.com/web-services/radiation/cams-radiation-service/info>`_
.. [2] `CAMS McClear Service Info
<https://www.soda-pro.com/web-services/radiation/cams-mcclear/info>`_
.. [1] `CAMS solar radiation documentation
<https://atmosphere.copernicus.eu/solar-radiation>`_
"""
with open(str(filename), 'r') as fbuf:
content = parse_cams(fbuf, integrated, label, map_variables)
Expand Down