Пример #1
0
    def test_gather_metadata_file(self):

        rm_files = [
            '01JAN08QB020800008JAN01102125-P1BS-005590467020_01_P001_________AAE_0AAAAABAABA0.xml'
        ]

        for root, dirs, files in os.walk(os.path.join(test_dir, 'ortho')):
            for f in files:
                if f.lower().endswith(".ntf") or f.lower().endswith(".tif"):
                    #print f
                    #### Find metadata file
                    srcfp = os.path.join(root, f)

                    metafile = ortho_functions.GetDGMetadataPath(srcfp)
                    if metafile is None:
                        metafile = ortho_functions.ExtractDGMetadataFile(
                            srcfp, root)
                    if metafile is None:
                        metafile = ortho_functions.GetIKMetadataPath(srcfp)
                    if metafile is None:
                        metafile = ortho_functions.GetGEMetadataPath(srcfp)
                    self.assertIsNotNone(metafile)

                    if metafile and os.path.basename(metafile) in rm_files:
                        os.remove(metafile)
 def test_parse_DG_md_file(self):
     args = ProcessArgs(4326,'rf')
     info = ImageInfo(self.fn, 'DigitalGlobe', 'WV01')
     metafile = ortho_functions.GetDGMetadataPath(info.localsrc)
     info.metapath = metafile
     rc = ortho_functions.WriteOutputMetadata(args, info)
     ## read meta and check content
     f = open(self.mf)
     contents = f.read()
     f.close()
     for test_line in self.test_lines:
         self.assertTrue(test_line in contents)