Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
7 changes: 7 additions & 0 deletions docs/sphinx/source/whatsnew/v0.9.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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`)


Deprecations
~~~~~~~~~~~~

Expand Down
21 changes: 16 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 All @@ -57,6 +57,12 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,

PVGIS data is freely available at [1]_.

.. 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.6 is offset by 180 degrees.


Parameters
----------
latitude: float
Expand All @@ -76,9 +82,10 @@ 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.
usehorizon: bool, default: True
Include effects of horizon
userhorizon: list of float, default: None
Expand Down Expand Up @@ -138,6 +145,10 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,

Hint
----
The `surface_azimuth` parameter follows the pvlib convention, which is
counterclockwise from north. However, when using the PVGIS website, the
corresponding parameter (`aspect`) is offset by 180 degrees.

PVGIS provides access to a number of different solar radiation datasets,
including satellite-based (SARAH, SARAH2, and NSRDB PSM3) and re-analysis
products (ERA5). Each data source has a different geographical coverage and
Expand Down Expand Up @@ -191,7 +202,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
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