8000 Change surface_azimuth convention in get_pvgis_hourly (#1739) · pimika/pvlib-python@5119b42 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5119b42

Browse files
Change surface_azimuth convention in get_pvgis_hourly (pvlib#1739)
* Change surface_azimuth convention * Update v0.9.6.rst * Update v0.9.6.rst * Update v0.9.6.rst * Update docs/sphinx/source/whatsnew/v0.9.6.rst Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com> * Remote info section header * Add version changed * Update version changed * Update pvlib/iotools/pvgis.py Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com> * Add azimuth warning section * Add Warning to read_pvgis_hourly * Remove surface_azimuth hint * Update read_pvgis_hourly warning --------- Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com>
1 parent 4101bb2 commit 5119b42

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

docs/sphinx/source/whatsnew/v0.9.6.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ v0.9.6 (Anticipated June 2023)
77

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

1416
Deprecations
1517
~~~~~~~~~~~~

pvlib/iotools/pvgis.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
def get_pvgis_hourly(latitude, longitude, start=None, end=None,
4747
raddatabase=None, components=True,
48-
surface_tilt=0, surface_azimuth=0,
48+
surface_tilt=0, surface_azimuth=180,
4949
outputformat='json',
5050
usehorizon=True, userhorizon=None,
5151
pvcalculation=False,
@@ -76,9 +76,15 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
7676
Otherwise only global irradiance is returned.
7777
surface_tilt: float, default: 0
7878
Tilt angle from horizontal plane. Ignored for two-axis tracking.
79-
surface_azimuth: float, default: 0
80-
Orientation (azimuth angle) of the (fixed) plane. 0=south, 90=west,
81-
-90: east. Ignored for tracking systems.
79+
surface_azimuth: float, default: 180
80+
Orientation (azimuth angle) of the (fixed) plane. Counter-clockwise
81+
from north (north=0, south=180). This is offset 180 degrees from
82+
the convention used by PVGIS. Ignored for tracking systems.
83+
84+
.. versionchanged:: 0.10.0
85+
The `surface_azimuth` parameter now follows the pvlib convention, which
86+
is counterclockwise from north. However, the convention used by the
87+
PVGIS website and pvlib<=0.9.5 is offset by 180 degrees.
8288
usehorizon: bool, default: True
8389
Include effects of horizon
8490
userhorizon: list of float, default: None
@@ -144,6 +150,13 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
144150
time stamp convention, e.g., SARAH and SARAH2 provide instantaneous values,
145151
whereas values from ERA5 are averages for the hour.
146152
153+
Warning
154+
-------
155+
The azimuth orientation specified in the output metadata does not
156+
correspond to the pvlib convention, but is offset 180 degrees. This is
157+
despite the fact that the input parameter `surface_tilt` has to be
158+
specified according to the pvlib convention.
159+
147160
Notes
148161
-----
149162
data includes the following fields:
@@ -191,7 +204,7 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
191204
""" # noqa: E501
192205
# use requests to format the query string by passing params dictionary
193206
params = {'lat': latitude, 'lon': longitude, 'outputformat': outputformat,
194-
'angle': surface_tilt, 'aspect': surface_azimuth,
207+
'angle': surface_tilt, 'aspect': surface_azimuth-180,
195208
'pvcalculation': int(pvcalculation),
196209
'pvtechchoice': pvtechchoice, 'mountingplace': mountingplace,
197210
'trackingtype': trackingtype, 'components': int(components),
@@ -315,6 +328,11 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
315328
metadata : dict
316329
metadata
317330
331+
Warning
332+
-------
333+
The azimuth orientation specified in the output metadata does not
334+
correspond to the pvlib convention, but is offset 180 degrees.
335+
318336
Raises
319337
------
320338
ValueError

pvlib/tests/iotools/test_pvgis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ def test_read_pvgis_hourly_bad_extension():
207207

208208

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

214214
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
215215

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

0 commit comments

Comments
 (0)
0