From dd7795fe4bd85d4a6c2bdba6411c12f1a3834ab4 Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Tue, 24 Nov 2026 08:31:14 -0700 Subject: [PATCH 1/5] don't infer for Thin Film --- docs/sphinx/source/whatsnew/v0.16.2.rst | 6 ++++++ pvlib/pvsystem.py | 10 ++++++++-- tests/test_pvsystem.py | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.16.2.rst b/docs/sphinx/source/whatsnew/v0.16.2.rst index fb3ff54f76..5b68292a8d 100644 --- a/docs/sphinx/source/whatsnew/v0.16.2.rst +++ b/docs/sphinx/source/whatsnew/v0.16.2.rst @@ -6,6 +6,12 @@ v0.16.2 (Anticipated December, 2026) Breaking Changes ~~~~~~~~~~~~~~~~ +* ``ModelChain`` no longer infers cell type for modules in the CEC database + with Technology of 'Thin Film'. Previously cell type 'cigs' was assigned + for all such modules, which is incorrect for some. Cell type is used to + infer default parameters for :py:func:`pvlib.spectrum.spectral_factor_firstsolar` + Users should assign spectral model parameters in ``PVSystem.module_parameters`` + or set ``PVSystem.Technology`` to the correct cell type. Deprecations diff --git a/pvlib/pvsystem.py b/pvlib/pvsystem.py index 79d8a58d11..bbc9a59158 100644 --- a/pvlib/pvsystem.py +++ b/pvlib/pvsystem.py @@ -774,7 +774,13 @@ def _spectral_correction(array, pw): else: module_type = array._infer_cell_type() coefficients = None - + if (module_type is None): + msg = ( + "No parameters provided for the First Solar", + " spectral model and pvlib could not infer spectral model", + "parameters from the module parameters." + ) + raise ValueError(msg) return spectrum.spectral_factor_firstsolar( pw, airmass_absolute, module_type, coefficients ) @@ -1090,7 +1096,7 @@ def _infer_cell_type(self): _cell_type_dict = {'Multi-c-Si': 'multisi', 'Mono-c-Si': 'monosi', - 'Thin Film': 'cigs', + 'Thin Film': None, 'a-Si/nc': 'asi', 'CIS': 'cigs', 'CIGS': 'cigs', diff --git a/tests/test_pvsystem.py b/tests/test_pvsystem.py index 71a515ab03..e134c3fbe8 100644 --- a/tests/test_pvsystem.py +++ b/tests/test_pvsystem.py @@ -385,6 +385,14 @@ def test_PVSystem_multi_array_first_solar_spectral_loss(): assert loss_one == loss_two +def test_PVSsytem_first_solar_spectral_loss_error(): + module_parameters = {'Technology': 'Thin Film'} # returns None + system = pvsystem.PVSystem(module_parameters=module_parameters) + with pytest.raises(ValueError, + match='No parameters provided for the First Solar'): + system.first_solar_spectral_loss(3, 3) + + @pytest.mark.parametrize('test_input,expected', [ ([1000, 100, 5, 45], 1140.0510967821877), ([np.array([np.nan, 1000, 1000]), @@ -842,6 +850,12 @@ def test_Array__infer_cell_type(): array = pvsystem.Array(mount=pvsystem.FixedMount(0, 180), module_parameters={}) assert array._infer_cell_type() is None + array = pvsystem.Array(mount=pvsystem.FixedMount(0, 180), + module_parameters={'Technology': 'Thin Film'}) + assert array._infer_cell_type() is None + array = pvsystem.Array(mount=pvsystem.FixedMount(0, 180), + module_parameters={'Technology': 'Multi-c-Si'}) + assert array._infer_cell_type()=='multisi' def _calcparams_correct_Python_type_numeric_type_cases(): From da623b106567e5d8d287a75c157cf8a5b22e5e10 Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Tue, 24 Nov 2026 13:56:24 -0700 Subject: [PATCH 2/5] formatting --- pvlib/pvsystem.py | 7 +++---- tests/test_pvsystem.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pvlib/pvsystem.py b/pvlib/pvsystem.py index bbc9a59158..a6d62c2988 100644 --- a/pvlib/pvsystem.py +++ b/pvlib/pvsystem.py @@ -776,10 +776,9 @@ def _spectral_correction(array, pw): coefficients = None if (module_type is None): msg = ( - "No parameters provided for the First Solar", - " spectral model and pvlib could not infer spectral model", - "parameters from the module parameters." - ) + "No parameters provided for the First Solar spectral", + " model and pvlib could not infer spectral model", + " parameters from the module parameters.") raise ValueError(msg) return spectrum.spectral_factor_firstsolar( pw, airmass_absolute, module_type, coefficients diff --git a/tests/test_pvsystem.py b/tests/test_pvsystem.py index e134c3fbe8..4aa4fa7d65 100644 --- a/tests/test_pvsystem.py +++ b/tests/test_pvsystem.py @@ -855,7 +855,7 @@ def test_Array__infer_cell_type(): assert array._infer_cell_type() is None array = pvsystem.Array(mount=pvsystem.FixedMount(0, 180), module_parameters={'Technology': 'Multi-c-Si'}) - assert array._infer_cell_type()=='multisi' + assert array._infer_cell_type() == 'multisi' def _calcparams_correct_Python_type_numeric_type_cases(): From 17595632a65e09c0c28acaed835420f519fad764 Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Tue, 24 Nov 2026 17:58:41 -0700 Subject: [PATCH 3/5] v0.17.0 --- docs/sphinx/source/whatsnew/v0.17.0.rst | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 docs/sphinx/source/whatsnew/v0.17.0.rst diff --git a/docs/sphinx/source/whatsnew/v0.17.0.rst b/docs/sphinx/source/whatsnew/v0.17.0.rst new file mode 100644 index 0000000000..b7f5b698d7 --- /dev/null +++ b/docs/sphinx/source/whatsnew/v0.17.0.rst @@ -0,0 +1,50 @@ +.. _whatsnew_0_X_Y: + + +v0.X.Y (Month XX, 20YY) +----------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ +* ``ModelChain`` no longer infers cell type for modules in the CEC database + with Technology of 'Thin Film'. Previously cell type 'cigs' was assigned + for all such modules, which is incorrect for some. Cell type is used to + infer default parameters for :py:func:`pvlib.spectrum.spectral_factor_firstsolar` + Users should assign spectral model parameters in ``PVSystem.module_parameters`` + or set ``PVSystem.Technology`` to the correct cell type. + +Deprecations +~~~~~~~~~~~~ + + +Bug fixes +~~~~~~~~~ + + +Enhancements +~~~~~~~~~~~~ + + +Documentation +~~~~~~~~~~~~~ + + +Testing +~~~~~~~ + + +Benchmarking +~~~~~~~~~~~~ + + +Requirements +~~~~~~~~~~~~ + + +Maintenance +~~~~~~~~~~~ + + +Contributors +~~~~~~~~~~~~ +* Cliff Hansen (:ghuser:`cwhanse`) From 46a81fb094e7e97bb5720c2285ff5b9b748aa9bb Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Tue, 24 Nov 2026 18:01:47 -0700 Subject: [PATCH 4/5] put v0.16.2 back --- docs/sphinx/source/whatsnew/v0.16.2.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.16.2.rst b/docs/sphinx/source/whatsnew/v0.16.2.rst index 5b68292a8d..fb3ff54f76 100644 --- a/docs/sphinx/source/whatsnew/v0.16.2.rst +++ b/docs/sphinx/source/whatsnew/v0.16.2.rst @@ -6,12 +6,6 @@ v0.16.2 (Anticipated December, 2026) Breaking Changes ~~~~~~~~~~~~~~~~ -* ``ModelChain`` no longer infers cell type for modules in the CEC database - with Technology of 'Thin Film'. Previously cell type 'cigs' was assigned - for all such modules, which is incorrect for some. Cell type is used to - infer default parameters for :py:func:`pvlib.spectrum.spectral_factor_firstsolar` - Users should assign spectral model parameters in ``PVSystem.module_parameters`` - or set ``PVSystem.Technology`` to the correct cell type. Deprecations From ffc235d47c107d09b8cf675bd2e99b73ece82e4b Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Fri, 27 Nov 2026 08:09:46 -0700 Subject: [PATCH 5/5] Update pvlib/pvsystem.py Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com> --- pvlib/pvsystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/pvsystem.py b/pvlib/pvsystem.py index a6d62c2988..d3419c0e40 100644 --- a/pvlib/pvsystem.py +++ b/pvlib/pvsystem.py @@ -1095,7 +1095,7 @@ def _infer_cell_type(self): _cell_type_dict = {'Multi-c-Si': 'multisi', 'Mono-c-Si': 'monosi', - 'Thin Film': None, + 'Thin Film': None, # mixes CIGS & CdTe GH#1984 'a-Si/nc': 'asi', 'CIS': 'cigs', 'CIGS': 'cigs',