Skip to content

Add model='gueymard2003' to get_relative_airmass #1655

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

Merged
merged 11 commits into from
Mar 9, 2023
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
19 changes: 17 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 references [7] and [8] -
requires apparent sun zenith

Returns
-------
Expand Down Expand Up @@ -196,7 +198,17 @@ 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] C. Gueymard (2019). Clear-Sky Radiation Models and Aerosol Effects.
In: Polo, J., Martín-Pomares, L., Sanfilippo, A. (eds) Solar Resources
Mapping. Green Energy and Technology. Springer, Cham.
:doi:`10.1007/978-3-319-97484-2_5`

.. [9] 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 +241,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