Ejemplo n.º 1
0
def test_reno_large_interval(quadratic):
    """clearsky.reno() raises ValueError if timestamp spacing too large."""
    index = pd.date_range(start='04/03/2020', freq='20T',
                          periods=len(quadratic))
    quadratic.index = index
    with pytest.raises(ValueError):
        clearsky.reno(quadratic, quadratic)
Ejemplo n.º 2
0
def test_reno_identical(quadratic):
    """Identical clearsky and measured irradiance all True"""
    index = pd.date_range(start='04/03/2020',
                          freq='15T',
                          periods=len(quadratic))
    quadratic.index = index
    assert clearsky.reno(quadratic, quadratic).all()
Ejemplo n.º 3
0
def test_reno_begining_end(quadratic):
    """clearsky conditions except in the middle of the dataset"""
    index = pd.date_range(start='03/03/2020', freq='15T',
                          periods=len(quadratic))
    quadratic.index = index
    ghi = quadratic.copy()
    ghi.iloc[20:31] *= 0.5
    ghi.iloc[31:41] = 0
    clear_times = clearsky.reno(ghi, quadratic)
    assert clear_times[0:20].all()
    assert not clear_times[21:40].any()
    assert clear_times[41:].all()
Ejemplo n.º 4
0
pvanalytics_dir = pathlib.Path(pvanalytics.__file__).parent
ghi_file = pvanalytics_dir / 'data' / 'midc_bms_ghi_20220120.csv'
data = pd.read_csv(ghi_file, index_col=0, parse_dates=True)

# or you can fetch the data straight from the source using pvlib:
# date = pd.to_datetime('2022-01-20')
# data = pvlib.iotools.read_midc_raw_data_from_nrel('BMS', date, date)

measured_ghi = data['Global CMP22 (vent/cor) [W/m^2]']

# %%
# Now model clear-sky irradiance for the location and times of the
# measured data:

location = pvlib.location.Location(39.742, -105.18)
clearsky = location.get_clearsky(data.index)
clearsky_ghi = clearsky['ghi']

# %%
# Finally, use :py:func:`pvanalytics.features.clearsky.reno` to identify
# measurements during clear-sky conditions:

is_clearsky = reno(measured_ghi, clearsky_ghi)

# clear-sky times indicated in black
measured_ghi.plot()
measured_ghi[is_clearsky].plot(ls='', marker='o', ms=2, c='k')
plt.ylabel('Global Horizontal Irradiance [W/m2]')
plt.show()