From a21d46c651a7567fe5733a0064b364464294ac05 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 01:50:52 +0200 Subject: [PATCH 01/13] Change surface_azimuth convention --- pvlib/iotools/pvgis.py | 17 ++++++++++++----- pvlib/tests/iotools/test_pvgis.py | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index edfb28c124..3d6634503f 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -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, @@ -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 @@ -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, @@ -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), diff --git a/pvlib/tests/iotools/test_pvgis.py b/pvlib/tests/iotools/test_pvgis.py index 579c26914c..2b6b49b6cc 100644 --- a/pvlib/tests/iotools/test_pvgis.py +++ b/pvlib/tests/iotools/test_pvgis.py @@ -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, From 4af3a595b8237f10db49fbe176c6949760087d9c Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 02:00:08 +0200 Subject: [PATCH 02/13] Update v0.9.6.rst --- docs/sphinx/source/whatsnew/v0.9.6.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.6.rst b/docs/sphinx/source/whatsnew/v0.9.6.rst index 7d1271086f..ffe7ac53a1 100644 --- a/docs/sphinx/source/whatsnew/v0.9.6.rst +++ b/docs/sphinx/source/whatsnew/v0.9.6.rst @@ -11,7 +11,9 @@ Deprecations Enhancements ~~~~~~~~~~~~ - +* 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`) Bug fixes ~~~~~~~~~ From 517554bdb6ab032aa925db7497b3e30538ef7ca7 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 02:04:48 +0200 Subject: [PATCH 03/13] Update v0.9.6.rst --- docs/sphinx/source/whatsnew/v0.9.6.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.6.rst b/docs/sphinx/source/whatsnew/v0.9.6.rst index ffe7ac53a1..93cf1823fe 100644 --- a/docs/sphinx/source/whatsnew/v0.9.6.rst +++ b/docs/sphinx/source/whatsnew/v0.9.6.rst @@ -5,15 +5,20 @@ 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 ~~~~~~~~~~~~ Enhancements ~~~~~~~~~~~~ -* 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`) + Bug fixes ~~~~~~~~~ From 8db7d4793bdeefc57ee41314b6868d0642e9331c Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 02:08:54 +0200 Subject: [PATCH 04/13] Update v0.9.6.rst --- docs/sphinx/source/whatsnew/v0.9.6.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.6.rst b/docs/sphinx/source/whatsnew/v0.9.6.rst index 93cf1823fe..075aff7be0 100644 --- a/docs/sphinx/source/whatsnew/v0.9.6.rst +++ b/docs/sphinx/source/whatsnew/v0.9.6.rst @@ -7,7 +7,7 @@ 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 +* 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`) From 14421a46f800d5df3962bce83006412d22348804 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 07:48:38 +0200 Subject: [PATCH 05/13] Update docs/sphinx/source/whatsnew/v0.9.6.rst Co-authored-by: Kevin Anderson --- docs/sphinx/source/whatsnew/v0.9.6.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.6.rst b/docs/sphinx/source/whatsnew/v0.9.6.rst index 075aff7be0..27c8245758 100644 --- a/docs/sphinx/source/whatsnew/v0.9.6.rst +++ b/docs/sphinx/source/whatsnew/v0.9.6.rst @@ -7,7 +7,7 @@ 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 +* 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`) From 2cc1a7b427b63e4b57d39ff20fcc95f44de064df Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 07:50:52 +0200 Subject: [PATCH 06/13] Remote info section header --- pvlib/iotools/pvgis.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index 3d6634503f..d758ff8c97 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -137,14 +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 + 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. - Hint - ---- 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 From ea0ee4589f1d84db4b834cd037cb2ff0a4a9ee8c Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Wed, 17 May 2023 07:55:26 +0200 Subject: [PATCH 07/13] Add version changed --- pvlib/iotools/pvgis.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index d758ff8c97..167153ea33 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -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 From 476c7a6b240514d1f1dfe3b4a91b99d2e7224b4c Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Mon, 22 May 2023 17:45:37 +0200 Subject: [PATCH 08/13] Update version changed --- pvlib/iotools/pvgis.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index 167153ea33..6c89745432 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -57,12 +57,6 @@ 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 @@ -86,6 +80,11 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None, 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.6 is offset by 180 degrees. usehorizon: bool, default: True Include effects of horizon userhorizon: list of float, default: None From 80db0c3c6f2c4b01d775397a61ffe94fd418f008 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Mon, 22 May 2023 20:36:49 +0200 Subject: [PATCH 09/13] Update pvlib/iotools/pvgis.py Co-authored-by: Kevin Anderson --- pvlib/iotools/pvgis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index 6c89745432..9a6458aa07 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -84,7 +84,7 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None, .. 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. + 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 From 0aea4ea895f4bdc567891b6ec3db9f05c85b67fb Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Mon, 22 May 2023 20:49:10 +0200 Subject: [PATCH 10/13] Add azimuth warning section --- pvlib/iotools/pvgis.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index 9a6458aa07..e7365d6799 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -154,6 +154,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: From 65838118950e919bd7a727697fc58b041d37b5e9 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Mon, 22 May 2023 21:08:41 +0200 Subject: [PATCH 11/13] Add Warning to read_pvgis_hourly --- pvlib/iotools/pvgis.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index e7365d6799..b481822c64 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -332,6 +332,13 @@ 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. This is + despite the fact that the input parameter `surface_tilt` has to be + specified according to the pvlib convention. + Raises ------ ValueError From f1b49004eff34840e969db680e43f72e2533e9f3 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Mon, 22 May 2023 21:09:18 +0200 Subject: [PATCH 12/13] Remove surface_azimuth hint --- pvlib/iotools/pvgis.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index b481822c64..a26c9fb9b6 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -144,10 +144,6 @@ 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 From f8bcc13fb57017f8af424af2caead1c7582d0217 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Mon, 22 May 2023 21:39:05 +0200 Subject: [PATCH 13/13] Update read_pvgis_hourly warning --- pvlib/iotools/pvgis.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pvlib/iotools/pvgis.py b/pvlib/iotools/pvgis.py index a26c9fb9b6..268d52e2ef 100644 --- a/pvlib/iotools/pvgis.py +++ b/pvlib/iotools/pvgis.py @@ -331,9 +331,7 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True): 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. + correspond to the pvlib convention, but is offset 180 degrees. Raises ------