Skip to content

Commit bee329b

Browse files
Add model='gueymard2003' to get_relative_airmass (#1655)
* add new equation to get_relative_airmass * test * whatsnew * remove duplicate whatsnew entry * true -> apparent * fix merge error * Apply suggestions from code review Co-authored-by: Adam R. Jensen <[email protected]> --------- Co-authored-by: Adam R. Jensen <[email protected]>
1 parent 7bb30ad commit bee329b

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Enhancements
2020
:py:func:`pvlib.snow.loss_townsend` (:issue:`1636`, :pull:`1653`)
2121
* Added optional ``n_ar`` parameter to :py:func:`pvlib.iam.physical` to
2222
support an anti-reflective coating. (:issue:`1501`, :pull:`1616`)
23+
* Add ``model='gueymard2003'``, the airmass model used for REST and REST2,
24+
to :py:func:`~pvlib.atmosphere.get_relative_airmass`. (:pull:`1655`)
25+
2326

2427
* Added an optional ``model`` parameter to
2528
:py:func:`pvlib.bifacial.infinite_sheds.get_irradiance` and

pvlib/atmosphere.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ def get_relative_airmass(zenith, model='kastenyoung1989'):
158158
* 'gueymard1993' - See reference [4] -
159159
requires apparent sun zenith
160160
* 'young1994' - See reference [5] -
161-
requries true sun zenith
161+
requires true sun zenith
162162
* 'pickering2002' - See reference [6] -
163163
requires apparent sun zenith
164+
* 'gueymard2003' - See references [7] and [8] -
165+
requires apparent sun zenith
164166
165167
Returns
166168
-------
@@ -196,7 +198,17 @@ def get_relative_airmass(zenith, model='kastenyoung1989'):
196198
197199
.. [6] Keith A. Pickering. "The Ancient Star Catalog". DIO 12:1, 20,
198200
199-
.. [7] Matthew J. Reno, Clifford W. Hansen and Joshua S. Stein, "Global
201+
.. [7] C. Gueymard, "Direct solar transmittance and irradiance
202+
predictions with broadband models. Part I: detailed theoretical
203+
performance assessment". Solar Energy, vol 74, pp. 355-379, 2003.
204+
:doi:`10.1016/S0038-092X(03)00195-6`
205+
206+
.. [8] C. Gueymard (2019). Clear-Sky Radiation Models and Aerosol Effects.
207+
In: Polo, J., Martín-Pomares, L., Sanfilippo, A. (eds) Solar Resources
208+
Mapping. Green Energy and Technology. Springer, Cham.
209+
:doi:`10.1007/978-3-319-97484-2_5`
210+
211+
.. [9] Matthew J. Reno, Clifford W. Hansen and Joshua S. Stein, "Global
200212
Horizontal Irradiance Clear Sky Models: Implementation and Analysis"
201213
Sandia Report, (2012).
202214
'''
@@ -229,6 +241,9 @@ def get_relative_airmass(zenith, model='kastenyoung1989'):
229241
elif 'gueymard1993' == model:
230242
am = (1.0 / (np.cos(zenith_rad) +
231243
0.00176759*(z)*((94.37515 - z) ** - 1.21563)))
244+
elif 'gueymard2003' == model:
245+
am = (1.0 / (np.cos(zenith_rad) +
246+
0.48353*(z**0.095846)/(96.741 - z)**1.754))
232247
else:
233248
raise ValueError('%s is not a valid model for relativeairmass', model)
234249

pvlib/tests/test_atmosphere.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def zeniths():
3535
['kastenyoung1989', [nan, 36.467, 5.586, 1.000]],
3636
['gueymard1993', [nan, 36.431, 5.581, 1.000]],
3737
['young1994', [nan, 30.733, 5.541, 1.000]],
38-
['pickering2002', [nan, 37.064, 5.581, 1.000]]])
38+
['pickering2002', [nan, 37.064, 5.581, 1.000]],
39+
['gueymard2003', [nan, 36.676, 5.590, 1.000]]])
3940
def test_airmass(model, expected, zeniths):
4041
out = atmosphere.get_relative_airmass(zeniths, model)
4142
expected = np.array(expected)

0 commit comments

Comments
 (0)