Skip to content
3 changes: 3 additions & 0 deletions docs/sphinx/source/whatsnew/v0.9.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Enhancements
:py:func:`pvlib.snow.loss_townsend` (:issue:`1636`, :pull:`1653`)
* Added optional ``n_ar`` parameter to :py:func:`pvlib.iam.physical` to
support an anti-reflective coating. (:issue:`1501`, :pull:`1616`)
* Add ``model='gueymard2003'``, the airmass model used for REST and REST2,
to :py:func:`~pvlib.atmosphere.get_relative_airmass`. (:pull:`1655`)


Bug fixes
~~~~~~~~~
Expand Down
14 changes: 12 additions & 2 deletions pvlib/atmosphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ def get_relative_airmass(zenith, model='kastenyoung1989'):
* 'gueymard1993' - See reference [4] -
requires apparent sun zenith
* 'young1994' - See reference [5] -
requries true sun zenith
requires true sun zenith
* 'pickering2002' - See reference [6] -
requires apparent sun zenith
* 'gueymard2003' - See reference [7] -
requires apparent sun zenith

Returns
-------
Expand Down Expand Up @@ -196,7 +198,12 @@ def get_relative_airmass(zenith, model='kastenyoung1989'):

.. [6] Keith A. Pickering. "The Ancient Star Catalog". DIO 12:1, 20,

.. [7] Matthew J. Reno, Clifford W. Hansen and Joshua S. Stein, "Global
.. [7] C. Gueymard, "Direct solar transmittance and irradiance
predictions with broadband models. Part I: detailed theoretical
performance assessment". Solar Energy, vol 74, pp. 355-379, 2003.
:doi:`10.1016/S0038-092X(03)00195-6`

.. [8] Matthew J. Reno, Clifford W. Hansen and Joshua S. Stein, "Global
Horizontal Irradiance Clear Sky Models: Implementation and Analysis"
Sandia Report, (2012).
'''
Expand Down Expand Up @@ -229,6 +236,9 @@ def get_relative_airmass(zenith, model='kastenyoung1989'):
elif 'gueymard1993' == model:
am = (1.0 / (np.cos(zenith_rad) +
0.00176759*(z)*((94.37515 - z) ** - 1.21563)))
elif 'gueymard2003' == model:
am = (1.0 / (np.cos(zenith_rad) +
0.48353*(z**0.095846)/(96.741 - z)**1.754))
else:
raise ValueError('%s is not a valid model for relativeairmass', model)

Expand Down
3 changes: 2 additions & 1 deletion pvlib/tests/test_atmosphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def zeniths():
['kastenyoung1989', [nan, 36.467, 5.586, 1.000]],
['gueymard1993', [nan, 36.431, 5.581, 1.000]],
['young1994', [nan, 30.733, 5.541, 1.000]],
['pickering2002', [nan, 37.064, 5.581, 1.000]]])
['pickering2002', [nan, 37.064, 5.581, 1.000]],
['gueymard2003', [nan, 36.676, 5.590, 1.000]]])
def test_airmass(model, expected, zeniths):
out = atmosphere.get_relative_airmass(zeniths, model)
expected = np.array(expected)
Expand Down