@@ -340,9 +340,6 @@ class ModelChain:
340340 The ModelChain instance will be passed as the first argument to
341341 a user-defined function.
342342
343- See :py:func:`~pvlib.modelchain.ModelChain.infer_spectral_model` to
344- get a list of available spectral models for the current system.
345-
346343 temperature_model : str or function, optional
347344 Valid strings are: 'sapm', 'pvsyst', 'faiman', 'fuentes', 'noct_sam'.
348345 The ModelChain instance will be passed as the first argument to a
@@ -876,72 +873,6 @@ def spectral_model(self, model):
876873 else : # assume model is callable with 1st argument = the MC instance
877874 self ._spectral_model = partial (model , self )
878875
879- def infer_spectral_model (self , weather = None ):
880- """
881- Return a spectral model key or a list of possible spectral models based
882- on the system attributes and weather data. If the weather data is not
883- provided, the spectral model will be inferred from the system
884- attributes only.
885-
886- Parameters
887- ----------
888- weather : pd.DataFrame or collection of str, optional
889- An object with columns of available input data to help infer
890- the spectral model. If ``None``, the spectral model will be
891- inferred from the system attributes only.
892-
893- Returns
894- -------
895- Inferred spectral correction model : string key or list of string keys
896- If no spectral model is inferred, 'no_loss' is returned.
897- If only one spectral model is inferred, a string key is returned.
898- If multiple spectral models are inferred, a list of string keys is
899- returned.
900-
901- The following spectral models keys may be returned:
902-
903- - ``'sapm'`` for
904- :py:func:`~pvlib.spectrum.spectral_factor_sapm`
905- - ``'first_solar'`` for
906- :py:func:`~pvlib.spectrum.spectral_factor_first_solar`.
907- Requires ``'precipitable_water'`` in the weather dataframe.
908-
909- If no spectral model is inferred, 'no_loss' is returned.
910-
911- Examples
912- --------
913- >>> mc = ModelChain(system, location)
914- >>> mc.spectral_model = mc.infer_spectral_model(weather=weather)
915- """
916- possible_models_result = [] # list of possible spectral models
917- module_parameters = tuple (
918- array .module_parameters for array in self .system .arrays
919- )
920- params = _common_keys (module_parameters )
921-
922- # infer all the possible spectral models and append them to the list
923- if {"A4" , "A3" , "A2" , "A1" , "A0" } <= params :
924- possible_models_result .append ("sapm" )
925- if weather is not None : # models that depend on weather data
926- if "precipitable_water" in weather :
927- if "first_solar_spectral_coefficients" in params :
928- # user explicitly sets first solar spectral coefficients
929- possible_models_result .append ("first_solar" )
930- # cell type is known or can be inferred
931- if ("Technology" in params or "Material" in params ) and (
932- self .system ._infer_cell_type () is not None
933- ):
934- possible_models_result .append ("first_solar" )
935-
936- # result resolution based on the number of inferred spectral models
937- if (result_len := len (possible_models_result )) == 0 :
938- # if no spectral model is inferred, return no_loss
939- return "no_loss"
940- elif result_len == 1 :
941- # when only one spectral model is inferred, return it
942- return possible_models_result [0 ]
943- else : # multiple spectral models are inferred (avoiding duplicates)
944- return list (set (possible_models_result ))
945876
946877 def first_solar_spectral_loss (self ):
947878 self .results .spectral_modifier = self .system .first_solar_spectral_loss (
0 commit comments