Skip to content

Commit f06bbf4

Browse files
committed
Update modelchain.py
1 parent 49acea8 commit f06bbf4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pvlib/modelchain.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ class ModelChain:
330330
'interp' and 'no_loss'. The ModelChain instance will be passed as the
331331
first argument to a user-defined function.
332332
333-
spectral_model : str or function, default ``'no_loss'``
333+
spectral_model : str or function, optional
334334
Valid strings are:
335335
336336
- ``'sapm'``
@@ -340,6 +340,8 @@ class ModelChain:
340340
The ModelChain instance will be passed as the first argument to
341341
a user-defined function.
342342
343+
By default, it will be inferred from the system attributes only.
344+
343345
See :py:func:`~pvlib.modelchain.ModelChain.infer_spectral_model` to
344346
infer the spectral model from system and weather information.
345347
@@ -367,7 +369,7 @@ def __init__(self, system, location,
367369
solar_position_method='nrel_numpy',
368370
airmass_model='kastenyoung1989',
369371
dc_model=None, ac_model=None, aoi_model=None,
370-
spectral_model='no_loss', temperature_model=None,
372+
spectral_model=None, temperature_model=None,
371373
dc_ohmic_model='no_loss',
372374
losses_model='no_loss', name=None):
373375

@@ -870,6 +872,8 @@ def spectral_model(self, model):
870872
self._spectral_model = self.no_spectral_loss
871873
else:
872874
raise ValueError(model + ' is not a valid spectral loss model')
875+
elif model is None:
876+
self._spectral_model = self.infer_spectral_model(weather=None)
873877
else:
874878
self._spectral_model = partial(model, self)
875879

0 commit comments

Comments
 (0)