def test_kimber_initial_soil(greensboro_rain, expected_kimber_initial_soil): """Test Kimber soiling model with initial soiling""" # a year with no rain norain = pd.Series(0, index=greensboro_rain.index) # calculate soiling with no rain norain = kimber(norain, initial_soiling=0.1) # test no rain, soiling reaches maximum assert np.allclose(norain.values, expected_kimber_initial_soil)
def test_kimber_nowash(greensboro_rain, expected_kimber_nowash): """Test Kimber soiling model with no manual washes""" # Greensboro typical expected annual rainfall is 8345mm assert greensboro_rain.sum() == 8345 # calculate soiling with no wash dates nowash = kimber(greensboro_rain) # test no washes assert np.allclose(nowash.values, expected_kimber_nowash['soiling'].values)
def test_kimber_manwash(greensboro_rain, expected_kimber_manwash): """Test Kimber soiling model with a manual wash""" # a manual wash date manwash = [datetime.date(1990, 2, 15), ] # calculate soiling with manual wash manwash = kimber(greensboro_rain, manual_wash_dates=manwash) # test manual wash assert np.allclose( manwash.values, expected_kimber_manwash['soiling'].values)
import pathlib from matplotlib import pyplot as plt from pvlib.iotools import read_tmy3 from pvlib.soiling import kimber import pvlib # get full path to the data directory DATA_DIR = pathlib.Path(pvlib.__file__).parent / 'data' # get TMY3 data with rain greensboro, _ = read_tmy3(DATA_DIR / '723170TYA.CSV', coerce_year=1990) # get the rain data greensboro_rain = greensboro.Lprecipdepth # calculate soiling with no wash dates and cleaning threshold of 25-mm of rain THRESHOLD = 25.0 soiling_no_wash = kimber(greensboro_rain, cleaning_threshold=THRESHOLD) soiling_no_wash.name = 'soiling' # daily rain totals daily_rain = greensboro_rain.iloc[:-1].resample('D').sum() plt.plot( daily_rain.index.to_pydatetime(), daily_rain.values/25.4, soiling_no_wash.index.to_pydatetime(), soiling_no_wash.values*100.0) plt.hlines( THRESHOLD/25.4, xmin=datetime(1990, 1, 1), xmax=datetime(1990, 12, 31), linestyles='--') plt.grid() plt.title( f'Kimber Soiling Model, dashed line shows threshold ({THRESHOLD}[mm])') plt.xlabel('timestamp') plt.ylabel('soiling build-up fraction [%] and daily rainfall [inches]') plt.legend(['daily rainfall [in]', 'soiling [%]'])