Repository: pvlib/pvlib-python

Issue:
PVSPEC model coefficients for First Solar modules use wrong keys
**Describe the bug**
The function pvlib.spectrum.mismatch.spectral_factor_pvspec has a dictionary of coefficients. These have incorrect keys for the two types of First Solar modules. module types for these are 'fs4-1' and 'fs4-2', but the coefficients have keys 'fs-2' and 'fs-4', which should be 'fs4-2' and 'fs4-1', respectively.

**To Reproduce**
Steps to reproduce the behavior:
1. Try running:
        test=pvlib.spectrum.mismatch.spectral_factor_pvspec(airmass_absolute = 1.5, clearsky_index = 1, module_type='fs4-1')
or
        test=pvlib.spectrum.mismatch.spectral_factor_pvspec(airmass_absolute = 1.5, clearsky_index = 1, module_type='fs4-2')

In both cases you should get an error. For example:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\spelland\.venv\spectral_env\Lib\site-packages\pvlib\spectrum\mismatch.py", line 585, in spectral_factor_pvspec
    coefficients = _coefficients[module_type.lower()]
                   ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: 'fs4-1'
 
2.  If you run with one of the other module types, there should be no error. e.g:                                                      test_that_works =pvlib.spectrum.mismatch.spectral_factor_pvspec(airmass_absolute = 1.5, clearsky_index = 1, module_type='monosi')

Hints from issue comments:
@cwhanse: Confirmed, thanks @sophie-pelland 

Solution patch:
diff --git a/docs/sphinx/source/whatsnew/v0.11.3.rst b/docs/sphinx/source/whatsnew/v0.11.3.rst
index 6363275..abb9f68 100644
--- a/docs/sphinx/source/whatsnew/v0.11.3.rst
+++ b/docs/sphinx/source/whatsnew/v0.11.3.rst
@@ -16,6 +16,7 @@ Enhancements
   ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`)
 * Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported
   using the `from pvlib.transformer` syntax (:pull:`2388`)
+* Correct keys for First Solar modules in `~pvlib.spectrum.spectral_factor_pvspec` (:issue:`2398`, :pull:`2400`)
 
 Documentation
 ~~~~~~~~~~~~~
diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py
index 3afc210..980f0d0 100644
--- a/pvlib/spectrum/mismatch.py
+++ b/pvlib/spectrum/mismatch.py
@@ -520,7 +520,7 @@ def spectral_factor_pvspec(airmass_absolute, clearsky_index,
         One of the following PV technology strings from [1]_:
 
         * ``'fs4-1'`` - First Solar series 4-1 and earlier CdTe module.
-        * ``'fs4-2'`` - First Solar 4-2 and later CdTe module.
+        * ``'fs4-2'`` - First Solar series 4-2 and later CdTe module.
         * ``'monosi'`` - anonymous monocrystalline Si module.
         * ``'multisi'`` - anonymous multicrystalline Si module.
         * ``'cigs'`` - anonymous copper indium gallium selenide module.
@@ -576,8 +576,8 @@ def spectral_factor_pvspec(airmass_absolute, clearsky_index,
     _coefficients = {}
     _coefficients['multisi'] = (0.9847, -0.05237, 0.03034)
     _coefficients['monosi'] = (0.9845, -0.05169, 0.03034)
-    _coefficients['fs-2'] = (1.002, -0.07108, 0.02465)
-    _coefficients['fs-4'] = (0.9981, -0.05776, 0.02336)
+    _coefficients['fs4-2'] = (1.002, -0.07108, 0.02465)
+    _coefficients['fs4-1'] = (0.9981, -0.05776, 0.02336)
     _coefficients['cigs'] = (0.9791, -0.03904, 0.03096)
     _coefficients['asi'] = (1.051, -0.1033, 0.009838)
 


Test patch:
diff --git a/pvlib/tests/spectrum/test_mismatch.py b/pvlib/tests/spectrum/test_mismatch.py
index 5397a81..ed22577 100644
--- a/pvlib/tests/spectrum/test_mismatch.py
+++ b/pvlib/tests/spectrum/test_mismatch.py
@@ -202,8 +202,8 @@ def test_spectral_factor_caballero_supplied_ambiguous():
 
 @pytest.mark.parametrize("module_type,expected", [
     ('asi', np.array([1.15534029, 1.1123772, 1.08286684, 1.01915462])),
-    ('fs-2', np.array([1.0694323, 1.04948777, 1.03556288, 0.9881471])),
-    ('fs-4', np.array([1.05234725, 1.037771, 1.0275516, 0.98820533])),
+    ('fs4-2', np.array([1.0694323, 1.04948777, 1.03556288, 0.9881471])),
+    ('fs4-1', np.array([1.05234725, 1.037771, 1.0275516, 0.98820533])),
     ('multisi', np.array([1.03310403, 1.02391703, 1.01744833, 0.97947605])),
     ('monosi', np.array([1.03225083, 1.02335353, 1.01708734, 0.97950110])),
     ('cigs', np.array([1.01475834, 1.01143927, 1.00909094, 0.97852966])),
@@ -218,8 +218,8 @@ def test_spectral_factor_pvspec(module_type, expected):
 
 @pytest.mark.parametrize("module_type,expected", [
     ('asi', pd.Series([1.15534029, 1.1123772, 1.08286684, 1.01915462])),
-    ('fs-2', pd.Series([1.0694323, 1.04948777, 1.03556288, 0.9881471])),
-    ('fs-4', pd.Series([1.05234725, 1.037771, 1.0275516, 0.98820533])),
+    ('fs4-2', pd.Series([1.0694323, 1.04948777, 1.03556288, 0.9881471])),
+    ('fs4-1', pd.Series([1.05234725, 1.037771, 1.0275516, 0.98820533])),
     ('multisi', pd.Series([1.03310403, 1.02391703, 1.01744833, 0.97947605])),
     ('monosi', pd.Series([1.03225083, 1.02335353, 1.01708734, 0.97950110])),
     ('cigs', pd.Series([1.01475834, 1.01143927, 1.00909094, 0.97852966])),