From 7310306d288aa90b47ab6a81718eab5583be35f6 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Fri, 3 Feb 2023 21:16:05 -0500 Subject: [PATCH 1/7] add new equation to get_relative_airmass --- pvlib/atmosphere.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pvlib/atmosphere.py b/pvlib/atmosphere.py index ff1ce8d4d5..d1704c9c38 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 reference [7] - + requires true sun zenith Returns ------- @@ -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). ''' @@ -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) From 625eeb6b1154fd1d50dfe7dc31d4ec9b9fb60a3d Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Fri, 3 Feb 2023 21:16:46 -0500 Subject: [PATCH 2/7] test --- pvlib/tests/test_atmosphere.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) From 8a3f63f636dc7d7d2c4dc9b4634a7330f4740ccf Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Fri, 3 Feb 2023 21:16:54 -0500 Subject: [PATCH 3/7] whatsnew --- docs/sphinx/source/whatsnew/v0.9.5.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.5.rst b/docs/sphinx/source/whatsnew/v0.9.5.rst index 3261cb3b92..0caa0de6e8 100644 --- a/docs/sphinx/source/whatsnew/v0.9.5.rst +++ b/docs/sphinx/source/whatsnew/v0.9.5.rst @@ -16,7 +16,9 @@ Deprecations Enhancements ~~~~~~~~~~~~ - +* Add ``model='gueymard2003'``, the airmass model used for REST and REST2, + to :py:func:`~pvlib.atmosphere.get_relative_airmass`. (:pull:`1655`) + Bug fixes ~~~~~~~~~ From 29a534fddfccaa044dd4647231a36e79ffe9b8bb Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 4 Feb 2023 11:18:11 -0500 Subject: [PATCH 4/7] remove duplicate whatsnew entry --- docs/sphinx/source/whatsnew/v0.9.5.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.5.rst b/docs/sphinx/source/whatsnew/v0.9.5.rst index 671790cb59..9840b18da1 100644 --- a/docs/sphinx/source/whatsnew/v0.9.5.rst +++ b/docs/sphinx/source/whatsnew/v0.9.5.rst @@ -57,4 +57,3 @@ Contributors * Karel De Brabandere (:ghuser:`kdebrab`) * Mark Mikofski (:ghuser:`mikofski`) * Anton Driesse (:ghuser:`adriesse`) -* Adam R. Jensen (:ghuser:`AdamRJensen`) From 2eb7e9595d2186030c5e2de189e7d1c718aa7d83 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 5 Feb 2023 20:18:10 -0500 Subject: [PATCH 5/7] true -> apparent --- pvlib/atmosphere.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/atmosphere.py b/pvlib/atmosphere.py index d1704c9c38..2fe92475ea 100644 --- a/pvlib/atmosphere.py +++ b/pvlib/atmosphere.py @@ -162,7 +162,7 @@ def get_relative_airmass(zenith, model='kastenyoung1989'): * 'pickering2002' - See reference [6] - requires apparent sun zenith * 'gueymard2003' - See reference [7] - - requires true sun zenith + requires apparent sun zenith Returns ------- From 86aca9ef3d60c555657bcf119592e587b4512f12 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Fri, 17 Feb 2023 15:24:30 -0500 Subject: [PATCH 6/7] fix merge error --- docs/sphinx/source/whatsnew/v0.9.5.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.5.rst b/docs/sphinx/source/whatsnew/v0.9.5.rst index ab2b0bfa3e..acfa28f45b 100644 --- a/docs/sphinx/source/whatsnew/v0.9.5.rst +++ b/docs/sphinx/source/whatsnew/v0.9.5.rst @@ -16,8 +16,6 @@ Deprecations Enhancements ~~~~~~~~~~~~ -* Added optional ``n_ar`` parameter to :py:func:`pvlib.iam.physical` to - support an anti-reflective coating. (:issue:`1501`, :pull:`1616`) * Added the optional `string_factor` parameter to :py:func:`pvlib.snow.loss_townsend` (:issue:`1636`, :pull:`1653`) * Added optional ``n_ar`` parameter to :py:func:`pvlib.iam.physical` to From 2686a54278485f790523ab9e7d8d6950f52300f5 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 9 Mar 2023 11:12:47 -0500 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- pvlib/atmosphere.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pvlib/atmosphere.py b/pvlib/atmosphere.py index 2fe92475ea..bc00269ea0 100644 --- a/pvlib/atmosphere.py +++ b/pvlib/atmosphere.py @@ -161,7 +161,7 @@ def get_relative_airmass(zenith, model='kastenyoung1989'): requires true sun zenith * 'pickering2002' - See reference [6] - requires apparent sun zenith - * 'gueymard2003' - See reference [7] - + * 'gueymard2003' - See references [7] and [8] - requires apparent sun zenith Returns @@ -203,7 +203,12 @@ def get_relative_airmass(zenith, model='kastenyoung1989'): 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 + .. [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). '''