From 1eadff4b41dd6e817a60d6a154fa6387ea222cc6 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:18:59 -0400 Subject: [PATCH 01/18] pvgis gallery example Adding gallery example of how to use the PVGIS get_horizon_data function. --- .../far_shading_with_pvgis_horizon_data.py | 96 +++++++++++++++++++ docs/sphinx/source/whatsnew/v0.10.2.rst | 3 + 2 files changed, 99 insertions(+) create mode 100644 docs/examples/shading/far_shading_with_pvgis_horizon_data.py diff --git a/docs/examples/shading/far_shading_with_pvgis_horizon_data.py b/docs/examples/shading/far_shading_with_pvgis_horizon_data.py new file mode 100644 index 0000000000..86dd424e5a --- /dev/null +++ b/docs/examples/shading/far_shading_with_pvgis_horizon_data.py @@ -0,0 +1,96 @@ +""" +Far-Shading with PVGIS Horizon Data +========================= + +Example of getting PVGIS horizon data, interpolating it to time-series +solar-position data, and adjusting DNI and POA-global irradiance. +""" + +# %% +# This example shows how to use retrived horizon elevation angles with +# corresponding horizon azimuth angles from the +# :py:meth:`pvlib.iotools.get_pvgis_horizon` furntion. + +# After location information and a date range is established, solar position +# data is queried from :py:meth:`pvlib.solar_position.get_solar_position`. +# Horizon data is then retreived, and interpolated to the solar azimuth time +# series data. Finally, in times when solar elevation is greater than the +# interpolated horizon elevation angle, DNI is set to 0. + +import numpy as np +import pandas as pd +from pvlib.iotools import get_pvgis_horizon +from pvlib.location import Location +from pvlib.irradiance import get_total_irradiance + +# Golden, CO +lat, lon = 39.76, -105.22 +tz = 'MST' + +# Set times in the morning of the December solstice. +times = pd.date_range( + '2020-12-20 6:30', '2020-12-20 9:00', freq='1T', tz=tz, inclusive='left') + +# Create location object, and get solar position and clearsky irradiance data. +location = Location(lat, lon, tz) +solar_position = location.get_solarposition(times) +clearsky = location.get_clearsky(times) + +# Get horizon file meta-data and data. +horizon_file = get_pvgis_horizon(lat, lon) +horizon_data = horizon_file[0] + +# Set variable names for easier reading. +surface_tilt = 30 +surface_azimuth = 180 +solar_azimuth = solar_position.azimuth +solar_zenith = solar_position.apparent_zenith +solar_elevation = solar_position.apparent_elevation +dni = clearsky.dni +ghi = clearsky.ghi +dhi = clearsky.dhi + +# Interpolate the horizon elevation data to the solar azimuth, and keep as a +# numpy array. +horizon_elevation_data = np.interp( + solar_azimuth, horizon_data.index, horizon_data) + +# Convert to Pandas Series for easier usage. +horizon_elevation_data = pd.Series(horizon_elevation_data, times) + +# Adjust DNI based on data - note this is returned as numpy array +dni_adjusted = np.where( + solar_elevation > horizon_elevation_data, dni, 0 +) + +# Adjust GHI and set it to DHI for time-periods where 'dni_adjusted' is 0. +# Note this is returned as numpy array +ghi_adjusted = np.where( + dni_adjusted == 0, dhi, ghi +) + +# Transposition using the original and adjusted irradiance components. +irrad_pre_adj = get_total_irradiance( + surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni, ghi, dhi) + +irrad_post_adj = get_total_irradiance( + surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni_adjusted, + ghi_adjusted, dhi) + +# Create and plot result DataFrames. +poa_global_comparison = pd.DataFrame({ + 'poa_global_pre-adjustment': irrad_pre_adj.poa_global, + 'poa_global_post-adjustment': irrad_post_adj.poa_global +}) + +dni_comparison = pd.DataFrame({ + 'dni_pre-adjustment': dni, + 'dni_post-adjustment': dni_adjusted +}) + +# Plot results +poa_global_comparison.plot( + title='POA-Global: Before and after Horizon Adjustment', + ylabel='Irradiance') +dni_comparison.plot( + title='DNI: Before and after Horizon Adjustment', ylabel='Irradiance') diff --git a/docs/sphinx/source/whatsnew/v0.10.2.rst b/docs/sphinx/source/whatsnew/v0.10.2.rst index 42b81f5e5d..87baf5f958 100644 --- a/docs/sphinx/source/whatsnew/v0.10.2.rst +++ b/docs/sphinx/source/whatsnew/v0.10.2.rst @@ -41,6 +41,8 @@ Documentation (:issue:`1724`, :pull:`1838`) * Update definition of snow events parameter for :py:func:`pvlib.snow.loss_townsend`. (:issue:`1839`, :pull:`1840`) +* Added gallery example demonstrating how results of :py:func:`pvlib.iotools.get_pvgis_horizon`, + can be processed into time series dni and global poa data. Requirements ~~~~~~~~~~~~ @@ -54,3 +56,4 @@ Contributors * NativeSci (:ghuser:`nativesci`) * Lukas Grossar (:ghuser:`tongpu`) * Areeba Turabi (:ghuser:`aturabi`) +* Saurabh Aneja (:ghuser:`spaneja`) From 1497f61b5cec66fe31afcb8dd1cf812cfe637e0e Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Thu, 7 Sep 2023 17:19:53 -0400 Subject: [PATCH 02/18] name_update --- ...orizon_data.py => plot_far_shading_with_pvgis_horizon_data.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/examples/shading/{far_shading_with_pvgis_horizon_data.py => plot_far_shading_with_pvgis_horizon_data.py} (100%) diff --git a/docs/examples/shading/far_shading_with_pvgis_horizon_data.py b/docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py similarity index 100% rename from docs/examples/shading/far_shading_with_pvgis_horizon_data.py rename to docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py From f5eaa3c9b197c740f8a38853a3f726b285d9d5d4 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Fri, 8 Sep 2023 12:19:48 -0400 Subject: [PATCH 03/18] updates_1 --- ...lot_far_shading_with_pvgis_horizon_data.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py b/docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py index 86dd424e5a..0f15072583 100644 --- a/docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py +++ b/docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py @@ -1,6 +1,6 @@ """ Far-Shading with PVGIS Horizon Data -========================= +=================================== Example of getting PVGIS horizon data, interpolating it to time-series solar-position data, and adjusting DNI and POA-global irradiance. @@ -9,7 +9,7 @@ # %% # This example shows how to use retrived horizon elevation angles with # corresponding horizon azimuth angles from the -# :py:meth:`pvlib.iotools.get_pvgis_horizon` furntion. +# :py:func:`pvlib.iotools.get_pvgis_horizon` function. # After location information and a date range is established, solar position # data is queried from :py:meth:`pvlib.solar_position.get_solar_position`. @@ -29,7 +29,8 @@ # Set times in the morning of the December solstice. times = pd.date_range( - '2020-12-20 6:30', '2020-12-20 9:00', freq='1T', tz=tz, inclusive='left') + '2020-12-20 6:30', '2020-12-20 9:00', freq='1T', tz=tz +) # Create location object, and get solar position and clearsky irradiance data. location = Location(lat, lon, tz) @@ -37,8 +38,7 @@ clearsky = location.get_clearsky(times) # Get horizon file meta-data and data. -horizon_file = get_pvgis_horizon(lat, lon) -horizon_data = horizon_file[0] +horizon_data, horizon_metadata = get_pvgis_horizon(lat, lon) # Set variable names for easier reading. surface_tilt = 30 @@ -53,7 +53,8 @@ # Interpolate the horizon elevation data to the solar azimuth, and keep as a # numpy array. horizon_elevation_data = np.interp( - solar_azimuth, horizon_data.index, horizon_data) + solar_azimuth, horizon_data.index, horizon_data +) # Convert to Pandas Series for easier usage. horizon_elevation_data = pd.Series(horizon_elevation_data, times) @@ -71,11 +72,13 @@ # Transposition using the original and adjusted irradiance components. irrad_pre_adj = get_total_irradiance( - surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni, ghi, dhi) + surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni, ghi, dhi +) irrad_post_adj = get_total_irradiance( surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni_adjusted, - ghi_adjusted, dhi) + ghi_adjusted, dhi +) # Create and plot result DataFrames. poa_global_comparison = pd.DataFrame({ @@ -91,6 +94,8 @@ # Plot results poa_global_comparison.plot( title='POA-Global: Before and after Horizon Adjustment', - ylabel='Irradiance') + ylabel='Irradiance' +) dni_comparison.plot( - title='DNI: Before and after Horizon Adjustment', ylabel='Irradiance') + title='DNI: Before and after Horizon Adjustment', ylabel='Irradiance' +) From b767cd23bc8a576a9b5e607936ba64a75c246496 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 12 Sep 2023 12:14:38 -0400 Subject: [PATCH 04/18] Update 2 Adjusted to the broader 'simple irradiance...shading' rebrand, use hard-coded horizon profile data, and give example of how to get such data from PVGIS function in IO Tools. --- ...adiance_adjustment_for_horizon_shading.py} | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) rename docs/examples/shading/{plot_far_shading_with_pvgis_horizon_data.py => plot_simple_irradiance_adjustment_for_horizon_shading.py} (68%) diff --git a/docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py similarity index 68% rename from docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py rename to docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 0f15072583..38f3ff1058 100644 --- a/docs/examples/shading/plot_far_shading_with_pvgis_horizon_data.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -1,25 +1,24 @@ """ -Far-Shading with PVGIS Horizon Data -=================================== +Simple Irradiance Adjustment For Horizon Shading +================================================ -Example of getting PVGIS horizon data, interpolating it to time-series -solar-position data, and adjusting DNI and POA-global irradiance. +Example for adjusting dni and global poa from horizon shading. Using +hard-coded horizon profile data, this example interpolates it to time-series +solar-position data, and adjust DNI and POA-global irradiance. """ # %% -# This example shows how to use retrived horizon elevation angles with -# corresponding horizon azimuth angles from the -# :py:func:`pvlib.iotools.get_pvgis_horizon` function. +# This example shows how to use horizon elevation angles with +# corresponding horizon azimuth angles for simple horizon shading adjustments. # After location information and a date range is established, solar position # data is queried from :py:meth:`pvlib.solar_position.get_solar_position`. -# Horizon data is then retreived, and interpolated to the solar azimuth time +# Horizon data is assigned, and interpolated to the solar azimuth time # series data. Finally, in times when solar elevation is greater than the # interpolated horizon elevation angle, DNI is set to 0. import numpy as np import pandas as pd -from pvlib.iotools import get_pvgis_horizon from pvlib.location import Location from pvlib.irradiance import get_total_irradiance @@ -37,10 +36,7 @@ solar_position = location.get_solarposition(times) clearsky = location.get_clearsky(times) -# Get horizon file meta-data and data. -horizon_data, horizon_metadata = get_pvgis_horizon(lat, lon) - -# Set variable names for easier reading. +# Assign variable names for easier reading. surface_tilt = 30 surface_azimuth = 180 solar_azimuth = solar_position.azimuth @@ -50,10 +46,21 @@ ghi = clearsky.ghi dhi = clearsky.dhi +# Use hard-coded horizon profile data from location object above. +horizon_profile = pd.Series([ + 10.7, 11.8, 11.5, 10.3, 8.0, 6.5, 3.8, 2.3, 2.3, 2.3, 4.6, 8.0, 10.3, 11.1, + 10.7, 10.3, 9.2, 6.1, 5.3, 2.3, 3.1, 1.9, 1.9, 2.7, 3.8, 5.3, 6.5, 8.4, + 8.8, 8.4, 8.4, 8.4, 6.5, 6.1, 6.5, 6.1, 7.3, 9.2, 8.4, 8.0, 5.7, 5.3, 5.3, + 4.2, 4.2, 4.2, 7.3, 9.5 +], index=np.arange(0, 360, 7.5)) + +# Ex - To get the above horizon data from PVGIS (assuming pvlib is imported): +# horizon_profile, horizon_metadata = pvlib.iotools.get_pvgis_horizon(lat, lon) + # Interpolate the horizon elevation data to the solar azimuth, and keep as a # numpy array. horizon_elevation_data = np.interp( - solar_azimuth, horizon_data.index, horizon_data + solar_azimuth, horizon_profile.index, horizon_profile ) # Convert to Pandas Series for easier usage. From e6fb21ede79467f78023a1ec6c27420a52afbe9e Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:46:43 -0400 Subject: [PATCH 05/18] update 3 Updated whatsnew file with pull #. Updated formatting and other minor syntax in .py file. --- ...ple_irradiance_adjustment_for_horizon_shading.py | 13 ++++++------- docs/sphinx/source/whatsnew/v0.10.2.rst | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 38f3ff1058..73fba4ec25 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -10,7 +10,7 @@ # %% # This example shows how to use horizon elevation angles with # corresponding horizon azimuth angles for simple horizon shading adjustments. - +# # After location information and a date range is established, solar position # data is queried from :py:meth:`pvlib.solar_position.get_solar_position`. # Horizon data is assigned, and interpolated to the solar azimuth time @@ -46,6 +46,9 @@ ghi = clearsky.ghi dhi = clearsky.dhi +# %% +# With basic inputs in place, let's perform the adjustment for horizon shading: + # Use hard-coded horizon profile data from location object above. horizon_profile = pd.Series([ 10.7, 11.8, 11.5, 10.3, 8.0, 6.5, 3.8, 2.3, 2.3, 2.3, 4.6, 8.0, 10.3, 11.1, @@ -67,15 +70,11 @@ horizon_elevation_data = pd.Series(horizon_elevation_data, times) # Adjust DNI based on data - note this is returned as numpy array -dni_adjusted = np.where( - solar_elevation > horizon_elevation_data, dni, 0 -) +dni_adjusted = np.where(solar_elevation > horizon_elevation_data, dni, 0) # Adjust GHI and set it to DHI for time-periods where 'dni_adjusted' is 0. # Note this is returned as numpy array -ghi_adjusted = np.where( - dni_adjusted == 0, dhi, ghi -) +ghi_adjusted = np.where(dni_adjusted == 0, dhi, ghi) # Transposition using the original and adjusted irradiance components. irrad_pre_adj = get_total_irradiance( diff --git a/docs/sphinx/source/whatsnew/v0.10.2.rst b/docs/sphinx/source/whatsnew/v0.10.2.rst index eb3aaa4891..36aecfb485 100644 --- a/docs/sphinx/source/whatsnew/v0.10.2.rst +++ b/docs/sphinx/source/whatsnew/v0.10.2.rst @@ -44,7 +44,7 @@ Documentation * Update definition of snow events parameter for :py:func:`pvlib.snow.loss_townsend`. (:issue:`1839`, :pull:`1840`) * Added gallery example demonstrating how results of :py:func:`pvlib.iotools.get_pvgis_horizon`, - can be processed into time series dni and global poa data. + can be processed into time series dni and global poa data. (:pull:`1849`) Requirements ~~~~~~~~~~~~ From 8ae6c7e57ff521d459b1d414f31c4e47bb10ec6e Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:37:45 -0400 Subject: [PATCH 06/18] Update docs/sphinx/source/whatsnew/v0.10.2.rst Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- docs/sphinx/source/whatsnew/v0.10.2.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.10.2.rst b/docs/sphinx/source/whatsnew/v0.10.2.rst index 1600202b5b..33a77ad812 100644 --- a/docs/sphinx/source/whatsnew/v0.10.2.rst +++ b/docs/sphinx/source/whatsnew/v0.10.2.rst @@ -56,8 +56,8 @@ Documentation (:issue:`1724`, :pull:`1838`) * Update definition of snow events parameter for :py:func:`pvlib.snow.loss_townsend`. (:issue:`1839`, :pull:`1840`) -* Added gallery example demonstrating how results of :py:func:`pvlib.iotools.get_pvgis_horizon`, - can be processed into time series dni and global poa data. (:pull:`1849`) +* Added gallery example demonstrating how horizon profile data from :py:func:`pvlib.iotools.get_pvgis_horizon`, + can be used to apply horizon shading to time series dni and global poa data. (:pull:`1849`) Requirements ~~~~~~~~~~~~ From 64f1fe75710beec3dd4969373ecfe08dfe6d6f66 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:38:02 -0400 Subject: [PATCH 07/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 73fba4ec25..2b6789e98c 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -2,8 +2,8 @@ Simple Irradiance Adjustment For Horizon Shading ================================================ -Example for adjusting dni and global poa from horizon shading. Using -hard-coded horizon profile data, this example interpolates it to time-series +Example of applying horizon shading to dni and global poa. Using +horizon profile data, this example interpolates it to time-series solar-position data, and adjust DNI and POA-global irradiance. """ From 8f2bcb0b4e90940fd028968d5eff0f02a7412eb3 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:38:15 -0400 Subject: [PATCH 08/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 2b6789e98c..0609a89078 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -1,5 +1,5 @@ """ -Simple Irradiance Adjustment For Horizon Shading +Simple irradiance adjustment for horizon shading ================================================ Example of applying horizon shading to dni and global poa. Using From 7eb590b77a9edd20d7d9dd20ad456307c570e7de Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:38:21 -0400 Subject: [PATCH 09/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 0609a89078..89cb39a43f 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -12,7 +12,7 @@ # corresponding horizon azimuth angles for simple horizon shading adjustments. # # After location information and a date range is established, solar position -# data is queried from :py:meth:`pvlib.solar_position.get_solar_position`. +# data is calculated using :py:meth:`pvlib.solar_position.get_solar_position`. # Horizon data is assigned, and interpolated to the solar azimuth time # series data. Finally, in times when solar elevation is greater than the # interpolated horizon elevation angle, DNI is set to 0. From 48313a0e6229ef149289cc450590b77965aee66b Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:38:49 -0400 Subject: [PATCH 10/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 89cb39a43f..bd0b65dce2 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -104,4 +104,4 @@ ) dni_comparison.plot( title='DNI: Before and after Horizon Adjustment', ylabel='Irradiance' -) +); From a32abe103705fcabed82e285ef68fe6902266bd5 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:39:14 -0400 Subject: [PATCH 11/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index bd0b65dce2..56596cf7e8 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -77,11 +77,11 @@ ghi_adjusted = np.where(dni_adjusted == 0, dhi, ghi) # Transposition using the original and adjusted irradiance components. -irrad_pre_adj = get_total_irradiance( +irrad_pre_adj = pvlib.irradiance.get_total_irradiance( surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni, ghi, dhi ) -irrad_post_adj = get_total_irradiance( +irrad_post_adj = pvlib.irradiance.get_total_irradiance( surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni_adjusted, ghi_adjusted, dhi ) From 73ef12f96f163da094e50be8a9c6a01e7acf5204 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:39:29 -0400 Subject: [PATCH 12/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 56596cf7e8..8ee14595a5 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -32,7 +32,7 @@ ) # Create location object, and get solar position and clearsky irradiance data. -location = Location(lat, lon, tz) +location = pvlib.location.Location(lat, lon, tz) solar_position = location.get_solarposition(times) clearsky = location.get_clearsky(times) From c123c288e66d08c8bbcdab08dd9dfd8e63a8868a Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:39:38 -0400 Subject: [PATCH 13/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 8ee14595a5..4efd47926f 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -19,8 +19,7 @@ import numpy as np import pandas as pd -from pvlib.location import Location -from pvlib.irradiance import get_total_irradiance +import pvlib # Golden, CO lat, lon = 39.76, -105.22 From ed8a78f88220e8bd8859d3219a3a50167a7f75ad Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:39:51 -0400 Subject: [PATCH 14/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- ...e_irradiance_adjustment_for_horizon_shading.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 4efd47926f..c8299c7335 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -56,8 +56,19 @@ 4.2, 4.2, 4.2, 7.3, 9.5 ], index=np.arange(0, 360, 7.5)) -# Ex - To get the above horizon data from PVGIS (assuming pvlib is imported): -# horizon_profile, horizon_metadata = pvlib.iotools.get_pvgis_horizon(lat, lon) +ax = horizon_profile.plot(xlim=(0, 360), ylim=(0, None)) +ax.set_title('Horizon profile') +ax.set_xticks([0, 90, 180, 270, 360]) +ax.set_xlabel('Azimuth [°]') +ax.set_ylabel('Horizon angle [°]'); + +# %% +# .. admonition:: Horizon data from PVGIS +# +# Example of how to get the above horizon data from PVGIS +# +# horizon_profile, horizon_metadata = pvlib.iotools.get_pvgis_horizon(latitutde, longitude) +# # Interpolate the horizon elevation data to the solar azimuth, and keep as a # numpy array. From 3dae6a967de99137808dcac6fec05729b9f6d565 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:17:13 -0400 Subject: [PATCH 15/18] flake8 updates --- ...t_simple_irradiance_adjustment_for_horizon_shading.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index c8299c7335..d6aec6f3ae 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -12,7 +12,7 @@ # corresponding horizon azimuth angles for simple horizon shading adjustments. # # After location information and a date range is established, solar position -# data is calculated using :py:meth:`pvlib.solar_position.get_solar_position`. +# data is calculated using :py:func:`pvlib.solar_position.get_solar_position`. # Horizon data is assigned, and interpolated to the solar azimuth time # series data. Finally, in times when solar elevation is greater than the # interpolated horizon elevation angle, DNI is set to 0. @@ -60,14 +60,15 @@ ax.set_title('Horizon profile') ax.set_xticks([0, 90, 180, 270, 360]) ax.set_xlabel('Azimuth [°]') -ax.set_ylabel('Horizon angle [°]'); +ax.set_ylabel('Horizon angle [°]') # %% # .. admonition:: Horizon data from PVGIS # # Example of how to get the above horizon data from PVGIS # -# horizon_profile, horizon_metadata = pvlib.iotools.get_pvgis_horizon(latitutde, longitude) +# horizon_profile, horizon_metadata = pvlib.iotools.get_pvgis_horizon( +# latitutde, longitude) # # Interpolate the horizon elevation data to the solar azimuth, and keep as a @@ -114,4 +115,4 @@ ) dni_comparison.plot( title='DNI: Before and after Horizon Adjustment', ylabel='Irradiance' -); +) From fbf3121ce924f012ff73fbacb5377b07dbb3415b Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:20:43 -0400 Subject: [PATCH 16/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index d6aec6f3ae..d5f866b81d 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -56,7 +56,7 @@ 4.2, 4.2, 4.2, 7.3, 9.5 ], index=np.arange(0, 360, 7.5)) -ax = horizon_profile.plot(xlim=(0, 360), ylim=(0, None)) +ax = horizon_profile.plot(xlim=(0, 360), ylim=(0, None), figsize=(6, 2.5)) ax.set_title('Horizon profile') ax.set_xticks([0, 90, 180, 270, 360]) ax.set_xlabel('Azimuth [°]') From 1f14b6d7727303ed513c11c8ec58aa023145b760 Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:21:11 -0400 Subject: [PATCH 17/18] Update docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index d5f866b81d..01fcb5e0ec 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -22,7 +22,7 @@ import pvlib # Golden, CO -lat, lon = 39.76, -105.22 +latitude, longitude = 39.76, -105.22 tz = 'MST' # Set times in the morning of the December solstice. @@ -31,7 +31,7 @@ ) # Create location object, and get solar position and clearsky irradiance data. -location = pvlib.location.Location(lat, lon, tz) +location = pvlib.location.Location(latitude, longitude, tz) solar_position = location.get_solarposition(times) clearsky = location.get_clearsky(times) From 62c05954e10a0e4d291a25d3253fe5799fb4a05d Mon Sep 17 00:00:00 2001 From: Saurabh Aneja <63314623+spaneja@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:31:49 -0400 Subject: [PATCH 18/18] update Corrected docstring text --- .../plot_simple_irradiance_adjustment_for_horizon_shading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py index 01fcb5e0ec..bdeb414adb 100644 --- a/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py +++ b/docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py @@ -12,7 +12,7 @@ # corresponding horizon azimuth angles for simple horizon shading adjustments. # # After location information and a date range is established, solar position -# data is calculated using :py:func:`pvlib.solar_position.get_solar_position`. +# data is calculated using :py:func:`pvlib.solarposition.get_solarposition`. # Horizon data is assigned, and interpolated to the solar azimuth time # series data. Finally, in times when solar elevation is greater than the # interpolated horizon elevation angle, DNI is set to 0.