Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_rda_materialize(self):
# TODO: Fix this test
catid = '8c3c4fc6-abcb-4f5f-bce6-d496c1a91676'
img = CatalogImage(catid)
aoi = img.randwindow((1000, 1000))
assert aoi.shape == (4, 1000, 1000)
job_id = img.materialize(bounds=aoi.bounds)
status = img.materialize_status(job_id)
assert status['jobStatus'] == 'processing'
def test_catalog_image_wv4(self):
img = CatalogImage(WV04_CATID)
self.assertTrue(isinstance(img, WV04))
self.assertEqual(img.shape, (4, 123760, 12792))
self.assertEqual(img.proj, 'EPSG:4326')
def test_basic_catalog_acomp(self):
img = CatalogImage(WV02_CATID, acomp=True)
self.assertTrue(isinstance(img, WV02))
self.assertEqual(img.cat_id, WV02_CATID)
self.assertEqual(img.shape, (8, 59907, 11468))
self.assertEqual(img.proj, 'EPSG:4326')
def test_image_window_cover(self):
""" Window cover should padd the image by 25 pixels and return 9 windows """
wv2 = CatalogImage(WV02_CATID)
aoi = wv2.randwindow((275,300))
coverage = [dsk for dsk in aoi.window_cover((100,100), pad=True)]
self.assertEqual(len(coverage), 9)
def test_catalog_image_swir(self):
img = CatalogImage(WV03_SWIR_CATID)
self.assertTrue(isinstance(img, WV03_SWIR))
assert img.cat_id == WV03_SWIR_CATID
assert img.shape == (8, 3804, 2822)
assert img.proj == 'EPSG:4326'
def test_basic_catalog_image(self):
img = CatalogImage(WV02_CATID)
self.assertTrue(isinstance(img, WV02))
self.assertEqual(img.cat_id, WV02_CATID)
self.assertEqual(img.shape, (8, 59907, 11468))
self.assertEqual(img.proj, 'EPSG:4326')
def test_wv3_image(self):
wv3 = CatalogImage(WV03_VNIR_CATID)
self.assertTrue(isinstance(wv3, WV03_VNIR))
def test_image_window_at(self):
wv2 = CatalogImage(WV02_CATID)
c1 = shape(wv2).centroid
window = wv2.window_at(c1, (256, 256))
c2 = shape(window).centroid
bands, x, y = window.shape
# check the window is the correct shape
self.assertEqual(x, 256)
self.assertEqual(y, 256)
# make sure the center of the window is within 1 pixel
# of where it should be
self.assertTrue(c1.distance(c2) < wv2.metadata['georef']['scaleX'])
def test_catalog_image_wv4_proj(self):
img = CatalogImage(WV04_CATID, proj="EPSG:3857")
self.assertTrue(isinstance(img, WV04))
self.assertEqual(img.shape, (4, 156535, 12792))
self.assertEqual(img.proj, 'EPSG:3857')
# create and store an instance of the GBDX Ordering Client
self.ordering = Ordering()
# create and store an instance of the GBDX Catalog Client
self.catalog = Catalog()
# create and store an instance of the GBDX Workflow Client
self.workflow = Workflow()
# create and store an instance of the Idaho Client
self.idaho = Idaho()
self.vectors = Vectors()
self.catalog_image = CatalogImage
self.idaho_image = IdahoImage
self.landsat_image = LandsatImage
self.modis = Modis
self.sentinel1 = Sentinel1
self.sentinel2 = Sentinel2
self.tms_image = TmsImage
self.dem_image = DemImage
self.wv03_vnir = WV03_VNIR
self.wv03_swir = WV03_SWIR
self.wv02 = WV02
self.wv04 = WV04
self.ge01 = GE01
self.s3_image = S3Image
self.rda_template_image = RDATemplateImage
self.task_registry = TaskRegistry()