Skip to content

Commit ba2f2e3

Browse files
authored
Merge branch 'main' into add-examples-poa-irrad
2 parents 20a1b9b + c14dd73 commit ba2f2e3

File tree

4 files changed

+91
-50
lines changed

4 files changed

+91
-50
lines changed

docs/sphinx/source/user_guide/extras/nomenclature.rst

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ There is a convention on consistent variable names throughout the library:
1919
albedo
2020
Ratio of reflected solar irradiance to global horizontal irradiance
2121
[unitless]
22-
22+
23+
aod
24+
aod500
25+
aerosol optical depth [unitless]. Measure of aerosols (e.g., smoke
26+
particles, desert dust) distributed within a column of air from the
27+
instrument (Earth's surface) to the top of the atmosphere. The AOD
28+
value indicates the level of extinction of sunlight in this column, and
29+
when followed by a number (e.g. AOD500), indicates the extinction at
30+
this wavelength (500nm).
31+
2332
aoi
2433
Angle of incidence. Angle between the surface normal vector and the
2534
vector pointing towards the sun's center. [°]
@@ -33,17 +42,26 @@ There is a convention on consistent variable names throughout the library:
3342

3443
apparent_zenith
3544
Refraction-corrected solar zenith angle. The solar
36-
zenith angle describes the position of the sun relative to the vertical and is
37-
defined as the angle between a vector pointed straight up and a vector pointed
38-
at the sun, from the observer. [°]
45+
zenith angle describes the position of the sun relative to the vertical
46+
and is defined as the angle between a vector pointed straight up and a
47+
vector pointed at the sun, from the observer. [°]
3948

4049
apparent_elevation
4150
Refraction-corrected solar elevation angle. This is the complement of
4251
:term:`apparent_zenith` (90 - apparent_zenith). [°]
4352

4453
bhi
4554
Beam/direct horizontal irradiance
46-
55+
56+
clearness_index
57+
clearness index [unitless]. Ratio of global horizontal irraidance to
58+
the extra terrestrial irriance. The clearness index ranges between
59+
0 and 1, with values closer to 1 indicating clear skies.
60+
61+
clearsky_index
62+
clearsky index [unitless]. Ratio of actual global irradiance to modeled
63+
clearsky global irradiance.
64+
4765
dhi
4866
Diffuse horizontal irradiance
4967

@@ -95,10 +113,12 @@ There is a convention on consistent variable names throughout the library:
95113
Sandia Array Performance Model IV curve parameters
96114

97115
latitude
98-
Latitude in decimal degrees. Positive north of equator, negative to south.
116+
Latitude in decimal degrees. Positive north of equator, negative to
117+
south.
99118

100119
longitude
101-
Longitude in decimal degrees. Positive east of prime meridian, negative to west.
120+
Longitude in decimal degrees. Positive east of prime meridian, negative
121+
to west.
102122

103123
pac, ac
104124
AC power
@@ -149,15 +169,16 @@ There is a convention on consistent variable names throughout the library:
149169
Diode saturation current
150170

151171
solar_azimuth
152-
Azimuth angle of the sun in degrees East of North. The solar azimuth angle
153-
describes the sun’s position along the horizon relative to the observer.
154-
The pvlib-python convention is defined as degrees East of North, so
155-
North = 0°, East = 90°, South = 180°, West = 270°.
172+
Azimuth angle of the sun in degrees East of North. The solar azimuth
173+
angle describes the sun’s position along the horizon relative to the
174+
observer. Azimuth is defined as degrees East of
175+
North, so North = 0°, East = 90°, South = 180°, West = 270°.
156176

157177
solar_zenith
158-
Zenith angle of the sun in degrees. This is the angle between is between a
159-
vector pointed straight up and a vector pointed at the sun, from the observer.
160-
This is the complement of solar elevation (90 - elevation). [°]
178+
Zenith angle of the sun in degrees [°]. Zenith is the angle between is
179+
between a vector pointed straight up and a vector pointed at the sun,
180+
from the observer. Zenith is the complement of solar elevation, i.e.,
181+
zenith = 90 - elevation.
161182

162183
spectra
163184
spectra_components
@@ -167,16 +188,17 @@ There is a convention on consistent variable names throughout the library:
167188
is composed of direct and diffuse components.
168189

169190
surface_azimuth
170-
Azimuth angle of the surface in degrees East of North. This angle describes the
171-
horizontal projection of the normal vector from the surface. The pvlib-python
172-
convention is defined as degrees East (clockwise) of North, so North = 0°,
173-
East = 90°, South = 180°, West = 270°.
191+
Azimuth angle of the surface in degrees East of North. Surface azimuth
192+
is specified by the horizontal projection of the normal vector from
193+
the surface. Azimuth is defined as degrees East
194+
(clockwise) of North, so North = 0°, East = 90°, South = 180°,
195+
West = 270°.
174196

175197
surface_tilt
176198
Tilt from horizontal [°]. The surface tilt angle
177199
is defined as degrees from the horizontal
178-
such that a surface facing up would have a surface tilt of 0°, and one facing
179-
the horizon would be 90°. [°]
200+
such that a surface facing up would have a surface tilt of 0°, and one
201+
facing the horizon would be 90°. [°]
180202

181203
temp_air
182204
Temperature of the air

docs/sphinx/source/user_guide/modeling_topics/spectrum.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@ Reference [2]_.
5151
| +-----------------------------+ | | | | | | |
5252
| |:term:`precipitable_water`, ||||||| [2]_ |
5353
| +-----------------------------+ | | | | | | |
54-
| | aod | | | | | | | |
54+
| | :term:`aod` | | | | | | | |
5555
+-----------------------------------------------------+-----------------------------+---------+---------+------+------+------+------------+-----------+
5656
| :py:func:`First Solar <spectral_factor_firstsolar>` | :term:`airmass_absolute`, | | | | | | | |
5757
| +-----------------------------+ ||| | | | [3]_ |
5858
| | :term:`precipitable_water` | | | | | | | |
5959
+-----------------------------------------------------+-----------------------------+---------+---------+------+------+------+------------+-----------+
6060
| :py:func:`JRC <spectral_factor_jrc>` | :term:`airmass_relative`, | | | | | | | |
6161
| +-----------------------------+ ||| | | + [4]_ |
62-
| | clearsky_index | | | | | | | |
62+
| | :term:`clearsky_index` | | | | | | | |
6363
+-----------------------------------------------------+-----------------------------+---------+---------+------+------+------+------------+-----------+
6464
| :py:func:`Polo <spectral_factor_polo>` | :term:`precipitable_water`, | | | | | | | |
6565
| +-----------------------------+| |||| + [5]_ |
6666
| | :term:`airmass_absolute`, | | | | | | | |
6767
| +-----------------------------+ | | | | | | |
68-
| | aod500, | | | | | | | |
68+
| | :term:`aod500` | | | | | | | |
6969
| +-----------------------------+ | | | | | | |
7070
| | :term:`aoi`, | | | | | | | |
7171
| +-----------------------------+ | | | | | | |

docs/sphinx/source/whatsnew/v0.15.1.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,22 @@ Documentation
2626
~~~~~~~~~~~~~
2727
* Add examples for run_model_from_poa() and run_model_from_effective_irradiance()
2828
(:issue:`1043`, :pull:`2621`)
29+
* Add the following terms to the :ref:`nomenclature` page
30+
(:issue:`2564`, :pull:`2663`):
31+
32+
- :term:`clearness_index`
33+
- :term:`clearsky_index`
34+
- :term:`aod`
35+
- :term:`aod500`
2936

3037
* Provide an overview of IAM modeling functionality in :ref:`iam`. (:pull:`2683`)
3138

3239

3340
Testing
3441
~~~~~~~
35-
42+
* Add test to verify that :py:func:`~pvlib.transformer.simple_efficiency`
43+
produces consistent results for vectorized and scalar inputs.
44+
(:issue:`2649`, :pull:`2661`)
3645

3746
Benchmarking
3847
~~~~~~~~~~~~

tests/test_transformer.py

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from pvlib import transformer
77

8+
import numpy as np
9+
810

911
def test_simple_efficiency():
1012

@@ -41,42 +43,50 @@ def test_simple_efficiency():
4143
assert_allclose(calculated_output_power, expected_output_power)
4244

4345

44-
def test_simple_efficiency_known_values():
45-
no_load_loss = 0.005
46-
load_loss = 0.01
47-
rating = 1000
48-
args = (no_load_loss, load_loss, rating)
49-
50-
# verify correct behavior at no-load condition
51-
assert_allclose(
52-
transformer.simple_efficiency(no_load_loss*rating, *args),
53-
0.0
54-
)
55-
56-
# verify correct behavior at rated condition
57-
assert_allclose(
58-
transformer.simple_efficiency(rating*(1 + no_load_loss + load_loss),
59-
*args),
60-
rating,
61-
)
62-
63-
6446
@pytest.mark.parametrize(
65-
"input_power, no_load_loss, load_loss, transformer_rating, expected",
47+
"input_power, no_load_loss, load_loss, rating, expected",
6648
[
49+
# no-load condition
50+
(0.005 * 1000, 0.005, 0.01, 1000, 0.0),
51+
52+
# rated condition
53+
(1000 * (1 + 0.005 + 0.01), 0.005, 0.01, 1000, 1000),
54+
55+
# zero load_loss case
56+
# for load_loss = 0, the model reduces to:
57+
# P_out = P_in - L_no_load * P_nom
6758
(1000.0, 0.01, 0.0, 1000.0, 990.0),
6859
],
6960
)
70-
def test_simple_efficiency_zero_load_loss(
71-
input_power, no_load_loss, load_loss, transformer_rating, expected
61+
def test_simple_efficiency_numeric_cases(
62+
input_power, no_load_loss, load_loss, rating, expected
7263
):
73-
# for load_loss = 0, the model reduces to:
74-
# P_out = P_in - L_no_load * P_nom
7564
result = transformer.simple_efficiency(
7665
input_power=input_power,
7766
no_load_loss=no_load_loss,
7867
load_loss=load_loss,
79-
transformer_rating=transformer_rating,
68+
transformer_rating=rating,
8069
)
8170

8271
assert_allclose(result, expected)
72+
73+
74+
def test_simple_efficiency_vector_equals_scalar():
75+
input_power = np.array([200.0, 600.0, 900.0])
76+
no_load_loss = 0.005
77+
load_loss = 0.01
78+
rating = 1000.0
79+
80+
vector_result = transformer.simple_efficiency(
81+
input_power=input_power,
82+
no_load_loss=no_load_loss,
83+
load_loss=load_loss,
84+
transformer_rating=rating,
85+
)
86+
87+
scalar_result = np.array([
88+
transformer.simple_efficiency(p, no_load_loss, load_loss, rating)
89+
for p in input_power
90+
])
91+
92+
assert_allclose(vector_result, scalar_result)

0 commit comments

Comments
 (0)