def test_nearest_to(self): casts = [] for i in range(10): casts.append(Cast(pressure=[1, 2, 3], temperature=[5, 6, 7], coordinates=(-30.0 + i, 10.0 - 2*i))) cc = CastCollection(casts) pt = Point((-26.2, 2.1), crs=LonLatWGS84) nearest, dist = cc.nearest_to_point(pt) self.assertEqual(nearest.coordinates.vertex, (-26.0, 2.0)) self.assertAlmostEqual(dist, 24845.9422, places=4) return
def test_nearest_to(self): casts = [] for i in range(10): casts.append( Cast(pressure=[1, 2, 3], temperature=[5, 6, 7], coordinates=(-30.0 + i, 10.0 - 2 * i))) cc = CastCollection(casts) pt = Point((-26.2, 2.1), crs=LonLatWGS84) nearest, dist = cc.nearest_to_point(pt) self.assertEqual(nearest.coordinates.vertex, (-26.0, 2.0)) self.assertAlmostEqual(dist, 24845.9422, places=4) return