Esempio n. 1
0
 def test_main_options(self):
     """ Test main program with output options """
     fname = os.path.join(testpath, 'test_main-save.json')
     items = main(datetime='2019-07-01', 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))
Esempio n. 2
0
 def test_main_options(self):
     """ Test main program with output options """
     fname = os.path.join(testpath, 'test_main-save.json')
     items = main(datetime='2020-01-01',
                  save=fname,
                  printcal=True,
                  printmd=[],
                  collections=['sentinel-s2-l2a'],
                  query=['eo:cloud_cover=0', 'data_coverage>80'])
     self.assertEqual(len(items), 212)
     self.assertTrue(os.path.exists(fname))
     os.remove(fname)
     self.assertFalse(os.path.exists(fname))
Esempio n. 3
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(datetime='2019-06-05/2019-06-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
Esempio n. 4
0
 def test_main_download(self):
     """ Test main program with downloading """
     with open(os.path.join(testpath, 'aoi1.geojson')) as f:
         aoi = json.load(f)
     filename_template = os.path.join(testpath,
                                      "test-download/${platform}/${id}")
     items = main(datetime='2020-06-07',
                  intersects=aoi['geometry'],
                  filename_template=filename_template,
                  download=['thumbnail', 'info'],
                  **{'collections': ['sentinel-s2-l1c']})
     for item in items:
         bname = os.path.splitext(item.get_path(filename_template))[0]
         assert (os.path.exists(bname + '_thumbnail.jpg'))
         assert (os.path.exists(bname + '_info.json'))
Esempio n. 5
0
 def test_main_load(self):
     items = main(items=os.path.join(testpath, 'scenes.geojson'))
     assert (len(items) == 2)
Esempio n. 6
0
 def test_main_found(self):
     """ Run main function """
     found = main(datetime='2020-01-01', found=True)
     self.assertEqual(found, 17819)
Esempio n. 7
0
 def test_main(self):
     """ Run main function """
     items = main(datetime='2020-01-01',
                  collections=['sentinel-s2-l1c'],
                  query=['eo:cloud_cover=0', 'data_coverage>80'])
     self.assertEqual(len(items), 207)
Esempio n. 8
0
 def test_main_found(self):
     """ Run main function """
     found = main(datetime='2020-01-01', found=True)
     min_found = 17819
     assert (found >= min_found)
Esempio n. 9
0
 def test_main_found(self):
     """ Run main function """
     found = main(datetime='2019-07-01', found=True)
     self.assertEqual(found, 24737)
Esempio n. 10
0
 def test_main_found(self):
     """ Run main function """
     found = main(datetime='2019-07-01', found=True, **{'collection': 'landsat-8-l1'})
     self.assertEqual(found, self.num_scenes)
Esempio n. 11
0
 def test_main(self):
     """ Run main function """
     items = main(datetime='2019-07-01', **{'collection': 'landsat-8-l1'})
     self.assertEqual(len(items), self.num_scenes)