Commit 14fcc130 authored by kberry's avatar kberry
Browse files

minor cleanup

parent ca84deda
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@ class GeoDataset(object):
    base_name : str
                The base name of the input image, extracted from the full path.

    bounding_box : object
                 The bounding box of the image in lat/lon space

    geotransform : object
                   Geotransform reference OGR object as an array of size 6 containing the affine 
                   transformation coefficients for transforming from raw sample/line to projected x/y.
+5 −4
Original line number Diff line number Diff line
@@ -85,16 +85,18 @@ class CandidateGraph(nx.Graph):
            graph = pickle.load(f)
        return graph

# TODO: Add ability to actually read this out of a file.
# 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.
        An adjacency structure is calculated using the lat/lon information in the
        input images. Currently only images with this information are supported.

        Parameters
        ----------
        filelst : list
                  A list containing the files to construct an adjacency graph from
                  A list containing the files (with full paths) to construct an adjacency graph from

        Returns
        -------
@@ -102,7 +104,7 @@ class CandidateGraph(nx.Graph):
          A Network graph object
        """

        # TODO: Reject unsupported file formats (pngs, cubes, anything without usable geospatial data?)
        # TODO: Reject unsupported file formats + work with more file formats

        dataset_list = []
        for file in filelst:
@@ -118,7 +120,6 @@ class CandidateGraph(nx.Graph):
                if(cg.standalone.bbcommon(data.bounding_box, other.bounding_box)):
                    adjacent_images.append(other.base_name)
            adjacency_dict[data.base_name] = adjacent_images
        print(adjacency_dict)
        return cls(adjacency_dict)


+6 −9
Original line number Diff line number Diff line
@@ -69,16 +69,13 @@ class TestCandidateGraph(unittest.TestCase):
class TestFromList(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        #cls.graph = network.CandidateGraph.from_filelist('/scratch/autocnet/autocnet/examples/Apollo15/fromlist.txt')
        #cls.graph = network.CandidateGraph.from_filelist(['/scratch/autocnet/autocnet/examples/Apollo15/AS15-M-0297_SML.png'])
         cls.graph = network.CandidateGraph.from_filelist(
             ['/home/kree/usgs/autocnet/autocnet/examples/Projections/Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif',
              '/home/kree/usgs/autocnet/autocnet/examples/Projections/Lunar_LRO_LOLA_Shade_MAP2_90.0N20.0_LAMB.tif',
              '/home/kree/usgs/autocnet/autocnet/examples/Projections/Mars_MGS_MOLA_ClrShade_MAP2_90.0N0.0_POLA.tif'])

    def testfail(self):
        self.assertTrue(False)
        filelist = [get_path('Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif'),
                    get_path('Lunar_LRO_LOLA_Shade_MAP2_90.0N20.0_LAMB.tif'),
                    get_path('Mars_MGS_MOLA_ClrShade_MAP2_90.0N0.0_POLA.tif')]
        cls.graph = network.CandidateGraph.from_filelist(filelist)

    def test_graph_length(self):
        self.assertEqual(self.graph.__len__(), 3)

class TestEdge(unittest.TestCase):