8000 Add gallery example for simple irradiance adjustment for horizon shading by spaneja · Pull Request #1849 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Add gallery example for simple irradiance adjustment for horizon shading #1849

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 20 commits into from
Sep 19, 2023
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1eadff4
pvgis gallery example
spaneja Sep 7, 2023
cd64985
Merge branch 'pvlib:main' into pvgis_far_shading_example
spaneja Sep 7, 2023
1497f61
name_update
spaneja Sep 7, 2023
f5eaa3c
updates_1
spaneja Sep 8, 2023
b767cd2
Update 2
spaneja Sep 12, 2023
e6fb21e
update 3
spaneja Sep 12, 2023
ccce3eb
Merge branch 'main' into pvgis_far_shading_example
spaneja Sep 13, 2023
8ae6c7e
Update docs/sphinx/source/whatsnew/v0.10.2.rst
spaneja Sep 19, 2023
64f1fe7
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
8f2bcb0
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
7eb590b
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
48313a0
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
a32abe1
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
73ef12f
Update docs/examples/shading/plot_simple_irradia 8000 nce_adjustment_for_ho…
spaneja Sep 19, 2023
c123c28
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
ed8a78f
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
3dae6a9
flake8 updates
spaneja Sep 19, 2023
fbf3121
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
1f14b6d
Update docs/examples/shading/plot_simple_irradiance_adjustment_for_ho…
spaneja Sep 19, 2023
62c0595
update
spaneja Sep 19, 2023
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
Prev Previous commit
Next Next commit
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.
  • Loading branch information
spaneja committed Sep 12, 2023
commit b767cd23bc8a576a9b5e607936ba64a75c246496
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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.
Expand Down
0