Skip to content

Commit 85c581c

Browse files
committed
Clear things, convert Mark's reference to a reference
1 parent 0730693 commit 85c581c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

pvlib/shading.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ def tracker_shaded_fraction(solar_zenith, solar_azimuth, tracker_tilt,
367367
368368
References
369369
----------
370-
Mark A. Mikofski, "First Solar Irradiance Shade Losses on Sloped Terrain,"
371-
PVPMC, 2023
370+
.. [1] Mark A. Mikofski, "First Solar Irradiance Shade Losses on Sloped
371+
Terrain," PVPMC, 2023
372372
"""
373373
theta_g_rad = np.radians(cross_axis_slope)
374374
# projected solar zenith:

pvlib/tests/test_shading.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,11 @@ def test_projected_solar_zenith_angle_datatypes(
228228
@pytest.fixture
229229
def sf_premises_and_expected():
230230
"""Data comprised of solar position, tracker orientations, ground coverage
231-
ratios and terrain slopes with respective shade fractions (sf)"""
232-
# preserve tracker_shade_fraction's args order and append shadow depth, z
231+
ratios and terrain slopes with respective shade fractions (sf).
232+
Returns a 2-tuple with the premises to be used directly in
233+
tracker_shade_fraction(...) in the first element and the expected shaded
234+
fractions on the second element"""
235+
# tracker_shade_fraction's args order and append shadow depth, z
233236
premises_and_results = pd.DataFrame(
234237
columns=["solar_zenith", "solar_azimuth", "tracker_tilt",
235238
"tracker_azimuth", "gcr", "cross_axis_slope", "z"],
@@ -245,14 +248,14 @@ def sf_premises_and_expected():
245248
))
246249
# append shaded fraction
247250
premises_and_results["shaded_fraction"] = 1 - 1/premises_and_results["z"]
248-
return premises_and_results
251+
return (premises_and_results.drop(columns=["z", "shaded_fraction"]),
252+
premises_and_results["shaded_fraction"])
249253

250254

251255
def test_tracker_shade_fraction(sf_premises_and_expected):
252256
"""Tests tracker_shade_fraction"""
253257
# unwrap sf_premises_and_expected values premises and expected results
254-
premises = sf_premises_and_expected.drop(columns=["z", "shaded_fraction"])
255-
expected_sf_array = sf_premises_and_expected["shaded_fraction"]
258+
premises, expected_sf_array = sf_premises_and_expected
256259
# test scalar inputs from the row iterator
257260
# series label := corresponding index in expected_sf_array
258261
for index, premise in premises.iterrows():
@@ -266,7 +269,7 @@ def test_tracker_shade_fraction(sf_premises_and_expected):
266269

267270

268271
def test_linear_shade_loss(sf_premises_and_expected):
269-
expected_sf_array = sf_premises_and_expected["shaded_fraction"]
272+
_, expected_sf_array = sf_premises_and_expected # Premises are not needed
270273
loss = shading.linear_shade_loss(expected_sf_array[0], 0.2)
271274
assert_allclose(loss, 0.09289321881345258)
272275
# if no diffuse, shade fraction is the loss

0 commit comments

Comments
 (0)