Skip to content

Change surface_azimuth convention in get_pvgis_hourly #1739

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 14 commits into from
May 25, 2023
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
4 changes: 3 additions & 1 deletion docs/sphinx/source/whatsnew/v0.9.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ v0.9.6 (Anticipated June 2023)

Breaking Changes
~~~~~~~~~~~~~~~~
* Modified the ``surface_azimuth`` parameter in :py:func:`pvlib.iotools.get_pvgis_hourly` to conform to the
pvlib azimuth convention (counterclockwise from north). Previously 0 degrees represented south.
(:issue:`1724`, :pull:`1739`)
* For consistency with the rest of pvlib, the ``tilt`` parameter is renamed
to ``surface_tilt`` in :py:func:`pvlib.soiling.hsu`. (:issue:`1717`, :pull:`1738`)


Deprecations
~~~~~~~~~~~~
Expand Down
28 changes: 23 additions & 5 deletions pvlib/iotools/pvgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

def get_pvgis_hourly(latitude, longitude, start=None, end=None,
raddatabase=None, components=True,
surface_tilt=0, surface_azimuth=0,
surface_tilt=0, surface_azimuth=180,
outputformat='json',
usehorizon=True, userhorizon=None,
pvcalculation=False,
Expand Down Expand Up @@ -76,9 +76,15 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
Otherwise only global irradiance is returned.
surface_tilt: float, default: 0
Tilt angle from horizontal plane. Ignored for two-axis tracking.
surface_azimuth: float, default: 0
Orientation (azimuth angle) of the (fixed) plane. 0=south, 90=west,
-90: east. Ignored for tracking systems.
surface_azimuth: float, default: 180
Orientation (azimuth angle) of the (fixed) plane. Counter-clockwise
from north (north=0, south=180). This is offset 180 degrees from
the convention used by PVGIS. Ignored for tracking systems.

.. versionchanged:: 0.10.0
The `surface_azimuth` parameter now follows the pvlib convention, which
is counterclockwise from north. However, the convention used by the
PVGIS website and pvlib<=0.9.5 is offset by 180 degrees.
usehorizon: bool, default: True
Include effects of horizon
userhorizon: list of float, default: None
Expand Down Expand Up @@ -144,6 +150,13 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
time stamp convention, e.g., SARAH and SARAH2 provide instantaneous values,
whereas values from ERA5 are averages for the hour.

Warning
-------
The azimuth orientation specified in the output metadata does not
correspond to the pvlib convention, but is offset 180 degrees. This is
despite the fact that the input parameter `surface_tilt` has to be
specified according to the pvlib convention.

Notes
-----
data includes the following fields:
Expand Down Expand Up @@ -191,7 +204,7 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
""" # noqa: E501
# use requests to format the query string by passing params dictionary
params = {'lat': latitude, 'lon': longitude, 'outputformat': outputformat,
'angle': surface_tilt, 'aspect': surface_azimuth,
'angle': surface_tilt, 'aspect': surface_azimuth-180,
'pvcalculation': int(pvcalculation),
'pvtechchoice': pvtechchoice, 'mountingplace': mountingplace,
'trackingtype': trackingtype, 'components': int(components),
Expand Down Expand Up @@ -315,6 +328,11 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
metadata : dict
metadata

Warning
-------
The azimuth orientation specified in the output metadata does not
correspond to the pvlib convention, but is offset 180 degrees.

Raises
------
ValueError
Expand Down
4 changes: 2 additions & 2 deletions pvlib/tests/iotools/test_pvgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ def test_read_pvgis_hourly_bad_extension():


args_radiation_csv = {
'surface_tilt': 30, 'surface_azimuth': 0, 'outputformat': 'csv',
'surface_tilt': 30, 'surface_azimuth': 180, 'outputformat': 'csv',
'usehorizon': False, 'userhorizon': None, 'raddatabase': 'PVGIS-SARAH',
'start': 2016, 'end': 2016, 'pvcalculation': False, 'components': True}

url_hourly_radiation_csv = 'https://re.jrc.ec.europa.eu/api/seriescalc?lat=45&lon=8&outputformat=csv&angle=30&aspect=0&usehorizon=0&pvtechchoice=crystSi&mountingplace=free&trackingtype=0&components=1&raddatabase=PVGIS-SARAH&startyear=2016&endyear=2016' # noqa: E501

args_pv_json = {
'surface_tilt': 30, 'surface_azimuth': 0, 'outputformat': 'json',
'surface_tilt': 30, 'surface_azimuth': 180, 'outputformat': 'json',
'usehorizon': True, 'userhorizon': None, 'raddatabase': 'PVGIS-SARAH2',
'start': pd.Timestamp(2013, 1, 1), 'end': pd.Timestamp(2014, 5, 1),
'pvcalculation': True, 'peakpower': 10, 'pvtechchoice': 'CIS', 'loss': 5,
Expand Down