def test_wet_spells_on_list(self):
     "Test wet_spells"
     data = self.data
     durations = [4, 1, 3, 1, 1]
     intensities = [10, 1, 9, 7, 5]
     _test = wet_spells(data, threshold=0.254)
     assert_equal(_test['durations'], durations)
     assert_equal(_test['intensities'], intensities)
 def test_wet_and_dry_spells(self):
     "Test wet and dry spells"
     data = self.data + [-3]
     rainfall = hydro.time_series(data, mask=24 * [0] + [1], start_date=hydro.Date("M", "2001-01"))
     threshold = 0.254
     dspells = dry_spells(rainfall, threshold=threshold)
     wspells = wet_spells(rainfall, threshold=threshold)
     assert_equal(dspells.sum() + wspells.durations.sum(), rainfall.count())
 def test_wet_spells_on_list(self):
     "Test wet_spells"
     data = self.data
     durations = [4, 1, 3, 1, 1]
     intensities = [10, 1, 9, 7, 5]
     _test = wet_spells(data, threshold=0.254)
     assert_equal(_test["durations"], durations)
     assert_equal(_test["intensities"], intensities)
 def test_wet_and_dry_spells(self):
     "Test wet and dry spells"
     data = self.data + [-3]
     rainfall = hydro.time_series(data,
                                  mask=24 * [0] + [1],
                                  start_date=hydro.Date('M', '2001-01'))
     threshold = 0.254
     dspells = dry_spells(rainfall, threshold=threshold)
     wspells = wet_spells(rainfall, threshold=threshold)
     assert_equal(dspells.sum() + wspells.durations.sum(), rainfall.count())
 def test_wet_spells(self):
     "Test wet_spells"
     rainfall = self.rainfall
     dates = rainfall.dates
     control_dates_onstart = dates[[0, 5, 10, 21, 23]]
     control_dates_onend = dates[[3, 5, 12, 21, 23]]
     durations = [4, 1, 3, 1, 1]
     intensities = [10, 1, 9, 7, 5]
     #
     _test = wet_spells(rainfall, threshold=0.254)
     assert_equal(_test['durations'], durations)
     assert_equal(_test['intensities'], intensities)
     assert_equal(_test.dates, control_dates_onstart)
     _test = wet_spells(rainfall, threshold=0.254, start=False)
     assert_equal(_test['durations'], durations)
     assert_equal(_test['intensities'], intensities)
     assert_equal(_test.dates, control_dates_onend)
     #
     _test = wet_spells(rainfall, threshold=0.254, mode='durations')
     assert_equal(_test, durations)
     _test = wet_spells(rainfall, threshold=0.254, mode='d')
     assert_equal(_test, durations)
     _test = wet_spells(rainfall, threshold=0.254, mode='intensities')
     assert_equal(_test, intensities)
     _test = wet_spells(rainfall, threshold=0.254, mode='i')
     assert_equal(_test, intensities)
 def test_wet_spells(self):
     "Test wet_spells"
     rainfall = self.rainfall
     dates = rainfall.dates
     control_dates_onstart = dates[[0, 5, 10, 21, 23]]
     control_dates_onend = dates[[3, 5, 12, 21, 23]]
     durations = [4, 1, 3, 1, 1]
     intensities = [10, 1, 9, 7, 5]
     #
     _test = wet_spells(rainfall, threshold=0.254)
     assert_equal(_test["durations"], durations)
     assert_equal(_test["intensities"], intensities)
     assert_equal(_test.dates, control_dates_onstart)
     _test = wet_spells(rainfall, threshold=0.254, start=False)
     assert_equal(_test["durations"], durations)
     assert_equal(_test["intensities"], intensities)
     assert_equal(_test.dates, control_dates_onend)
     #
     _test = wet_spells(rainfall, threshold=0.254, mode="durations")
     assert_equal(_test, durations)
     _test = wet_spells(rainfall, threshold=0.254, mode="d")
     assert_equal(_test, durations)
     _test = wet_spells(rainfall, threshold=0.254, mode="intensities")
     assert_equal(_test, intensities)
     _test = wet_spells(rainfall, threshold=0.254, mode="i")
     assert_equal(_test, intensities)