PROJ_SOLAR_ZENITH
This function projects the solar zenith angle onto a plane defined by an axis tilt and azimuth.
This projection is critical for modeling single-axis trackers and for simplifying 3D shading problems into a 2D plane perpendicular to the collector rows.
Excel Usage
=PROJ_SOLAR_ZENITH(solar_zenith, solar_azimuth, axis_tilt, axis_azimuth)
solar_zenith(list[list], required): Sun’s apparent zenith angle (degrees).solar_azimuth(list[list], required): Sun’s azimuth angle (degrees).axis_tilt(float, optional, default: 0): Tilt angle of the reference axis (degrees).axis_azimuth(float, optional, default: 0): Azimuth angle of the reference axis (degrees).
Returns (list[list]): 2D list of projected solar zenith angles (degrees), or an error string.
Example 1: Projection on a north-south axis at noon
Inputs:
| solar_zenith | solar_azimuth | axis_tilt | axis_azimuth |
|---|---|---|---|
| 30 | 180 | 0 | 180 |
Excel formula:
=PROJ_SOLAR_ZENITH({30}, {180}, 0, 180)
Expected output:
0
Example 2: Projection on east-west axis
Inputs:
| solar_zenith | solar_azimuth | axis_tilt | axis_azimuth |
|---|---|---|---|
| 30 | 180 | 0 | 90 |
Excel formula:
=PROJ_SOLAR_ZENITH({30}, {180}, 0, 90)
Expected output:
30
Example 3: Projection with tilted axis
Inputs:
| solar_zenith | solar_azimuth | axis_tilt | axis_azimuth |
|---|---|---|---|
| 50 | 200 | 10 | 180 |
Excel formula:
=PROJ_SOLAR_ZENITH({50}, {200}, 10, 180)
Expected output:
19.0672
Example 4: Vectorized projected zenith angles
Inputs:
| solar_zenith | solar_azimuth | axis_tilt | axis_azimuth | ||||
|---|---|---|---|---|---|---|---|
| 20 | 40 | 60 | 120 | 180 | 240 | 0 | 180 |
Excel formula:
=PROJ_SOLAR_ZENITH({20,40,60}, {120,180,240}, 0, 180)
Expected output:
| Result |
|---|
| -17.4952 |
| 0 |
| 56.3099 |
Python Code
Show Code
import pandas as pd
import numpy as np
from pvlib.shading import projected_solar_zenith_angle as result_func
def proj_solar_zenith(solar_zenith, solar_azimuth, axis_tilt=0, axis_azimuth=0):
"""
Calculate the projected solar zenith angle in the tracker reference plane.
See: https://pvlib-python.readthedocs.io/en/stable/reference/generated/pvlib.shading.projected_solar_zenith_angle.html
This example function is provided as-is without any representation of accuracy.
Args:
solar_zenith (list[list]): Sun's apparent zenith angle (degrees).
solar_azimuth (list[list]): Sun's azimuth angle (degrees).
axis_tilt (float, optional): Tilt angle of the reference axis (degrees). Default is 0.
axis_azimuth (float, optional): Azimuth angle of the reference axis (degrees). Default is 0.
Returns:
list[list]: 2D list of projected solar zenith angles (degrees), or an error string.
"""
try:
def flatten_num(data):
if not isinstance(data, list): return [float(data)]
flat = []
for row in data:
row = row if isinstance(row, list) else [row]
for val in row:
if val == "": flat.append(float('nan'))
else: flat.append(float(val))
return flat
z_list = flatten_num(solar_zenith)
az_list = flatten_num(solar_azimuth)
n = len(z_list)
if n == 0 or len(az_list) != n:
return "Error: solar_zenith and solar_azimuth arrays must have the same non-zero length"
at = float(axis_tilt) if axis_tilt is not None else 0.0
aa = float(axis_azimuth) if axis_azimuth is not None else 0.0
res = result_func(
solar_zenith=np.array(z_list),
solar_azimuth=np.array(az_list),
axis_tilt=at,
axis_azimuth=aa
)
return [[float(v) if not pd.isna(v) else ""] for v in res]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Sun's apparent zenith angle (degrees).
Sun's azimuth angle (degrees).
Tilt angle of the reference axis (degrees).
Azimuth angle of the reference axis (degrees).