def test_only_land(self): """Test that the expected number of nodes are created and that a tree is returned. In this case the number of nodes should be this should be equal to the number of land points.""" plugin = NeighbourSelection(land_constraint=True) result, result_nodes = plugin.build_KDTree(self.region_land_mask) expected_length = np.nonzero(self.region_land_mask.data)[0].shape[0] self.assertEqual(result_nodes.shape[0], expected_length) self.assertIsInstance(result, scipy.spatial.ckdtree.cKDTree)
def test_basic(self): """Test that the expected number of nodes are created and that a tree is returned; this should be the lengths of the x and y coordinates multiplied in the simple case.""" plugin = NeighbourSelection() result, result_nodes = plugin.build_KDTree(self.region_land_mask) expected_length = (self.region_land_mask.shape[0] * self.region_land_mask.shape[1]) self.assertEqual(result_nodes.shape[0], expected_length) self.assertIsInstance(result, scipy.spatial.ckdtree.cKDTree)