solrad.radiation package#
Submodules#
solrad.radiation.diffuse_radiance_model module#
This module contains all functions related to the computation of the spatial distribution of diffuse irradiance, also called diffuse radiance. This is accomplished by implementing the model developed by Iagawa et al. in their 2004 and 2014 papers (see references). The implementation here is mainly based off the 2014 paper, but making use of some expressions that only appeared in the 2004 paper.
References
[1] Norio Igawa, Yasuko Koga, Tomoko Matsuzawa, Hiroshi Nakamura, Models of sky radiance distribution and sky luminance distribution, Solar Energy, Volume 77, Issue 2, 2004, Pages 137-157, ISSN 0038-092X, https://doi.org/10.1016/j.solener.2004.04.016. (https://www.sciencedirect.com/science/article/pii/S0038092X04001070)
[2] Norio Igawa, Improving the All Sky Model for the luminance and radiance distributions of the sky, Solar Energy, Volume 105, 2014, Pages 354-372, ISSN 0038-092X, https://doi.org/10.1016/j.solener.2014.03.020. (https://www.sciencedirect.com/science/article/pii/S0038092X14001546)
- solrad.radiation.diffuse_radiance_model.compute_angular_distance_between_sun_and_sky_element_Zeta(Az, El, sun_az, sun_apel)#
Compute the angular distance between the sun and one or multiple sky elements on the sky.
- Parameters:
Az (float or numpy.array of floats with shape (E,A,1)) – If float, it should be the azimuth coordinate (in degrees) of the sky element for which the angular distance to the sun is to be calculated. If array, it should be a grid of azimuth coordinates (in degrees) of the sky elements for which the angular distance to the sun is to be calculated; and its values should also vary along axis 1. In any case, all values should be between 0 and 360 (inclusive).
El (float or numpy.array of floats with shape (E,A,1)) – If float, it should be the elevation coordinate (in degrees) of the sky element for which the angular distance to the sun is to be calculated. If array, it should be a grid of elevation coordinates (in degrees) of the sky elements for which the angular distance to the sun is to be calculated; and its values should also vary along axis 0. In any case, all values should be between 0 and 90 (inclusive).
sun_az (float or numpy.array of floats with shape (1,1,T)) – Azimuth coordinate of the sun (in degrees) across time. Values of must lie between 0 and 360 (inclusive).
sun_apel (float or numpy.array of floats with shape (1,1,T)) – Apparent elevation coordinate of the sun (in degrees) across time. Values of must lie between 0 and 90 (inclusive).
- Returns:
Zeta – Angular distance between the sun and a/all sky element(s) (in degrees) at a time or across multiple times.
- Return type:
float or numpy.array of floats with shape (E,A,T)
Notes
One can
- solrad.radiation.diffuse_radiance_model.compute_clear_sky_index_Kc(Gh, Ghs)#
Compute Igawa’s ‘clear sky index’ (Kc) parameter.
- Parameters:
Gh (float or numpy.array of floats (npoints,)) – Global horizontal irradiance [W/m^2]. Values must be non-negative.
Ghs (float or numpy.array of floats (npoints,)) – Standard global irradiance [W/m^2]. Values must be non-negative.
- Returns:
Kc – Igawa’s ‘clear sky index’ (Kc) parameter.
- Return type:
float or numpy.array of floats (npoints,)
Notes
1) Values of Kc above 1.2 are clipped down to 1.2. The reason is that in Igawa’s 2014 paper, all values reported for Kc were at or below 1.2, which makes me believe that a Cle of Kc is the maximum physically-sensible value for Kc.
- solrad.radiation.diffuse_radiance_model.compute_cloud_ratio_Ce(Gdh, Gh)#
Compute Igawa’s ‘cloud ratio’ (Ce) parameter.
- Parameters:
Gdh (float or numpy.array of floats (npoints,)) – Diffuse horizontal irradiance. Values must be non-negative.
Gh (float or numpy.array of floats (npoints,)) – Global horizontal irradiance. Values must be positive.
- Returns:
Ce – Igawa’s ‘cloud ratio’ (Ce) parameter.
- Return type:
float or numpy.array of floats (npoints,)
- solrad.radiation.diffuse_radiance_model.compute_cloudless_index_Cle(Ce, Ces)#
Compute Igawa’s ‘cloudless index’ (Cle) parameter.
- Parameters:
Ce (float or numpy.array of floats (npoints,)) – Igawa’s ‘cloud ratio’ (Ce) parameter. Values must be between 0 and 1.
Ces (float or numpy.array of floats (npoints,)) – Igawa’s ‘standard cloud ratio’ (Ces) parameter. Values must be between 0 and 1.
- Returns:
CLe – Igawa’s ‘cloudless index’ (Cle) parameter.
- Return type:
float or numpy.array of floats (npoints,)
Notes
Values of Cle above 1.2 are clipped down to 1.2. The reason is that in Igawa’s 2014 paper, all values reported for Cle were at or below 1.2, which makes me believe that a Cle of 1.2 is the maximum physically-sensible value for Cle.
- solrad.radiation.diffuse_radiance_model.compute_diffuse_radiance(Az, El, dAz, dEl, Gh, Gdh, extra_Gbn, sun_az, sun_apel, rel_airmass, num_iterations=500)#
Compute diffuse sky radiance using Igawa’s 2014 model detailed in [1].
- Parameters:
Az (float or numpy.array of floats with shape (E,A,1)) – Grid of azimuth coordinates (in degrees) of the sky elements for which the diffuse radiance is to be calculated. Its values should vary along axis 1. In any case, all values should be between 0 and 360 (inclusive).
El (float or numpy.array of floats with shape (E,A,1)) – Grid of elevation coordinates (in degrees) of the sky elements for which the diffuse radiance is to be calculated. Its values should vary along axis 0. In any case, all values should be between 0 and 90 (inclusive).
dAz (float) – Angular resolution of Az in degrees.
dEl (float) – Angular resolution of El in degrees.
Gh (numpy.array of floats with shape (1,1,T)) – Global horizontal irradiance [W/m^2] across time. Must be a non-negative array of numbers.
Gdh (numpy.array of floats with shape (1,1,T)) – Diffuse horizontal irradiance[W/m^2] across time. Must be a non-negative array of numbers.
extra_Gbn (numpy.array of floats with shape (1,1,T)) – Extraterrestrial normal irradiance [W/m^2]. Must be a non-negative array of numbers.
sun_apel (numpy.array of floats with shape (1,1,T)) – Sun’s apparent elevation (in degrees) across time. Values must lie between 0 and 90 (inclusive).
sun_az (numpy.array of floats with shape (1,1,T)) – Suns’s azimuth (in degrees) across time. Values must lie between 0 and 360 (inclusive).
rel_airmass (numpy.array of floats with shape (1,1,T)) – Relative airmass [unitless] across time. Values must be non-negative.
num_iterations (int, optional) – Number of iterations to use when filling NaN data. Default is 500.
- Returns:
res – Dictionary containing result variables. It has the following Key-Value pairs:
- Sivnumpy.array of floats with shape (1,1,T)
Igawa’s ‘Sky Index’ parameter across time.
- ”Kc”numpy.array of floats with shape (1,1,T)
Igawa’s ‘Clear Sky Index’ parameter across time.
- ”Cle”numpy.array of floats with shape (1,1,T)
Igawa’s ‘Cloudless Index’ parameter across time.
- ”Lea”numpy.array of floats with shape (E,A,T)
Diffuse sky radiance distribution [W/m^2/sr] across time.
- ”Le”numpy.array of floats with shape (E,A,T)
Relative sky radiance distribution [adm] across time.
- ”Lez”numpy.array of floats with shape (1,1,T)
Zenith radiance distribution [W/m^2/sr] across time.
- ”LzEd”numpy.array of floats with shape (1,1,T)
Inverse of the integration value of relative sky radiance distribution.
- Return type:
dict
Notes
This function computes ‘LzEd’ numerically. I tried using the shortcut method proposed by the authors (i.e, the best fit constants) but the resulting values were quite bad.
References
[1] Norio Igawa, Improving the All Sky Model for the luminance and radiance distributions of the sky, Solar Energy, Volume 105, 2014, Pages 354-372, ISSN 0038-092X, https://doi.org/10.1016/j.solener.2014.03.020. (https://www.sciencedirect.com/science/article/pii/S0038092X14001546)
- solrad.radiation.diffuse_radiance_model.compute_improved_all_sky_model_coeffs(coeff_name, Kc, Cle)#
Compute Igawa’s improved all sky model coefficients.
- Parameters:
coeff_name ({'a', 'b', 'c', 'd', 'e'}) – Name of the coefficient to compute.
Kc (float or numpy.array of floats (npoints,)) –
- Igawa’s ‘clear sky index’ (Kc) parameter. Values must be
between 0 and 1.2.
Cle (float or numpy.array of floats (npoints,)) – Igawa’s ‘cloudless index’ (Cle) parameter. Values must be between 0 and 1.2.
- Returns:
coeff_val – Value of the specified sky model coefficients.
- Return type:
float or numpy.array of floats (npoints,)
- solrad.radiation.diffuse_radiance_model.compute_inverse_of_the_integration_value_of_relative_sky_radiance_distribution_numerically_LzEd(Le, El, dAz, dEl)#
Compute the inverse of the integration value of relative sky radiance distribution, according to Igawa’s 2014 paper, by numerically computing the integral of the relative sky radiance distribution using the trapezoidal rule.
- Parameters:
Le (numpy.array of floats with shape (E,A,T)) – Unnormalized relative sky radiance distribution in W/m^2/sr, across time. Le[n,m,t] holds the radiance of a sky element with elevation specified by n, azimuth specified by m on a time specified by t. In other words, axis 0 of Le takes account of the variation of radiance across the sky with respect to elevation, axis 1 accounts for the variation with respect to azimuth and axis 2 accounts for the variation with respect to time. Values of Le must be non-negative.
El (float or numpy.array of floats with shape (E,A,1)) – Grid of elevation coordinates (in degrees) of the sky elements for which LzEd is to be calculated. Its values should vary along axis 0. In any case, all values should be between 0 and 90 (inclusive).
dAz (float) – Angular resolution of azimuth values in degrees. Values must be positive.
dEl (float) – Angular resolution of elevation values in degrees. Values must be positive.
- Returns:
LzEd – Inverse of the integration value of relative sky radiance distribution.
- Return type:
float or numpy.array of floats with shape (1,1,T)
- solrad.radiation.diffuse_radiance_model.compute_inverse_of_the_integration_value_of_relative_sky_radiance_distribution_using_constants_LzEd(Kc, Cle, sun_apel)#
Compute the inverse of the integration value of relative sky radiance distribution, according to Igawa’s 2014 paper, using the non-linear regression constants proposed by the author.
- Parameters:
Kc (float or numpy.array of floats (npoints,)) – Igawa’s ‘clear sky index’ (Kc) parameter. values must be between 0 and 1.2.
Cle (float or numpy.array of floats (npoints,)) – Igawa’s ‘cloudless index’ (Cle) parameter. values must be between 0 and 1.2.
sun_apel (float or numpy.array of floats (npoints,)) – Sun’s apparent elevation in degrees. Values must be between 0 and 90.
- Returns:
LzEd – Inverse of the integration value of relative sky radiance distribution.
- Return type:
float or numpy.array of floats (npoints,)
- solrad.radiation.diffuse_radiance_model.compute_sky_index_Siv(Kc, Cle)#
Compute Igawa’s ‘Sky index’ (Siv) parameter used for classifying types of sky.
- Parameters:
Kc (float or numpy.array of floats (npoints,)) – Igawa’s ‘clear sky index’ (Kc) parameter. Values must be between 0 and 1.2.
Cle (float or numpy.array of floats (npoints,)) – Igawa’s ‘cloudless index’ (Cle) parameter. Values must be between 0 and 1.2.
- Returns:
Siv – Igawa’s ‘Sky index’ (Siv) parameter.
- Return type:
float or numpy.array of floats (npoints,)
- solrad.radiation.diffuse_radiance_model.compute_standard_cloud_ratio_Ces(sun_apel)#
Compute Igawa’s ‘standard cloud ratio’ (Ces) parameter.
- Parameters:
sun_apel (float or numpy.array of floats (npoints,)) – Sun’s apparent elevation in degrees. Values must be between 0 and 90.
- Returns:
Ces – Igawa’s ‘standard cloud ratio’ (Ces) parameter.
- Return type:
float or numpy.array of floats (npoints,)
Notes
1) Ces must be a number between 0 and 1. As such, any values above 1 are clipped down to 1.
- solrad.radiation.diffuse_radiance_model.compute_standard_global_irradiance_Ghs(extra_Gbn, rel_airmass)#
Compute Igawa’s ‘standard global irradiance’ (Ghs) parameter.
- Parameters:
extra_Gbn (float or numpy.array of floats (npoints,)) – Extraterrestrial normal irradiance [W/m^2]. Values must be non-negative.
rel_airmass (float or numpy.array of floats (npoints,)) – Relative airmass [adimensional]. Values must be positive.
- Returns:
Ghs – Igawa’s ‘standard global irradiance’ (Ghs) parameter.
- Return type:
float or numpy.array of floats (npoints,)
- solrad.radiation.diffuse_radiance_model.diffusion_indicatrix_function(Zeta, c, d, e)#
Compute Igawa’s diffusion indicatrix function.
- Parameters:
Zeta (float or numpy.array of floats with shape (E,A,T)) – Angular distance between the sun and_sky element(s) (in degrees). If a numpy.array, axis 0 and axis 1 take account of the spatial varaition of ‘Zeta’ with respect to the Elevation and the Azimuth, respectively, while axis 2 takes account of its temporal variation.
c (float or numpy.array of floats with shape (1,1,T)) – Igawa’s improved all sky model coefficient ‘c’.
d (float or numpy.array of floats with shape (1,1,T)) – Igawa’s improved all sky model coefficient ‘d’.
e (float or numpy.array of floats with shape (1,1,T)) – Igawa’s improved all sky model coefficient ‘e’.
- Returns:
diffusion_indicatrix – Values of the diffusion indicatrix at a time or across multiple times.
- Return type:
float or numpy.array of floats with shape (E,A,T)
- solrad.radiation.diffuse_radiance_model.gradation_function(El, a, b)#
Compute Igawa’s gradation function.
- Parameters:
El (float or numpy.array of floats with shape (E,A,1)) – If float, it should be the elevation coordinate (in degrees) of the sky element for which the gradation is to be calculated. If array, it should be a grid of elevation coordinates (in degrees) of the sky elements for which the gradiation is to be calculated; and its values should also vary along axis 0. In any case, all values should be between 0 and 90 (inclusive).
a (float or numpy.array of floats with shape (1,1,T)) – Igawa’s improved all sky model coefficient ‘a’.
b (float or numpy.array of floats with shape (1,1,T)) – Igawa’s improved all sky model coefficient ‘b’.
- Returns:
gradation – Values of the gradation function, at a time or across multiple times.
- Return type:
float or numpy.array of floats with shape (E,A,T)
solrad.radiation.direct_radiance_model module#
This module contains all functions related to the computation of the spatial distribution of direct/beam irradiance, also called direct/beam radiance. This is accomplished by modelling the direct irradiance as a point-like source of radiance, i.e, a dirac delta. However, since the the discretization of the sky does not have infinite resolution, I implement a procedure whereby the irradiance of a point, gets proportionately redistributed to the nearest points which do appear in the regular grid.
- solrad.radiation.direct_radiance_model.compute_direct_radiance(Az, El, Gbn, sun_az, sun_apel)#
Compute direct sky radiance by modelling it as dirac delta function.
- Parameters:
Az (float or numpy.array of floats with shape (E,A,1)) – Grid of azimuth coordinates (in degrees) of the sky elements for which the direct radiance is to be calculated. Its values should vary along axis 1. In any case, all values should be between 0 and 360 (inclusive).
El (float or numpy.array of floats with shape (E,A,1)) – Grid of elevation coordinates (in degrees) of the sky elements for which the direct radiance is to be calculated. Its values should vary along axis 0. In any case, all values should be between 0 and 90 (inclusive).
Gbn (numpy.array of floats with shape (1,1,T)) – Direct normal irradiance [W/m^2] across time. Must be a non-negative array of numbers.
sun_apel (numpy.array of floats with shape (1,1,T)) – Sun’s apparent elevation (in degrees) across time. Values must lie between 0 and 90 (inclusive).
sun_az (numpy.array of floats with shape (1,1,T)) – Suns’s azimuth (in degrees) across time. Values must lie between 0 and 360 (inclusive).
- Returns:
Lea – Direct sky radiance distribution [W/m^2/sr] across time.
- Return type:
numpy.array of floats with shape (E,A,T)
solrad.radiation.spectral_radiance_model module#
This module contains all functions related to the computation of the spatial and spectral distribution of direct and diffuse irradiance, also called spectral radiance. This is accomplished by the combination of various models. More specifically, one model for the spatial distribution of the diffuse component, one model for the spatial distribution of the direct component and one model for the spectral distribution of both components.
- solrad.radiation.spectral_radiance_model.compute_spectral_radiance(Az, El, dAz, dEl, DatetimeIndex_obj, sun_apel, sun_az, Gh, extra_Gbn, Gbn, Gdh, SP, rel_airmass, H2O, O3, aod_500nm, alpha_500nm, spectrally_averaged_aaf, single_scattering_albedo, ground_albedo=0, mean_surface_tilt=0, num_iterations=500)#
Compute direct and diffuse components of spectral radiance across time.
- Parameters:
Az (float or numpy.array of floats with shape (E,A)) – Grid of azimuth coordinates (in degrees) of the sky elements for which the spectral radiance is to be calculated. Its values should vary along axis 1. In any case, all values should be between 0 and 360 (inclusive).
El (float or numpy.array of floats with shape (E,A)) – Grid of elevation coordinates (in degrees) of the sky elements for which the spectral radiance is to be calculated. Its values should vary along axis 0. In any case, all values should be between 0 and 90 (inclusive).
dAz (float) – Angular resolution of Az in degrees.
dEl (float) – Angular resolution of El in degrees.
DatetimeIndex_obj (pandas.DatetimeIndex object with shape (T,)) – An index of Timestamp values detailing the times at which each of the samples of the time-dependent variables were taken. We denote its length as T.
sun_apel (numpy.array of floats with shape (T,)) – Sun’s apparent elevation (in degrees) across time. Values must lie between 0 and 90 (inclusive).
sun_az (numpy.array of floats with shape (T,)) – Suns’s azimuth (in degrees) across time. Values must lie between 0 and 360 (inclusive).
Gh (numpy.array of floats with shape (T,)) – Global horizontal irradiance [W/m^2] across time. Must be a non-negative array of numbers.
extra_Gbn (numpy.array of floats with shape (T,)) – Extraterrestrial normal irradiance [W/m^2] across time. Must be a non-negative array of numbers.
Gbn (numpy.array of floats with shape (T,)) – Direct normal irradiance [W/m^2] across time. Must be a non-negative array of numbers.
Gdh (numpy.array of floats with shape (T,)) – Diffuse horizontal irradiance [W/m^2] across time. Must be a non-negative array of numbers.
SP (numpy.array of floats with shape (T,)) – Surface Pressure [Pa] across time.
rel_airmass (numpy.array of floats with shape (T,)) – Relative airmass [unitless] across time.
H2O (numpy.array of floats with shape (T,)) – Atmospheric water vapor content [cm] across time.
O3 (numpy.array of floats with shape (T,)) – Atmospheric ozone content [atm-cm] across time.
aod_500nm (numpy.array of floats with shape (T,)) – Aerosol turbidity at 500 nm [unitless] across time.
alpha_500nm (numpy.array of floats with shape (T,)) – Angstrom turbidity exponent at 500nm [unitless] across time.
spectrally_averaged_aerosol_asymmetry_factor (numpy.array of floats with shape (T,)) – Average across selected range of wavelengths of the Aerosol asymmetry factor (mean cosine of scattering angle) [unitless], across time.
single_scattering_albedo (numpy.array of floats with shape (T,122)) – Aerosol single scattering albedo at multiple wavelengths. It is a matrix of size Tx122 where the second dimension spans the wavelength range and the first one spans the number of simulations (i.e, length of DatetimeIndex_obj) [unitless].
ground_albedo (float or numpy.array of floats with shape (T,122), optional) – Albedo [0-1] of the ground surface. Can be provided as a scalar value if albedo is not spectrally-dependent, or as a Tx122 matrix where the second dimension spans the wavelength range and the first one spans the number of simulations (i.e, length of DatetimeIndex_obj). [unitless]. Default is 0.
mean_surface_tilt (float or numpy.array of floats with shape (T,), optional) – Mean panel tilt from horizontal [degrees] across time. Default is 0.
num_iterations (int, optional) – Number of iterations to use when filling NaN data. Default is 500.
- Returns:
res – Dictionary containing result variables. It has the following Key-Value pairs:
- “Siv”numpy.array of floats with shape (T,)
Igawa’s ‘Sky Index’ parameter across time.
- ”Kc”numpy.array of floats with shape (T,)
Igawa’s ‘Clear Sky Index’ parameter across time.
- ”Cle”numpy.array of floats with shape (T,)
Igawa’s ‘Cloudless Index’ parameter across time.
- ”wavelengths”numpy.array of floats with shape (122,)
Wavelengths in nanometers.
- ”DatetimeIndex_obj”pandas.Series of pandas.Timestamp objects with shape (T,)
Series of Timestamp values detailing the times at which each of the samples of the time-dependent variables were taken. We denote its length as T.
- ”direct”List with length T of numpy.arrays of floats with shape (E,A,122)
Direct component of spectral radiance across time. It has units of W/m^2/sr.
- ”diffuse”List with length T of numpy.arrays of floats with shape (E,A,122)
Diffuse component of sepctral radiance across time. It has units of W/m^2/sr.
- Return type:
dict
Notes
mean_surface_tilt variable really only affects the computation of the spectral distribution of diffuse radiance. It has no effect on the actual value.
solrad.radiation.spectrl2 module#
Pvlib’s ‘spectrl2’ module that implements the Bird Simple Spectral Model.
This module is almost the same as that of the pvlib source: https://pvlib-python.readthedocs.io/en/v0.8.1/_modules/pvlib/spectrum/spectrl2.html#spectrl2
However, some minor have been made to it. First, some of the comments and
descriptions were changed to better suit the standard being used in other
modules of this package. Second, the ‘spectrl2’ function was slightly altered
in order to accomodate the use of the Shettel and Fenn models (see reference [1]) for the
Aerosol Asymmetry Factor and the Single Scattering Albedo. Third, one extra
function has been added: compute_direct_and_diffuse_normalized_spectra()
which
basically just uses spectrl2 and then normalizes the obtained irradiance spectra.
To be absolutely clear, most of this code is not mine (just the changes
mentioned above) and was taken from the source mentioned above. Credit for the
spctrl2 implementation belongs to them.
References
[1] Shettle, Eric & Fenn, Robert. (1979). Models for the Aerosols of the Lower Atmosphere and the Effects of Humidity Variations on their Optical Properties. Environ. Res.. 94.
- solrad.radiation.spectrl2.compute_direct_and_diffuse_normalized_spectra(sun_apzen, SP, rel_airmass, H2O, O3, aod_500nm, alpha_500nm, single_scattering_albedo, spectrally_averaged_aaf, ground_albedo=0, mean_surface_tilt=0, dayofyear=None)#
Estimate spectral irradiance using the Bird Simple Spectral Model (pvlib’s SPECTRL2) and then return the normalized spectra for direct/beam and diffuse irradiance.
- Parameters:
sun_apzen (float, numpy.array of floats or pandas.Series of floats of length N) – Solar zenith angle of the sun [degrees].
SP (float, numpy.array of floats or pandas.Series of floats of length N) – Surface Pressure [Pa]. If it is a pandas.Series, it should have the same index as apzen.
rel_airmass (float, numpy.array of floats or pandas.Series of floats of length N) – Relative airmass [unitless]. If it is a pandas.Series, it should have the same index as apzen.
H2O (float, numpy.array of floats or pandas.Series of floats of length N) – Atmospheric water vapor content [cm]. If it is a pandas.Series, it should have the same index as apzen.
O3 (float, numpy.array of floats or pandas.Series of floats of length N) – Atmospheric ozone content [atm-cm]. If it is a pandas.Series, it should have the same index as apzen.
aod_500nm (float, numpy.array of floats or pandas.Series of floats of length N) – Aerosol turbidity at 500 nm [unitless]. If it is a pandas.Series, it should have the same index as apzen.
alpha_500nm (float, numpy.array of floats or pandas.Series of floats of length N) – Angstrom turbidity exponent at 500nm [unitless]. If it is a pandas.Series, it should have the same index as apzen.
single_scattering_albedo (2D-numpy.array of floats with shape (N,122)) – Aerosol single scattering albedo at multiple wavelengths. It is matrix of size Nx122 where the second dimension spans the wavelength range and the first one spans the number of simulations (i.e, length of apzen) [unitless].
spectrally_averaged_aerosol_asymmetry_factor (float, numpy.array of floats or pandas.Series of floats of length N) – Average across selected range of wavelengths of the Aerosol asymmetry factor (mean cosine of scattering angle) [unitless]. If it is a pandas.Series, it should have the same index as apzen.
ground_albedo (float or 2D-numpy.array of floats with shape (N,122)) – Albedo [0-1] of the ground surface. Can be provided as a scalar value if albedo is not spectrally-dependent, or as a Nx122 matrix where the second dimension spans the wavelength range and the first one spans the number of simulations (i.e, length of apzen). [unitless]. Default is 0.
mean_surface_tilt (float, numpy.array of floats or pandas.Series of floats of length N) – Mean panel tilt from horizontal [degrees]. IIf it is a pandas.Series, it should have the same index as apzen.
dayofyear (float or numpy.array of floats of length N, optional.) – The day of year [1-365]. Must be provided if apzen is not a pandas Series. Default is None.
- Returns:
res – Dictionary containing result variables. It has the following Key-Value pairs:
- “direct”numpy.array of floats with shape (122,) or 2D numpy.array of floats with (N, 122)
Normalized spectrum of direct/beam irradiance. The shape of the output depends on the shape of the inputs. If apzen is a single value, res[“direct”] will have shape (122,). Else, it will have shape (N, 122) where N is the length of apzen. The 122 makes reference to the number of wavelengths at which the results are given.
- ”diffuse”numpy.array of floats with shape (122,) or 2D numpy.array of floats with (N, 122)
Normalized spectrum of diffuse irradiance. The shape of the output depends on the shape of the inputs. If apzen is a single value, res[“diffuse”] will have shape (122,). Else, it will have shape (N, 122) where N is the length of apzen. The 122 makes reference to the number of wavelengths at which the results are given.
- ”wavelengths”numpy.array of floats with shape (122,)
Wavelengths in nanometers, at which the normalized spectra are given.
- Return type:
dict
- Raises:
1) TypeError : – The following TypeError was raised: ‘loop of ufunc does not support argument 0 of type float which has no callable exp method’. This usually happens when single_scattering_albedo is not an numpy.array of floats. Attempt to pass
numpy.array(single_scattering_albedo).astype(float)
instead.”
Notes
The mean_surface_tilt argument really only affects the computation of the spectral distribution of diffuse radiance. It has no effect on the actual value.
- solrad.radiation.spectrl2.spectrl2(apparent_zenith, aoi, surface_tilt, ground_albedo, surface_pressure, relative_airmass, precipitable_water, ozone, aerosol_turbidity_500nm, alpha, scattering_albedo, spectrally_averaged_aerosol_asymmetry_factor, dayofyear=None)#
Estimate spectral irradiance using the Bird Simple Spectral Model (SPECTRL2).
The Bird Simple Spectral Model [1]_ produces terrestrial spectra between 300 and 4000 nm with a resolution of approximately 10 nm. Direct and diffuse spectral irradiance are modeled for horizontal and tilted surfaces under cloudless skies. SPECTRL2 models radiative transmission, absorption, and scattering due to atmospheric aerosol, water vapor, and ozone content.
- Parameters:
apparent_zenith (float, numpy.array of floats or pandas.Series of floats) – Solar zenith angle of the sun [degrees].
aoi (float, numpy.array of floats or pandas.Series of floats) – Angle of incidence of the solar vector on the panel [degrees]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
surface_tilt (float, numpy.array of floats or pandas.Series of floats) – Panel tilt from horizontal [degrees]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
ground_albedo (float or 2D-numpy.array of floats) – Albedo [0-1] of the ground surface. Can be provided as a scalar value if albedo is not spectrally-dependent, or as a 122xN matrix where the first dimension spans the wavelength range and the second one spans the number of simulations (i.e, length of ‘apparent zenith’) [unitless].
surface_pressure (float, numpy.array of floats or pandas.Series of floats) – Surface pressure [Pa]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
relative_airmass (float, numpy.array of floats or pandas.Series of floats) – Relative airmass [unitless]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
precipitable_water (float, numpy.array of floats or pandas.Series of floats) – Atmospheric water vapor content [cm]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
ozone (float, numpy.array of floats or pandas.Series of floats) – Atmospheric ozone content [atm-cm]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
aerosol_turbidity_500nm (float, numpy.array of floats or pandas.Series of floats) – Aerosol turbidity at 500 nm [unitless]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
scattering_albedo (2D-numpy.array of floats) – Aerosol single scattering albedo at multiple wavelengths. It is matrix of size Nx122 where the second dimension spans the wavelength range and the first one spans the number of simulations (i.e, length of ‘apparent zenith’) [unitless]. That is, it should be a matrix of size matrix.
alpha (float, numpy.array of floats or pandas.Series of floats) – Angstrom turbidity exponent at 500nm [unitless]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
spectrally_averaged_aerosol_asymmetry_factor (float, numpy.array of floats or pandas.Series of floats) – Average across selected range of wavelengths of the Aerosol asymmetry factor (mean cosine of scattering angle) [unitless]. If it is a numpy.array or a pandas.Series, it must be the same length as ‘apparent_zenith’ and, additionally, if it is a pandas.Series, it should have the same index as ‘apparent_zenith’.
dayofyear (float or numpy.array of floats, optional.) – The day of year [1-365]. Must be provided if apparent_zenith is not a pandas Series.
- Returns:
spectra – A dict of arrays. With the exception of wavelength, which has length 122, each array has shape (122, N) where N is the length of the input
apparent_zenith
. All values are spectral irradiance with units W/m^2/nm except for wavelength, which is in nanometers.wavelength : Wavelengths in nanometers.
dni_extra : Direct normal extraterrestrial solar spectrum.
dhi : Diffuse horizontal irradiance.
dni : Direct normal irradiance.
poa_sky_diffuse : Diffuse irradiance from the sky on a tilted surface.
poa_ground_diffuse : Diffuse irradiance from the ground reflections on a tilted surface.
poa_direct : Direct irradiance on tilted surface.
poa_global : Global irradiance on a tilted surface.
- Return type:
dict
Notes
NREL’s C implementation
spectrl2_2.c
[2]_ of the model differs in several ways from the original report [1]_. The report itself also has a few differences between the in-text equations and the code appendix. The list of known differences is shown below. Note that this implementation followsspectrl2_2.c
.Equation
Report
Appendix
spectrl2_2.c
2-4
1.335
1.335
1.3366
2-11
118.93
118.93
118.3
3-8
To’
Tu’
Tu’
3-5, 3-6, 3-7, 3-1
double Cs
single Cs
single Cs
2-5
kasten1966
kasten1966
kastenyoung1989
This implementation also deviates from the reference by including a check for angles of incidence greater than 90 degrees; without this, the model might return negative spectral irradiance values when the sun is behind the plane of array.
References