def test_best_method_descriptors(self): catchment = Catchment("Aberdeen", "River Dee") catchment.channel_width = 1 catchment.descriptors = Descriptors(dtm_area=1, bfihost=0.50, sprhost=50, saar=1000, farl=1, urbext2000=0) self.assertAlmostEqual(catchment.qmed(), 0.5907, 4)
def test_best_method_order(self): catchment = Catchment("Aberdeen", "River Dee") catchment.channel_width = 1 catchment.amax_records = [AmaxRecord(date(1999, 12, 31), 1.0, 0.5), AmaxRecord(date(2000, 12, 31), 1.0, 0.5)] catchment.descriptors = Descriptors(dtm_area=1, bfihost=0.50, sprhost=50, saar=1000, farl=1) self.assertEqual(catchment.qmed(), 1.0)
def test_all(self): catchment = Catchment("Aberdeen", "River Dee") catchment.channel_width = 1 catchment.amax_records = [AmaxRecord(date(1999, 12, 31), 1.0, 0.5), AmaxRecord(date(2000, 12, 31), 1.0, 0.5)] catchment.descriptors = Descriptors(dtm_area=1, bfihost=0.50, sprhost=50, saar=1000, farl=1, urbext2000=0) qmeds = QmedAnalysis(catchment).qmed_all_methods() self.assertEqual(qmeds['amax_records'], 1) self.assertEqual(qmeds['channel_width'], 0.182) self.assertEqual(qmeds['area'], 1.172) self.assertAlmostEqual(qmeds['descriptors_1999'], 0.2671, 4)
def test_best_method_channel_width(self): catchment = Catchment("Aberdeen", "River Dee") catchment.channel_width = 1 self.assertEqual(catchment.qmed(), 0.182)
def test_channel_width_3(self): catchment = Catchment("Aberdeen", "River Dee") catchment.channel_width = 50 self.assertAlmostEqual(QmedAnalysis(catchment).qmed(method='channel_width'), 420.7576, 4)
def test_channel_width_2(self): catchment = Catchment("Aberdeen", "River Dee") catchment.channel_width = 2.345 self.assertAlmostEqual(QmedAnalysis(catchment).qmed(method='channel_width'), 0.9839, 4)