Loading autocnet/graph/network.py +24 −0 Original line number Diff line number Diff line Loading @@ -520,6 +520,30 @@ class CandidateGraph(nx.Graph): for s, d, edge in self.edges_iter(data=True): self.edge[s][d] = Edge(self.node[s], self.node[d]) # TODO: Add ability to actually read this out of a file. @classmethod def from_filelist(cls, filelst): """ Instantiate the class using a filelist as a python list. Parameters ---------- filelst : list A list containing the files to construct an adjacency graph from Returns ------- : object A Network graph object """ for file in filelst: # try to open the file, extract its bounding box for now. Also, just support gdal for now. dataset = GeoDataset(get_path(file)) print(dataset.latlon_extent) return cls() @classmethod def from_adjacency(cls, input_adjacency, basepath=None): """ Loading autocnet/graph/tests/test_network.py +12 −0 Original line number Diff line number Diff line Loading @@ -73,3 +73,15 @@ class TestNode(unittest.TestCase): # Convex hull computation is checked lower in the hull computation node = self.graph.node[0] self.assertRaises(AttributeError, node.coverage_ratio) class TestInputFileList(unittest.TestCase): @classmethod def setUpClass(cls): lst = ["AS15-M-0297_SML.png", "AS15-M-0298_SML.png", "AS15-M-0299_SML.png"] cls.graph = network.CandidateGraph.from_filelist(lst) def test_from_filelist(self): self.assertTrue(False) Loading
autocnet/graph/network.py +24 −0 Original line number Diff line number Diff line Loading @@ -520,6 +520,30 @@ class CandidateGraph(nx.Graph): for s, d, edge in self.edges_iter(data=True): self.edge[s][d] = Edge(self.node[s], self.node[d]) # TODO: Add ability to actually read this out of a file. @classmethod def from_filelist(cls, filelst): """ Instantiate the class using a filelist as a python list. Parameters ---------- filelst : list A list containing the files to construct an adjacency graph from Returns ------- : object A Network graph object """ for file in filelst: # try to open the file, extract its bounding box for now. Also, just support gdal for now. dataset = GeoDataset(get_path(file)) print(dataset.latlon_extent) return cls() @classmethod def from_adjacency(cls, input_adjacency, basepath=None): """ Loading
autocnet/graph/tests/test_network.py +12 −0 Original line number Diff line number Diff line Loading @@ -73,3 +73,15 @@ class TestNode(unittest.TestCase): # Convex hull computation is checked lower in the hull computation node = self.graph.node[0] self.assertRaises(AttributeError, node.coverage_ratio) class TestInputFileList(unittest.TestCase): @classmethod def setUpClass(cls): lst = ["AS15-M-0297_SML.png", "AS15-M-0298_SML.png", "AS15-M-0299_SML.png"] cls.graph = network.CandidateGraph.from_filelist(lst) def test_from_filelist(self): self.assertTrue(False)