diff --git a/docs/sphinx/source/whatsnew/v0.9.5.rst b/docs/sphinx/source/whatsnew/v0.9.5.rst index c11d72f0de..acfa28f45b 100644 --- a/docs/sphinx/source/whatsnew/v0.9.5.rst +++ b/docs/sphinx/source/whatsnew/v0.9.5.rst @@ -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 ~~~~~~~~~ diff --git a/pvlib/atmosphere.py b/pvlib/atmosphere.py index ff1ce8d4d5..bc00269ea0 100644 --- a/pvlib/atmosphere.py +++ b/pvlib/atmosphere.py @@ -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 ------- @@ -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). ''' @@ -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) diff --git a/pvlib/tests/test_atmosphere.py b/pvlib/tests/test_atmosphere.py index 5cda3b811d..3518ccb7d6 100644 --- a/pvlib/tests/test_atmosphere.py +++ b/pvlib/tests/test_atmosphere.py @@ -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)