Skip to content

Rename solar position inputs in tracking.singleaxis #2480

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 @@ -59,7 +59,7 @@

tracking_orientations = pvlib.tracking.singleaxis(
apparent_zenith=solpos['apparent_zenith'],
apparent_azimuth=solpos['azimuth'],
solar_azimuth=solpos['azimuth'],
axis_azimuth=axis_azimuth,
max_angle=max_angle,
backtrack=True,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/shading/plot_martinez_shade_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

tracking_result = pvlib.tracking.singleaxis(
apparent_zenith=solar_apparent_zenith,
apparent_azimuth=solar_azimuth,
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
6 changes: 3 additions & 3 deletions docs/examples/solar-tracking/plot_single_axis_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

truetracking_angles = tracking.singleaxis(
apparent_zenith=solpos['apparent_zenith'],
apparent_azimuth=solpos['azimuth'],
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'],
apparent=solpos['apparent_zenith'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
apparent=solpos['apparent_zenith'],
apparent_zenith=solpos['apparent_zenith'],

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'],
apparent=solpos['apparent_zenith'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
apparent=solpos['apparent_zenith'],
apparent_zenith=solpos['apparent_zenith'],

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'],
apparent=solpos['apparent_zenith'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
apparent=solpos['apparent_zenith'],
apparent_zenith=solpos['apparent_zenith'],

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
3 changes: 2 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,8 @@ Breaking Changes

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

* Rename parameter name ``aparent_azimuth`` to ``solar_azimuth`` in :py:func:`~pvlib.tracking.singleaxis`.
(:issue:`2479`, :pull:`2480`)

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


def singleaxis(apparent_zenith, apparent_azimuth,
@renamed_kwarg_warning(
since='0.13.1',
old_param_name='apparent_azimuth',
new_param_name='solar_azimuth')
def singleaxis(apparent_zenith, solar_azimuth,
axis_tilt=0, axis_azimuth=0, max_angle=90,
backtrack=True, gcr=2.0/7.0, cross_axis_tilt=0):
"""
Expand All @@ -33,7 +38,7 @@ def singleaxis(apparent_zenith, apparent_azimuth,
apparent_zenith : float, 1d array, or Series
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 @@ -123,10 +128,10 @@ def singleaxis(apparent_zenith, apparent_azimuth,
index = None

# convert scalars to arrays
apparent_azimuth = np.atleast_1d(apparent_azimuth)
solar_azimuth = np.atleast_1d(solar_azimuth)
apparent_zenith = np.atleast_1d(apparent_zenith)

if apparent_azimuth.ndim > 1 or apparent_zenith.ndim > 1:
if solar_azimuth.ndim > 1 or apparent_zenith.ndim > 1:
raise ValueError('Input dimensions must not exceed 1')

# The ideal tracking angle, omega_ideal, is the rotation to place the sun
Expand All @@ -142,7 +147,7 @@ def singleaxis(apparent_zenith, apparent_azimuth,
axis_tilt=axis_tilt,
axis_azimuth=axis_azimuth,
solar_zenith=apparent_zenith,
solar_azimuth=apparent_azimuth,
solar_azimuth=solar_azimuth,
)

# filter for sun above panel horizon
Expand Down Expand Up @@ -191,7 +196,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)
apparent_zenith, solar_azimuth)

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