8000 Change surface_azimuth convention in get_pvgis_hourly by AdamRJensen · Pull Request #1739 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

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 4 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_pvigs_hourly` to conform to the
pvlib azimuth convention (counterclockwise from north). Previously 0 degrees represented south.
(:issue:`1724`, :pull:`1739`)


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

Expand Down
17 changes: 12 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,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 @@ -136,6 +137,12 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
the error message in the response will be raised as an exception,
otherwise raise whatever ``HTTP/1.1`` error occurred

Info
----
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.

Hint
----
PVGIS provides access to a number of different solar radiation datasets,
Expand Down Expand Up @@ -191,7 +198,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
0