Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
# of the trackers. For a single-axis tracker, this can be calculated as:

tracking_orientations = pvlib.tracking.singleaxis(
apparent_zenith=solpos['apparent_zenith'],
apparent_azimuth=solpos['azimuth'],
solar_zenith=solpos['apparent_zenith'],
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
solar_azimuth=solpos['azimuth'],
axis_azimuth=axis_azimuth,
max_angle=max_angle,
backtrack=True,
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/shading/plot_martinez_shade_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
) # unpack for better readability

tracking_result = pvlib.tracking.singleaxis(
apparent_zenith=solar_apparent_zenith,
apparent_azimuth=solar_azimuth,
solar_zenith=solar_apparent_zenith,
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
solar_azimuth=solar_azimuth,
axis_tilt=axis_tilt,
axis_azimuth=axis_azimuth,
max_angle=(-90 + cross_axis_tilt, 90 + cross_axis_tilt), # (min, max)
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/solar-tracking/plot_single_axis_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
solpos = solarposition.get_solarposition(times, lat, lon)

truetracking_angles = tracking.singleaxis(
apparent_zenith=solpos['apparent_zenith'],
apparent_azimuth=solpos['azimuth'],
solar_zenith=solpos['apparent_zenith'],
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
solar_azimuth=solpos['azimuth'],
axis_tilt=0,
axis_azimuth=180,
max_angle=90,
Expand All @@ -60,8 +60,8 @@

for gcr in [0.2, 0.4, 0.6]:
backtracking_angles = tracking.singleaxis(
apparent_zenith=solpos['apparent_zenith'],
apparent_azimuth=solpos['azimuth'],
solar_zenith=solpos['apparent_zenith'],
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
solar_azimuth=solpos['azimuth'],
axis_tilt=0,
axis_azimuth=180,
max_angle=90,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
fig, ax = plt.subplots()
for cross_axis_tilt in [0, 5, 10]:
tracker_data = tracking.singleaxis(
apparent_zenith=solpos['apparent_zenith'],
apparent_azimuth=solpos['azimuth'],
solar_zenith=solpos['apparent_zenith'],
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
solar_azimuth=solpos['azimuth'],
axis_tilt=0, # flat because the axis is perpendicular to the slope
axis_azimuth=180, # N-S axis, azimuth facing south
max_angle=90,
Expand Down Expand Up @@ -155,8 +155,8 @@
# before:

tracker_data = tracking.singleaxis(
apparent_zenith=solpos['apparent_zenith'],
apparent_azimuth=solpos['azimuth'],
solar_zenith=solpos['apparent_zenith'],
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
solar_azimuth=solpos['azimuth'],
axis_tilt=axis_tilt, # no longer flat because the terrain imparts a tilt
axis_azimuth=axis_azimuth,
max_angle=90,
Expand Down
4 changes: 3 additions & 1 deletion docs/sphinx/source/whatsnew/v0.13.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Breaking Changes

Deprecations
~~~~~~~~~~~~

* Rename parameter name ``aparent_zenith`` to ``solar_zenith`` and ``aparent_azimuth``
to ``solar_azimuth`` in :py:func:`~pvlib.tracking.singleaxis`.
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
(:issue:`2479`, :pull:`2480`)

Bug fixes
~~~~~~~~~
Expand Down
37 changes: 23 additions & 14 deletions pvlib/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
from pvlib.tools import cosd, sind, tand, acosd, asind
from pvlib import irradiance
from pvlib import shading


def singleaxis(apparent_zenith, apparent_azimuth,
from pvlib._deprecation import renamed_kwarg_warning


@renamed_kwarg_warning(
since='0.13.1',
old_param_name='apparent_zenith',
new_param_name='solar_zenith')
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
@renamed_kwarg_warning(
since='0.13.1',
old_param_name='apparent_azimuth',
new_param_name='solar_azimuth')
def singleaxis(solar_zenith, solar_azimuth,
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
axis_tilt=0, axis_azimuth=0, max_angle=90,
backtrack=True, gcr=2.0/7.0, cross_axis_tilt=0):
"""
Expand All @@ -30,10 +39,10 @@ def singleaxis(apparent_zenith, apparent_azimuth,

Parameters
----------
apparent_zenith : float, 1d array, or Series
solar_zenith : float, 1d array, or Series
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
Solar apparent zenith angles in decimal degrees.

apparent_azimuth : float, 1d array, or Series
solar_azimuth : float, 1d array, or Series
Solar apparent azimuth angles in decimal degrees.

axis_tilt : float, default 0
Expand Down Expand Up @@ -117,16 +126,16 @@ def singleaxis(apparent_zenith, apparent_azimuth,
# MATLAB to Python conversion by
# Will Holmgren (@wholmgren), U. Arizona. March, 2015.

if isinstance(apparent_zenith, pd.Series):
index = apparent_zenith.index
if isinstance(solar_zenith, pd.Series):
index = solar_zenith.index
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
else:
index = None

# convert scalars to arrays
apparent_azimuth = np.atleast_1d(apparent_azimuth)
apparent_zenith = np.atleast_1d(apparent_zenith)
solar_azimuth = np.atleast_1d(solar_azimuth)
solar_zenith = np.atleast_1d(solar_zenith)
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated

if apparent_azimuth.ndim > 1 or apparent_zenith.ndim > 1:
if solar_azimuth.ndim > 1 or solar_zenith.ndim > 1:
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
raise ValueError('Input dimensions must not exceed 1')

# The ideal tracking angle, omega_ideal, is the rotation to place the sun
Expand All @@ -141,12 +150,12 @@ def singleaxis(apparent_zenith, apparent_azimuth,
omega_ideal = shading.projected_solar_zenith_angle(
axis_tilt=axis_tilt,
axis_azimuth=axis_azimuth,
solar_zenith=apparent_zenith,
solar_azimuth=apparent_azimuth,
solar_zenith=solar_zenith,
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
solar_azimuth=solar_azimuth,
)

# filter for sun above panel horizon
zen_gt_90 = apparent_zenith > 90
zen_gt_90 = solar_zenith > 90
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated
omega_ideal[zen_gt_90] = np.nan

# Account for backtracking
Expand Down Expand Up @@ -191,7 +200,7 @@ def singleaxis(apparent_zenith, apparent_azimuth,
surface_tilt = surface['surface_tilt']
surface_azimuth = surface['surface_azimuth']
aoi = irradiance.aoi(surface_tilt, surface_azimuth,
apparent_zenith, apparent_azimuth)
solar_zenith, solar_azimuth)
Comment thread
AdamRJensen marked this conversation as resolved.
Outdated

# Bundle DataFrame for return values and filter for sun below horizon.
out = {'tracker_theta': tracker_theta, 'aoi': aoi,
Expand Down
Loading