@@ -675,7 +675,8 @@ def klucher(surf_tilt, surf_az, DHI, GHI, sun_zen, sun_az):
675675 return sky_diffuse
676676
677677
678- def haydavies (surf_tilt , surf_az , DHI , DNI , DNI_ET , sun_zen , sun_az ):
678+ def haydavies (surface_tilt , surface_azimuth , dhi , dni , dni_extra ,
679+ solar_zenith = None , solar_azimuth = None , projection_ratio = None ):
679680 r'''
680681 Determine diffuse irradiance from the sky on a
681682 tilted surface using Hay & Davies' 1980 model
@@ -692,46 +693,52 @@ def haydavies(surf_tilt, surf_az, DHI, DNI, DNI_ET, sun_zen, sun_az):
692693 Parameters
693694 ----------
694695
695- surf_tilt : float or Series
696+ surface_tilt : float or Series
696697 Surface tilt angles in decimal degrees.
697698 The tilt angle is defined as
698699 degrees from horizontal (e.g. surface facing up = 0, surface facing
699700 horizon = 90)
700701
701- surf_az : float or Series
702- Surface azimuth angles in decimal degrees.
703- The Azimuth convention is defined
704- as degrees east of north (e.g. North = 0, South=180 East = 90,
705- West = 270).
702+ surface_azimuth : float or Series
703+ Surface azimuth angles in decimal degrees.
704+ The azimuth convention is defined
705+ as degrees east of north (e.g. North= 0, South=180, East= 90,
706+ West= 270).
706707
707- DHI : float or Series
708- diffuse horizontal irradiance in W/m^2.
708+ dhi : float or Series
709+ Diffuse horizontal irradiance in W/m^2.
709710
710- DNI : float or Series
711- direct normal irradiance in W/m^2.
711+ dni : float or Series
712+ Direct normal irradiance in W/m^2.
712713
713- DNI_ET : float or Series
714- extraterrestrial normal irradiance in W/m^2.
714+ dni_extra : float or Series
715+ Extraterrestrial normal irradiance in W/m^2.
715716
716- sun_zen : float or Series
717- apparent (refraction-corrected) zenith
718- angles in decimal degrees.
717+ solar_zenith : None, float or Series
718+ Solar apparent (refraction-corrected) zenith
719+ angles in decimal degrees.
720+ Must supply ``solar_zenith`` and ``solar_azimuth`` or supply
721+ ``projection_ratio``.
719722
720- sun_az : float or Series
721- Sun azimuth angles in decimal degrees.
722- The Azimuth convention is defined
723- as degrees east of north (e.g. North = 0, East = 90, West = 270).
723+ solar_azimuth : None, float or Series
724+ Solar azimuth angles in decimal degrees.
725+ Must supply ``solar_zenith`` and ``solar_azimuth`` or supply
726+ ``projection_ratio``.
727+
728+ projection_ratio : None, float or Series
729+ Ratio of angle of incidence projection to solar zenith
730+ angle projection.
731+ Must supply ``solar_zenith`` and ``solar_azimuth`` or supply
732+ ``projection_ratio``.
724733
725734 Returns
726735 --------
727736
728- SkyDiffuse : float or Series
729-
730- the diffuse component of the solar radiation on an
731- arbitrarily tilted surface defined by the Perez model as given in
732- reference [3].
733- SkyDiffuse is the diffuse component ONLY and does not include the
734- ground reflected irradiance or the irradiance due to the beam.
737+ sky_diffuse : float or Series
738+ The diffuse component of the solar radiation on an
739+ arbitrarily tilted surface defined by the Perez model as given in
740+ reference [3]. Does not include the
741+ ground reflected irradiance or the irradiance due to the beam.
735742
736743 References
737744 -----------
@@ -747,21 +754,23 @@ def haydavies(surf_tilt, surf_az, DHI, DNI, DNI_ET, sun_zen, sun_az):
747754
748755 pvl_logger .debug ('diffuse_sky.haydavies()' )
749756
750- cos_tt = aoi_projection (surf_tilt , surf_az , sun_zen , sun_az )
751-
752- cos_sun_zen = tools .cosd (sun_zen )
753-
754- # ratio of titled and horizontal beam irradiance
755- Rb = cos_tt / cos_sun_zen
757+ # if necessary, calculate ratio of titled and horizontal beam irradiance
758+ if projection_ratio is None :
759+ cos_tt = aoi_projection (surface_tilt , surface_azimuth ,
760+ solar_zenith , solar_azimuth )
761+ cos_sun_zen = tools .cosd (solar_zenith )
762+ Rb = cos_tt / cos_sun_zen
763+ else :
764+ Rb = projection_ratio
756765
757766 # Anisotropy Index
758- AI = DNI / DNI_ET
767+ AI = dni / dni_extra
759768
760769 # these are actually the () and [] sub-terms of the second term of eqn 7
761770 term1 = 1 - AI
762- term2 = 0.5 * (1 + tools .cosd (surf_tilt ))
771+ term2 = 0.5 * (1 + tools .cosd (surface_tilt ))
763772
764- sky_diffuse = DHI * (AI * Rb + term1 * term2 )
773+ sky_diffuse = dhi * (AI * Rb + term1 * term2 )
765774 sky_diffuse [sky_diffuse < 0 ] = 0
766775
767776 return sky_diffuse
0 commit comments