예제 #1
0
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)
예제 #2
0
def test_prepare_inputs_missing_irrad_component(
        sapm_dc_snl_ac_system, location, missing):
    mc = ModelChain(sapm_dc_snl_ac_system, location)
    weather = pd.DataFrame({'dhi': [1, 2], 'dni': [1, 2], 'ghi': [1, 2]})
    weather.drop(columns=missing, inplace=True)
    with pytest.raises(ValueError):
        mc.prepare_inputs(weather)
예제 #3
0
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})
    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)
예제 #4
0
def test_prepare_inputs_no_irradiance(system, location):
    mc = ModelChain(system, location)
    weather = pd.DataFrame()
    with pytest.raises(ValueError):
        mc.prepare_inputs(weather)