Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/sphinx/source/whatsnew/v0.17.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.. _whatsnew_0_X_Y:


v0.X.Y (Month XX, 20YY)
-----------------------

Breaking Changes
~~~~~~~~~~~~~~~~
* ``ModelChain`` no longer fills NaN with 0 in DC power and AC power.
(:issue:`1409`, :pull:`2955`)

Deprecations
~~~~~~~~~~~~


Bug fixes
~~~~~~~~~


Enhancements
~~~~~~~~~~~~


Documentation
~~~~~~~~~~~~~


Testing
~~~~~~~


Benchmarking
~~~~~~~~~~~~


Requirements
~~~~~~~~~~~~


Maintenance
~~~~~~~~~~~


Contributors
~~~~~~~~~~~~
* Cliff Hansen (:ghuser:`cwhanse`)
4 changes: 1 addition & 3 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ def _make_diode_params(photocurrent, saturation_current,
self.results.dc,
unwrap=False
)
self.results.dc = tuple(dc.fillna(0) for dc in self.results.dc)
# If the system has one Array, unwrap the single return value
# to preserve the original behavior of ModelChain
if self.system.num_arrays == 1:
Expand Down Expand Up @@ -726,8 +725,7 @@ def adr_inverter(self):
return self

def pvwatts_inverter(self):
ac = self.system.get_ac('pvwatts', self.results.dc)
self.results.ac = ac.fillna(0)
self.results.ac = self.system.get_ac('pvwatts', self.results.dc)
return self

@property
Expand Down
34 changes: 34 additions & 0 deletions tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,40 @@ def test_singlediode_dc_arrays(location, dc_model,
assert isinstance(dc, (pd.Series, pd.DataFrame))


@pytest.mark.parametrize('case', ['cec_dc', 'pvwatts_ac'])
def test_nan_policy(location, case, cec_dc_snl_ac_arrays,
pvwatts_dc_pvwatts_ac_system_arrays):
times = pd.date_range('20160101 1200-0700', periods=2, freq='6h')
weather = pd.DataFrame({'ghi': [500, np.nan],
'dni': [800, 0], 'dhi': [100, 0]},
index=times)
temp_model_params = {'a': -3.40641, 'b': -0.0842075, 'deltaT': 3}
temp_model = 'sapm'
cases = {'cec_dc': cec_dc_snl_ac_arrays,
'pvwatts_ac': pvwatts_dc_pvwatts_ac_system_arrays}
system = cases[case]
for array in system.arrays:
array.temperature_model_parameters = temp_model_params
mc = ModelChain(system, location,
aoi_model='no_loss', spectral_model='no_loss',
temperature_model=temp_model)
mc.run_model(weather)
assert isinstance(mc.results.dc, tuple)
assert len(mc.results.dc) == system.num_arrays
# check each array
for dc in mc.results.dc:
# ghi is NaN at 2nd time step, all DC outputs should be NaN
if isinstance(dc, pd.DataFrame):
assert (dc.iloc[1, :].isna()).all()
elif isinstance(dc, pd.Series):
assert np.isnan(dc.iloc[1])
else:
assert False
assert isinstance(mc.results.ac, (pd.Series))
# ghi is NaN at 2nd time step, AC output should be NaN
assert np.isnan(mc.results.ac.iloc[1])


@pytest.mark.parametrize('temp_model', [
'sapm_temp', 'faiman_temp', 'pvsyst_temp', 'fuentes_temp',
'noct_sam_temp'])
Expand Down
Loading