From afdcdd4acc3fd00420a656b1c106d9a8bb85ad29 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:21:00 -0700 Subject: [PATCH] add `spectra` and `spectra_components` to nomenclature page (#2264) * Update variables_style_rules.csv * Update v0.11.2.rst * not sure what happened here after merge with main * Update v0.11.2.rst * update whatsnew and glossary page * Update spectrl2.py * Update irradiance.py * typo * update spectrl2.py and spectrum irradiance.py * grammar -- periods before/after units(?) * Apply suggestions from code review Co-authored-by: Kevin Anderson * Update v0.11.2.rst * fix whatsnew formatting * formatting attempt #2 --------- Co-authored-by: Kevin Anderson --- docs/sphinx/source/user_guide/nomenclature.rst | 7 +++++++ docs/sphinx/source/whatsnew/v0.11.2.rst | 4 ++++ pvlib/spectrum/irradiance.py | 3 ++- pvlib/spectrum/spectrl2.py | 3 ++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/user_guide/nomenclature.rst b/docs/sphinx/source/user_guide/nomenclature.rst index a89da06cbf..180f0a298f 100644 --- a/docs/sphinx/source/user_guide/nomenclature.rst +++ b/docs/sphinx/source/user_guide/nomenclature.rst @@ -142,6 +142,13 @@ There is a convention on consistent variable names throughout the library: solar_zenith Zenith angle of the sun in degrees + spectra + spectra_components + Spectral irradiance (components) [Wm⁻²nm⁻¹]. The amount of energy + incident on a unit area per unit time and per unit + wavelength. As with broadband irradiance, global spectral irradiance + is composed of direct and diffuse components. + surface_azimuth Azimuth angle of the surface diff --git a/docs/sphinx/source/whatsnew/v0.11.2.rst b/docs/sphinx/source/whatsnew/v0.11.2.rst index f3b1ec338a..a07f4bf43d 100644 --- a/docs/sphinx/source/whatsnew/v0.11.2.rst +++ b/docs/sphinx/source/whatsnew/v0.11.2.rst @@ -33,6 +33,10 @@ Documentation page, using the sphinx glossary directive. (:issue:`1421`, :pull:`2234`) * Explained how to write docstrings for new functions in :ref:`example-docstring` (:discussion:`2081`, :pull:`2254`) +* Added the following variables to the :ref:`nomenclature` page: + + - `spectra` and `spectra_components` (:issue:`2150`, :pull:`2264`) + Testing ~~~~~~~ diff --git a/pvlib/spectrum/irradiance.py b/pvlib/spectrum/irradiance.py index cb3e5e1ddb..14b2da27ba 100644 --- a/pvlib/spectrum/irradiance.py +++ b/pvlib/spectrum/irradiance.py @@ -189,7 +189,8 @@ def average_photon_energy(spectra): ---------- spectra : pandas.Series or pandas.DataFrame - Spectral irradiance, must be positive. [Wm⁻²nm⁻¹] + Spectral irradiance, must be positive [Wm⁻²nm⁻¹]. + See :term:`spectra`. A single spectrum must be a :py:class:`pandas.Series` with wavelength [nm] as the index, while multiple spectra must be rows in a diff --git a/pvlib/spectrum/spectrl2.py b/pvlib/spectrum/spectrl2.py index b022d79371..38739efff3 100644 --- a/pvlib/spectrum/spectrl2.py +++ b/pvlib/spectrum/spectrl2.py @@ -228,10 +228,11 @@ def spectrl2(apparent_zenith, aoi, surface_tilt, ground_albedo, Returns ------- spectra_components : dict - A dict of arrays. With the exception of `wavelength`, which has length + 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 Wm⁻²nm⁻¹, except for `wavelength`, which is in nanometers. + See :term:`spectra_components`. * wavelength * dni_extra