def test_pansharpen_with_clip(self): """ test with pansharpen and clipping """ bounds = [-87.48138427734375, 30.700515832683923, -87.43331909179688, 30.739475058679485] p = PanSharpen(path=self.landsat_image, bands=[4, 3, 2], dst_path=self.temp_folder, bounds=bounds) path = p.run() self.assertTrue(exists(path)) self.assertEqual(map('{0:.2f}'.format, get_bounds(path)), map('{0:.2f}'.format, bounds))
def test_pansharpen_with_clip(self): """ test with pansharpen and clipping """ bounds = [-87.48138427734375, 30.700515832683923, -87.43331909179688, 30.739475058679485] p = PanSharpen(path=self.landsat_image, bands=[4, 3, 2], dst_path=self.temp_folder, bounds=bounds) path = p.run() self.assertTrue(exists(path)) for val, exp in zip(get_bounds(path), bounds): self.assertAlmostEqual(val, exp, 2)
def preprocess(download_key, src_path=DEFAULT_DOWNLOAD_PATH, dst_path=DEFAULT_PROCESSED_PATH, ndvi=False, pansharpen=False, verbose=False, ndvigrey=False, bounds=None): try: bands = [2,3,4] if pansharpen: p = PanSharpen(src_path, bands=bands, dst_path=dst_path, verbose=verbose, bounds=bounds) elif ndvigrey: p = NDVI(src_path, verbose=verbose, dst_path=dst_path, bounds=bounds) elif ndvi: p = NDVIWithManualColorMap(src_path, dst_path=dst_path, verbose=verbose, bounds=bounds) else: p = Simple(src_path, bands=bands, dst_path=dst_path, verbose=verbose, bounds=bounds) except IOError as err: print str(err) exit(str(err)) except FileDoesNotExist as err: print str(err) exit(str(err)) return p.run()
def test_pansharpen(self): # test with pansharpen p = PanSharpen(path=self.landsat_image, bands=[4, 3, 2], dst_path=self.temp_folder) p.run() self.assertTrue(exists(join(self.temp_folder, "test", "test_bands_432_pan.TIF")))
def test_pansharpen(self): p = PanSharpen(path=self.landsat_image, bands=[4, 3, 2], dst_path=self.temp_folder) self.assertTrue(exists(p.run()))