Example #1
0
 def _test_main_review_error(self):
     """ Run review feature without envvar set """
     #os.setenv('IMGCAT', None)
     with self.assertRaises(ValueError):
         scenes = main.main(date='2017-01-01',
                            satellite_name='Landsat-8',
                            review=True)
Example #2
0
 def test_main_options(self):
     """ Test main program with output options """
     fname = os.path.join(testpath, 'test_main-save.json')
     items = main.main(datetime='2019-01-02', save=fname, printcal=True, printmd=[], property=['eo:platform=landsat-8'])
     self.assertEqual(len(items), self.num_scenes)
     self.assertTrue(os.path.exists(fname))
     os.remove(fname)
     self.assertFalse(os.path.exists(fname))
Example #3
0
 def test_main_options(self):
     """ Test main program with output options """
     fname = os.path.join(testpath, 'test_main-save.json')
     scenes = main.main(date='2017-01-01', satellite_name='Landsat-8', save=fname, printsearch=True, printcal=True, printmd=[])
     self.assertEqual(len(scenes.scenes), 564)
     self.assertTrue(os.path.exists(fname))
     os.remove(fname)
     self.assertFalse(os.path.exists(fname))
Example #4
0
 def test_main_download(self):
     """ Test main program with downloading """
     with open(os.path.join(testpath, 'aoi1.geojson')) as f:
         aoi = json.dumps(json.load(f))
     scenes = main.main(date_from='2017-01-05', date_to='2017-01-21', satellite_name='Landsat-8',
                        intersects=aoi, download=['thumb', 'MTL'])
     for scene in scenes.scenes:
         self.assertTrue(os.path.exists(scene.filenames['thumb']))
         self.assertTrue(os.path.exists(scene.filenames['MTL']))
     shutil.rmtree(os.path.join(testpath, scene.platform))
Example #5
0
 def test_main_options(self):
     """ Test main program with output options """
     fname = os.path.join(testpath, 'test_main-save.json')
     scenes = main.main(datetime='2017-01-01',
                        save=fname,
                        printcal=True,
                        print_md=[],
                        **{'eo:platform': 'landsat-8'})
     self.assertEqual(len(scenes.scenes), self.num_scenes)
     self.assertTrue(os.path.exists(fname))
     os.remove(fname)
     self.assertFalse(os.path.exists(fname))
Example #6
0
 def test_main_options(self):
     """ Test main program with output options """
     fname = os.path.join(testpath, 'test_main-save.json')
     items = main.main(datetime='2019-01-02',
                       save=fname,
                       printcal=True,
                       printmd=[],
                       property=['eo:platform=landsat-8'])
     self.assertEqual(len(items), self.num_scenes)
     self.assertTrue(os.path.exists(fname))
     os.remove(fname)
     self.assertFalse(os.path.exists(fname))
Example #7
0
 def test_main_download(self):
     """ Test main program with downloading """
     with open(os.path.join(testpath, 'aoi1.geojson')) as f:
         aoi = json.dumps(json.load(f))
     config.DATADIR = os.path.join(testpath, "${eo:platform}")
     scenes = main.main(datetime='2017-01-05/2017-01-21',
                        intersects=aoi,
                        download=['thumbnail', 'MTL'],
                        **{'eo:platform': 'landsat-8'})
     for scene in scenes.scenes:
         self.assertTrue(os.path.exists(scene.filenames['thumbnail']))
         self.assertTrue(os.path.exists(scene.filenames['MTL']))
     shutil.rmtree(os.path.join(testpath, scene['eo:platform']))
     config.DATADIR = testpath
Example #8
0
 def test_main_download(self):
     """ Test main program with downloading """
     with open(os.path.join(testpath, 'aoi1.geojson')) as f:
         aoi = json.dumps(json.load(f))
     config.DATADIR = os.path.join(testpath, "${eo:platform}")
     items = main.main(datetime='2017-01-05/2017-01-21', intersects=aoi, download=['thumbnail', 'MTL'], **{'collection': 'landsat-8-l1'})
     for item in items:
         bname = os.path.splitext(item.get_filename(config.DATADIR))[0]
         assert(os.path.exists(bname + '_thumbnail.jpg'))
         if not os.path.exists(bname + '_MTL.txt'):
             import pdb; pdb.set_trace()
         assert(os.path.exists(bname + '_MTL.txt'))
     shutil.rmtree(os.path.join(testpath,'landsat-8'))
     config.DATADIR = testpath
Example #9
0
 def test_main_download(self):
     """ Test main program with downloading """
     with open(os.path.join(testpath, 'aoi1.geojson')) as f:
         aoi = json.dumps(json.load(f))
     config.DATADIR = os.path.join(testpath, "${eo:platform}")
     items = main.main(datetime='2017-01-05/2017-01-21',
                       intersects=aoi,
                       download=['thumbnail', 'MTL'],
                       **{'collection': 'landsat-8-l1'})
     for item in items:
         bname = os.path.splitext(item.get_filename(config.DATADIR))[0]
         assert (os.path.exists(bname + '_thumbnail.jpg'))
         if not os.path.exists(bname + '_MTL.txt'):
             import pdb
             pdb.set_trace()
         assert (os.path.exists(bname + '_MTL.txt'))
     shutil.rmtree(os.path.join(testpath, 'landsat-8'))
     config.DATADIR = testpath
Example #10
0
 def test_main_found(self):
     """ Run main function """
     found = main.main(datetime='2019-01-02', found=True, **{'collection': 'landsat-8-l1'})
     self.assertEqual(found, self.num_scenes)
Example #11
0
 def test_main(self):
     """ Run main function """
     items = main.main(datetime='2019-01-02',
                       **{'collection': 'landsat-8-l1'})
     self.assertEqual(len(items), self.num_scenes)
Example #12
0
 def test_main_found(self):
     """ Run main function """
     found = main.main(datetime='2019-01-02',
                       found=True,
                       **{'collection': 'landsat-8-l1'})
     self.assertEqual(found, self.num_scenes)
Example #13
0
 def test_main(self):
     """ Run main function """
     scenes = main.main(datetime='2017-01-01', **{'c:id': 'Landsat-8-l1'})
     self.assertEqual(len(scenes.scenes), self.num_scenes)
Example #14
0
 def test_main(self):
     """ Run main function """
     scenes = main.main(date='2017-01-01', satellite_name='Landsat-8')
     self.assertEqual(len(scenes.scenes), self.num_scenes)
Example #15
0
 def test_main_load(self):
     items = main.main(items=os.path.join(testpath, 'scenes.geojson'))
     assert (len(items) == 2)
Example #16
0
 def test_main_load(self):
     items = main.main(items=os.path.join(testpath, 'scenes.geojson'))
     assert(len(items) == 2)
Example #17
0
 def _test_main_review_error(self):
     """ Run review feature without envvar set """
     os.setenv('IMGCAT', None)
     scenes = main.main(date='2017-01-01', satellite_name='Landsat-8', review=True)
Example #18
0
 def test_main(self):
     """ Run main function """
     items = main.main(datetime='2019-01-02', **{'collection': 'landsat-8-l1'})
     self.assertEqual(len(items), self.num_scenes)