def test_fully_covered_nrel(): dt = pd.date_range(start="2019-1-1 12:00:00", end="2019-1-1 18:00:00", freq='1h') snowfall_data = pd.Series([1, 5, .6, 4, .23, -5, 19], index=dt) expected = pd.Series([False, True, False, True, False, False, True], index=dt) fully_covered = snow.fully_covered_nrel(snowfall_data) assert_series_equal(expected, fully_covered)
def test_fully_covered_nrel_irregular(): # test when frequency is not specified and can't be inferred dt = pd.DatetimeIndex(["2019-1-1 11:00:00", "2019-1-1 14:30:00", "2019-1-1 15:07:00", "2019-1-1 14:00:00"]) snowfall_data = pd.Series([1, .5, .6, .4], index=dt) snow_coverage = snow.fully_covered_nrel(snowfall_data, threshold_snowfall=0.5) covered = np.array([False, False, True, False]) expected = pd.Series(covered, index=dt) assert_series_equal(expected, snow_coverage)