def test_similarity_dist(self):
     subject = from_file('floodestimation/tests/data/37017.CD3')
     donor = from_file('floodestimation/tests/data/37020.CD3')
     analysis = GrowthCurveAnalysis(subject)
     result = analysis._similarity_distance(subject, donor)
     expected = 0.1159  # Science Report SC050050, table 6.6, row 2
     self.assertAlmostEqual(result, expected, places=4)
 def test_similarity_dist(self):
     subject = from_file('floodestimation/tests/data/37017.CD3')
     donor = from_file('floodestimation/tests/data/37020.CD3')
     analysis = GrowthCurveAnalysis(subject)
     result = analysis._similarity_distance(subject, donor)
     expected = 0.1159  # Science Report SC050050, table 6.6, row 2
     self.assertAlmostEqual(result, expected, places=4)
    def test_similarity_distance_incomplete_descriptors(self):
        other_catchment = Catchment(location="Burn A", watercourse="Village B")
        other_catchment.id = 999
        other_catchment.is_suitable_for_pooling = True
        self.db_session.add(other_catchment)

        gauged_catchments = CatchmentCollections(self.db_session)
        analysis = GrowthCurveAnalysis(self.catchment, gauged_catchments)
        self.assertEqual(float('inf'), analysis._similarity_distance(self.catchment, other_catchment))
    def test_similarity_distance_incomplete_descriptors(self):
        other_catchment = Catchment(location="Burn A", watercourse="Village B")
        other_catchment.id = 999
        other_catchment.is_suitable_for_pooling = True
        self.db_session.add(other_catchment)

        gauged_catchments = CatchmentCollections(self.db_session)
        analysis = GrowthCurveAnalysis(self.catchment, gauged_catchments)
        self.assertEqual(
            float('inf'),
            analysis._similarity_distance(self.catchment, other_catchment))