diff --git a/docs/sphinx/source/whatsnew/v0.7.0.rst b/docs/sphinx/source/whatsnew/v0.7.0.rst index d9045a5cfb..b5295434d8 100644 --- a/docs/sphinx/source/whatsnew/v0.7.0.rst +++ b/docs/sphinx/source/whatsnew/v0.7.0.rst @@ -21,7 +21,7 @@ API Changes old `pvsystem.sapm_celltemp` returned a `DataFrame` with both cell and module temperatures. - Created `temperature.sapm_module` to return module temperature using the SAPM temperature model. - Changed the order of arguments for`pvsystem.sapm_celltemp`, - `pvsystem.pvsyst_celltemp` and `PVSystem.sapm_celltemp` to be consistent + `pvsystem.pvsyst_celltemp` and `PVSystem.sapm_celltemp` to be consistent among cell temperature model functions. - Removed `model` as a kwarg from `temperature.sapm_cell` and `temperature.pvsyst_cell`. These functions now require model-specific parameters. @@ -35,7 +35,7 @@ API Changes 'open_rack_polymer_thinfilm_steel' and '22x_concentrator_tracker' are considered obsolete and have been removed. * Changes to `PVSystem` class - - Changed the `model` kwarg in `PVSystem.sapm_celltemp` and + - Changed the `model` kwarg in `PVSystem.sapm_celltemp` and `PVSystem.pvsyst_celltemp` to `parameter_set`. `parameter_set` expects a str which is a valid key for `temperature.TEMPERATURE_MODEL_PARAMETERS` for the corresponding temperature model. @@ -71,6 +71,15 @@ API Changes * Calling :py:func:`pvlib.pvsystem.retrieve_sam` with no parameters will raise an exception instead of displaying a dialog. +* The `times` keyword argument has been deprecated in the + :py:meth:`pvlib.modelchain.ModelChain.run_model`, + :py:meth:`pvlib.modelchain.ModelChain.prepare_inputs`, and + :py:meth:`pvlib.modelchain.ModelChain.complete_irradiance` methods. + Model times are now determined by the input `weather`. `DataFrame`. + Therefore, the `weather` DataFrame must have a `DatetimeIndex`. + The `weather` argument of the above methods is now the first, required + positional argument and the `times` argument is kept as the second keyword + argument for capability during the deprecation period. Enhancements ~~~~~~~~~~~~ @@ -114,6 +123,9 @@ Removal of prior version deprecations * Removed `atmosphere.relativeairmass`. * Removed `solarposition.get_sun_rise_set_transit`. * Removed `tmy` module. +* Removed `ModelChain.singlediode` method. +* Removed `ModelChain.prepare_inputs` clearsky assumption when no irradiance + data was provided. Contributors ~~~~~~~~~~~~ diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 92a92e2abc..6aad00c1dd 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -8,7 +8,6 @@ from functools import partial import warnings -import pandas as pd from pvlib import (atmosphere, clearsky, pvsystem, solarposition, temperature, tools) @@ -412,13 +411,6 @@ def dc_model(self, model): self._dc_model = self.pvsyst elif model == 'pvwatts': self._dc_model = self.pvwatts_dc - elif model == 'singlediode': - warnings.warn('DC model keyword singlediode used for ' - 'ModelChain object. singlediode is ' - 'ambiguous, use desoto instead. singlediode ' - 'keyword will be removed in v0.7.0 and ' - 'later', pvlibDeprecationWarning) - self._dc_model = self.desoto else: raise ValueError(model + ' is not a valid DC power model') else: @@ -480,24 +472,6 @@ def cec(self): def pvsyst(self): return self._singlediode(self.system.calcparams_pvsyst) - def singlediode(self): - """Deprecated""" - (photocurrent, saturation_current, resistance_series, - resistance_shunt, nNsVth) = ( - self.system.calcparams_desoto(self.effective_irradiance, - self.cell_temperature)) - - self.desoto = (photocurrent, saturation_current, resistance_series, - resistance_shunt, nNsVth) - - self.dc = self.system.singlediode( - photocurrent, saturation_current, resistance_series, - resistance_shunt, nNsVth) - - self.dc = self.system.scale_voltage_current_power(self.dc).fillna(0) - - return self - def pvwatts_dc(self): self.dc = self.system.pvwatts_dc(self.effective_irradiance, self.cell_temperature) @@ -746,7 +720,7 @@ def effective_irradiance_model(self): fd*self.total_irrad['poa_diffuse']) return self - def complete_irradiance(self, times=None, weather=None): + def complete_irradiance(self, weather, times=None): """ Determine the missing irradiation columns. Only two of the following data columns (dni, ghi, dhi) are needed to calculate @@ -758,19 +732,21 @@ def complete_irradiance(self, times=None, weather=None): Parameters ---------- - times : None or DatetimeIndex, default None - Times at which to evaluate the model. Can be None if - attribute `times` is already set. - weather : None or pandas.DataFrame, default None - Table with at least two columns containing one of the - following data sets: dni, dhi, ghi. Can be None if attribute - `weather` is already set. + weather : DataFrame + Column names must be ``'dni'``, ``'ghi'``, ``'dhi'``, + ``'wind_speed'``, ``'temp_air'``. All irradiance components + are required. Air temperature of 20 C and wind speed + of 0 m/s will be added to the DataFrame if not provided. + times : None, deprecated + Deprecated argument included for API compatibility, but not + used internally. The index of the weather DataFrame is used + for times. Returns ------- self - Assigns attributes: times, weather + Assigns attributes: weather Examples -------- @@ -782,19 +758,23 @@ def complete_irradiance(self, times=None, weather=None): >>> # my_weather containing 'dhi' and 'ghi'. >>> mc = ModelChain(my_system, my_location) # doctest: +SKIP - >>> mc.complete_irradiance(my_datetime, my_weather) # doctest: +SKIP - >>> mc.run_model() # doctest: +SKIP + >>> mc.complete_irradiance(my_weather) # doctest: +SKIP + >>> mc.run_model(mc.weather) # doctest: +SKIP >>> # my_weather containing 'dhi', 'ghi' and 'dni'. >>> mc = ModelChain(my_system, my_location) # doctest: +SKIP - >>> mc.run_model(my_datetime, my_weather) # doctest: +SKIP + >>> mc.run_model(my_weather) # doctest: +SKIP """ - if weather is not None: - self.weather = weather + self.weather = weather + if times is not None: - self.times = times + warnings.warn('times keyword argument is deprecated and will be ' + 'removed in 0.8. The index of the weather DataFrame ' + 'is used for times.', pvlibDeprecationWarning) + self.solar_position = self.location.get_solarposition( - self.times, method=self.solar_position_method) + self.weather.index, method=self.solar_position_method) + icolumns = set(self.weather.columns) wrn_txt = ("This function is not safe at the moment.\n" + "Results can be too high or negative.\n" + @@ -803,7 +783,7 @@ def complete_irradiance(self, times=None, weather=None): if {'ghi', 'dhi'} <= icolumns and 'dni' not in icolumns: clearsky = self.location.get_clearsky( - times, solar_position=self.solar_position) + self.weather.index, solar_position=self.solar_position) self.weather.loc[:, 'dni'] = pvlib.irradiance.dni( self.weather.loc[:, 'ghi'], self.weather.loc[:, 'dhi'], self.solar_position.zenith, @@ -822,62 +802,54 @@ def complete_irradiance(self, times=None, weather=None): return self - def prepare_inputs(self, times=None, weather=None): + def prepare_inputs(self, weather, times=None): """ Prepare the solar position, irradiance, and weather inputs to the model. Parameters ---------- - times : None or DatetimeIndex, default None - Times at which to evaluate the model. Can be None if - attribute `times` is already set. - weather : None or DataFrame, default None - If ``None``, the weather attribute is used. Column names - must be ``'dni'``, ``'ghi'``, ``'dhi'``, ``'wind_speed'``, - ``'temp_air'``. All irradiance components are required. - Assumes air temperature is 20 C and wind speed is 0 m/s if - not provided. + weather : DataFrame + Column names must be ``'dni'``, ``'ghi'``, ``'dhi'``, + ``'wind_speed'``, ``'temp_air'``. All irradiance components + are required. Air temperature of 20 C and wind speed + of 0 m/s will be added to the DataFrame if not provided. + times : None, deprecated + Deprecated argument included for API compatibility, but not + used internally. The index of the weather DataFrame is used + for times. Notes ----- - Assigns attributes: ``times``, ``solar_position``, ``airmass``, + Assigns attributes: ``solar_position``, ``airmass``, ``total_irrad``, `aoi` See also -------- ModelChain.complete_irradiance """ - if weather is not None: - self.weather = weather - if self.weather is None: - self.weather = pd.DataFrame(index=times) + + if not {'ghi', 'dni', 'dhi'} <= set(weather.columns): + raise ValueError( + "Uncompleted irradiance data set. Please check your input " + "data.\nData set needs to have 'dni', 'dhi' and 'ghi'.\n" + "Detected data: {0}".format(list(weather.columns))) + + self.weather = weather if times is not None: - self.times = times + warnings.warn('times keyword argument is deprecated and will be ' + 'removed in 0.8. The index of the weather DataFrame ' + 'is used for times.', pvlibDeprecationWarning) + + self.times = self.weather.index self.solar_position = self.location.get_solarposition( - self.times, method=self.solar_position_method) + self.weather.index, method=self.solar_position_method) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) - if not any([x in ['ghi', 'dni', 'dhi'] for x in self.weather.columns]): - warnings.warn('Clear sky assumption for no input irradiance is ' - 'deprecated and will be removed in v0.7.0. Use ' - 'location.get_clearsky instead', - pvlibDeprecationWarning) - self.weather[['ghi', 'dni', 'dhi']] = self.location.get_clearsky( - self.solar_position.index, self.clearsky_model, - solar_position=self.solar_position, - airmass_absolute=self.airmass['airmass_absolute']) - - if not {'ghi', 'dni', 'dhi'} <= set(self.weather.columns): - raise ValueError( - "Uncompleted irradiance data set. Please check your input " - "data.\nData set needs to have 'dni', 'dhi' and 'ghi'.\n" - "Detected data: {0}".format(list(self.weather.columns))) - # PVSystem.get_irradiance and SingleAxisTracker.get_irradiance # and PVSystem.get_aoi and SingleAxisTracker.get_aoi # have different method signatures. Use partial to handle @@ -921,32 +893,36 @@ def prepare_inputs(self, times=None, weather=None): self.weather['temp_air'] = 20 return self - def run_model(self, times=None, weather=None): + def run_model(self, weather, times=None): """ Run the model. Parameters ---------- - times : None or DatetimeIndex, default None - Times at which to evaluate the model. Can be None if - attribute `times` is already set. - weather : None or DataFrame, default None - If ``None``, the weather attribute is used. Column names - must be ``'dni'``, ``'ghi'``, ``'dhi'``, ``'wind_speed'``, - ``'temp_air'``. All irradiance components are required. - Assumes air temperature is 20 C and wind speed is 0 m/s if - not provided. + weather : DataFrame + Column names must be ``'dni'``, ``'ghi'``, ``'dhi'``, + ``'wind_speed'``, ``'temp_air'``. All irradiance components + are required. Air temperature of 20 C and wind speed + of 0 m/s will be added to the DataFrame if not provided. + times : None, deprecated + Deprecated argument included for API compatibility, but not + used internally. The index of the weather DataFrame is used + for times. Returns ------- self - Assigns attributes: times, solar_position, airmass, irradiance, + Assigns attributes: solar_position, airmass, irradiance, total_irrad, effective_irradiance, weather, cell_temperature, aoi, aoi_modifier, spectral_modifier, dc, ac, losses. """ + if times is not None: + warnings.warn('times keyword argument is deprecated and will be ' + 'removed in 0.8. The index of the weather DataFrame ' + 'is used for times.', pvlibDeprecationWarning) - self.prepare_inputs(times, weather) + self.prepare_inputs(weather) self.aoi_model() self.spectral_model() self.effective_irradiance_model() diff --git a/pvlib/test/test_modelchain.py b/pvlib/test/test_modelchain.py index 20a8a956bc..4623d9fe45 100644 --- a/pvlib/test/test_modelchain.py +++ b/pvlib/test/test_modelchain.py @@ -127,7 +127,7 @@ def weather(): def test_ModelChain_creation(system, location): - mc = ModelChain(system, location) + ModelChain(system, location) @pytest.mark.parametrize('strategy, expected', [ @@ -144,29 +144,50 @@ def test_orientation_strategy(strategy, expected, system, location): assert system.surface_azimuth == expected[1] -@requires_scipy -def test_run_model(system, location): +def test_run_model_with_irradiance(system, location): mc = ModelChain(system, location) times = pd.date_range('20160101 1200-0700', periods=2, freq='6H') + irradiance = pd.DataFrame({'dni': 900, 'ghi': 600, 'dhi': 150}, + index=times) + ac = mc.run_model(irradiance).ac - with pytest.warns(pvlibDeprecationWarning): - ac = mc.run_model(times).ac - - expected = pd.Series(np.array([183.522449305, -2.00000000e-02]), + expected = pd.Series(np.array([187.80746494643176, -0.02]), index=times) - assert_series_equal(ac, expected, check_less_precise=1) + assert_series_equal(ac, expected) -def test_run_model_with_irradiance(system, location): +def test_run_model_times(system, location): mc = ModelChain(system, location) times = pd.date_range('20160101 1200-0700', periods=2, freq='6H') irradiance = pd.DataFrame({'dni': 900, 'ghi': 600, 'dhi': 150}, index=times) - ac = mc.run_model(times, weather=irradiance).ac + with pytest.warns(pvlibDeprecationWarning): + mc.run_model(irradiance, times=times) - expected = pd.Series(np.array([187.80746495, -2.00000000e-02]), - index=times) - assert_series_equal(ac, expected) + +def test_prepare_inputs_times(system, location): + mc = ModelChain(system, location) + times = pd.date_range('20160101 1200-0700', periods=2, freq='6H') + irradiance = pd.DataFrame({'dni': 900, 'ghi': 600, 'dhi': 150}, + index=times) + with pytest.warns(pvlibDeprecationWarning): + mc.prepare_inputs(irradiance, times=times) + + +def test_prepare_inputs_no_irradiance(system, location): + mc = ModelChain(system, location) + weather = pd.DataFrame() + with pytest.raises(ValueError): + mc.prepare_inputs(weather) + + +@requires_tables +def test_complete_irradiance_times(system, location): + mc = ModelChain(system, location) + times = pd.date_range('20160101 1200-0700', periods=2, freq='6H') + irradiance = pd.DataFrame({'ghi': 600., 'dhi': 150.}, index=times) + with pytest.warns(pvlibDeprecationWarning): + mc.complete_irradiance(irradiance, times=times) def test_run_model_perez(system, location): @@ -174,7 +195,7 @@ def test_run_model_perez(system, location): times = pd.date_range('20160101 1200-0700', periods=2, freq='6H') irradiance = pd.DataFrame({'dni': 900, 'ghi': 600, 'dhi': 150}, index=times) - ac = mc.run_model(times, weather=irradiance).ac + ac = mc.run_model(irradiance).ac expected = pd.Series(np.array([187.94295642, -2.00000000e-02]), index=times) @@ -187,7 +208,7 @@ def test_run_model_gueymard_perez(system, location): times = pd.date_range('20160101 1200-0700', periods=2, freq='6H') irradiance = pd.DataFrame({'dni': 900, 'ghi': 600, 'dhi': 150}, index=times) - ac = mc.run_model(times, weather=irradiance).ac + ac = mc.run_model(irradiance).ac expected = pd.Series(np.array([187.94317405, -2.00000000e-02]), index=times) @@ -203,7 +224,7 @@ def test_run_model_with_weather(system, location, weather, mocker): mc = ModelChain(system, location) mc.temperature_model = 'sapm' m_sapm = mocker.spy(system, 'sapm_celltemp') - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m_sapm.call_count == 1 # assert_called_once_with cannot be used with series, so need to use # assert_series_equal on call_args @@ -217,7 +238,7 @@ def test_run_model_with_weather(system, location, weather, mocker): mc = ModelChain(system, location) mc.temperature_model = 'pvsyst' m_pvsyst = mocker.spy(system, 'pvsyst_celltemp') - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m_pvsyst.call_count == 1 assert_series_equal(m_pvsyst.call_args[0][1], weather['temp_air']) assert_series_equal(m_pvsyst.call_args[0][2], weather['wind_speed']) @@ -231,7 +252,7 @@ def test_run_model_tracker(system, location, weather, mocker): inverter_parameters=system.inverter_parameters) mocker.spy(system, 'singleaxis') mc = ModelChain(system, location) - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert system.singleaxis.call_count == 1 assert (mc.tracking.columns == ['tracker_theta', 'aoi', 'surface_azimuth', 'surface_tilt']).all() @@ -284,7 +305,7 @@ def test_infer_dc_model(system, cec_dc_snl_ac_system, pvsyst_dc_snl_ac_system, mc = ModelChain(system, location, aoi_model='no_loss', spectral_model='no_loss', temperature_model=temp_model_function[dc_model]) - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 1 assert isinstance(mc.dc, (pd.Series, pd.DataFrame)) @@ -338,7 +359,7 @@ def test_dc_model_user_func(pvwatts_dc_pvwatts_ac_system, location, weather, m = mocker.spy(sys.modules[__name__], 'poadc') mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, dc_model=poadc, aoi_model='no_loss', spectral_model='no_loss') - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 1 assert isinstance(mc.ac, (pd.Series, pd.DataFrame)) assert not mc.ac.empty @@ -362,7 +383,7 @@ def test_ac_models(system, cec_dc_adr_ac_system, pvwatts_dc_pvwatts_ac_system, if ac_model == 'pvwatts': ac_model += '_ac' m = mocker.spy(system, ac_model) - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 1 assert isinstance(mc.ac, pd.Series) assert not mc.ac.empty @@ -374,7 +395,7 @@ def test_ac_model_user_func(pvwatts_dc_pvwatts_ac_system, location, weather, m = mocker.spy(sys.modules[__name__], 'acdc') mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, ac_model=acdc, aoi_model='no_loss', spectral_model='no_loss') - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 1 assert_series_equal(mc.ac, mc.dc) assert not mc.ac.empty @@ -391,7 +412,7 @@ def test_aoi_models(system, location, aoi_model, method, weather, mocker): mc = ModelChain(system, location, dc_model='sapm', aoi_model=aoi_model, spectral_model='no_loss') m = mocker.spy(system, method) - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 1 assert isinstance(mc.ac, pd.Series) assert not mc.ac.empty @@ -402,7 +423,7 @@ def test_aoi_models(system, location, aoi_model, method, weather, mocker): def test_aoi_model_no_loss(system, location, weather): mc = ModelChain(system, location, dc_model='sapm', aoi_model='no_loss', spectral_model='no_loss') - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert mc.aoi_modifier == 1.0 assert not mc.ac.empty assert mc.ac[0] > 150 and mc.ac[0] < 200 @@ -413,7 +434,7 @@ def test_aoi_model_user_func(system, location, weather, mocker): m = mocker.spy(sys.modules[__name__], 'constant_aoi_loss') mc = ModelChain(system, location, dc_model='sapm', aoi_model=constant_aoi_loss, spectral_model='no_loss') - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 1 assert mc.aoi_modifier == 0.9 assert not mc.ac.empty @@ -434,8 +455,7 @@ def test_spectral_models(system, location, spectral_model, weather): weather['precipitable_water'] = [0.3, 0.5] mc = ModelChain(system, location, dc_model='sapm', aoi_model='no_loss', spectral_model=spectral_model) - spectral_modifier = mc.run_model(times=weather.index, - weather=weather).spectral_modifier + spectral_modifier = mc.run_model(weather).spectral_modifier assert isinstance(spectral_modifier, (pd.Series, float, int)) @@ -452,7 +472,7 @@ def test_losses_models_pvwatts(pvwatts_dc_pvwatts_ac_system, location, weather, mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, dc_model='pvwatts', aoi_model='no_loss', spectral_model='no_loss', losses_model='pvwatts') - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 1 m.assert_called_with(age=age) assert isinstance(mc.ac, (pd.Series, pd.DataFrame)) @@ -463,7 +483,7 @@ def test_losses_models_pvwatts(pvwatts_dc_pvwatts_ac_system, location, weather, mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, dc_model='pvwatts', aoi_model='no_loss', spectral_model='no_loss', losses_model='no_loss') - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert not np.allclose(mc.dc, dc_with_loss, equal_nan=True) @@ -473,7 +493,7 @@ def test_losses_models_ext_def(pvwatts_dc_pvwatts_ac_system, location, weather, mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, dc_model='pvwatts', aoi_model='no_loss', spectral_model='no_loss', losses_model=constant_losses) - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 1 assert isinstance(mc.ac, (pd.Series, pd.DataFrame)) assert mc.losses == 0.9 @@ -487,7 +507,7 @@ def test_losses_models_no_loss(pvwatts_dc_pvwatts_ac_system, location, weather, aoi_model='no_loss', spectral_model='no_loss', losses_model='no_loss') assert mc.losses_model == mc.no_extra_losses - mc.run_model(weather.index, weather=weather) + mc.run_model(weather) assert m.call_count == 0 assert mc.losses == 1 @@ -531,24 +551,6 @@ def test_bad_get_orientation(): modelchain.get_orientation('bad value') -@fail_on_pvlib_version('0.7') -def test_deprecated_07(): - # explicit system creation call because fail_on_pvlib_version - # does not support decorators. - # does not matter what the parameters are, just fake it until we make it - module_parameters = {'R_sh_ref': 1, 'a_ref': 1, 'I_o_ref': 1, - 'alpha_sc': 1, 'I_L_ref': 1, 'R_s': 1} - temp_model_params = {'a': -3.5, 'b': -0.05, 'deltaT': 3} - system = PVSystem(module_parameters=module_parameters, - temperature_model_parameters=temp_model_params) - with pytest.warns(pvlibDeprecationWarning): - ModelChain(system, location, - dc_model='singlediode', # this should fail after 0.7 - aoi_model='no_loss', spectral_model='no_loss', - temperature_model='sapm', - ac_model='snlinverter') - - @fail_on_pvlib_version('0.8') def test_deprecated_08(): # explicit system creation call because fail_on_pvlib_version @@ -582,23 +584,6 @@ def test_deprecated_08(): ac_model='snlinverter') -@requires_tables -@fail_on_pvlib_version('0.7') -def test_deprecated_clearsky_07(): - # explicit system creation call because fail_on_pvlib_version - # does not support decorators. - system = PVSystem(module_parameters={'pdc0': 1, 'gamma_pdc': -0.003}, - temperature_model_parameters={'a': -3.5, 'b': -0.05, - 'deltaT': 3}) - location = Location(32.2, -110.9) - mc = ModelChain(system, location, dc_model='pvwatts', ac_model='pvwatts', - aoi_model='no_loss', spectral_model='no_loss') - times = pd.date_range(start='20160101 1200-0700', - end='20160101 1800-0700', freq='6H') - with pytest.warns(pvlibDeprecationWarning): - mc.prepare_inputs(times=times) - - @requires_scipy def test_basic_chain_required(sam_data, cec_inverter_parameters, sapm_temperature_cs5p_220m): @@ -635,7 +620,7 @@ def test_basic_chain_alt_az(sam_data, cec_inverter_parameters, surface_tilt=surface_tilt, surface_azimuth=surface_azimuth) - expected = pd.Series(np.array([ 115.40352679, -2.00000000e-02]), + expected = pd.Series(np.array([115.40352679, -2.00000000e-02]), index=times) assert_series_equal(ac, expected, check_less_precise=1) @@ -656,7 +641,7 @@ def test_basic_chain_strategy(sam_data, cec_inverter_parameters, cec_inverter_parameters, orientation_strategy='south_at_latitude_tilt', altitude=altitude) - expected = pd.Series(np.array([ 183.522449305, -2.00000000e-02]), + expected = pd.Series(np.array([183.522449305, -2.00000000e-02]), index=times) assert_series_equal(ac, expected, check_less_precise=1) @@ -681,7 +666,7 @@ def test_basic_chain_altitude_pressure(sam_data, cec_inverter_parameters, surface_azimuth=surface_azimuth, pressure=93194) - expected = pd.Series(np.array([ 116.595664887, -2.00000000e-02]), + expected = pd.Series(np.array([116.595664887, -2.00000000e-02]), index=times) assert_series_equal(ac, expected, check_less_precise=1) @@ -692,7 +677,7 @@ def test_basic_chain_altitude_pressure(sam_data, cec_inverter_parameters, surface_azimuth=surface_azimuth, altitude=altitude) - expected = pd.Series(np.array([ 116.595664887, -2.00000000e-02]), + expected = pd.Series(np.array([116.595664887, -2.00000000e-02]), index=times) assert_series_equal(ac, expected, check_less_precise=1) @@ -732,7 +717,7 @@ def test_complete_irradiance_clean_run(system, location): i = pd.DataFrame( {'dni': [2, 3], 'dhi': [4, 6], 'ghi': [9, 5]}, index=times) - mc.complete_irradiance(times, weather=i) + mc.complete_irradiance(i) assert_series_equal(mc.weather['dni'], pd.Series([2, 3], index=times, name='dni')) @@ -752,18 +737,18 @@ def test_complete_irradiance(system, location): 'dhi': [356.543700, 465.44400]}, index=times) with pytest.warns(UserWarning): - mc.complete_irradiance(times, weather=i[['ghi', 'dni']]) + mc.complete_irradiance(i[['ghi', 'dni']]) assert_series_equal(mc.weather['dhi'], pd.Series([356.543700, 465.44400], index=times, name='dhi')) with pytest.warns(UserWarning): - mc.complete_irradiance(times, weather=i[['dhi', 'dni']]) + mc.complete_irradiance(i[['dhi', 'dni']]) assert_series_equal(mc.weather['ghi'], pd.Series([372.103976116, 497.087579068], index=times, name='ghi')) - mc.complete_irradiance(times, weather=i[['dhi', 'ghi']]) + mc.complete_irradiance(i[['dhi', 'ghi']]) assert_series_equal(mc.weather['dni'], pd.Series([49.756966, 62.153947], index=times, name='dni'))