def test_image_pxbounds_overlapping(self): wv2 = CatalogImage('1030010076B8F500') _bands, ysize, xsize = wv2.shape image_shape = shape(wv2) image_bounds = image_shape.bounds width = image_bounds[2] - image_bounds[0] clip_area = translate(image_shape, xoff=-0.5 * width) xmin, ymin, xmax, ymax = wv2.pxbounds(clip_area, clip=True) self.assertEquals(xmin, 0) self.assertEquals(ymin, 0) self.assertEquals(xmax, xsize / 2) self.assertEquals(ymax, ysize)
def test_image_pxbounds_overlapping(self): wv2 = CatalogImage('1030010076B8F500') _bands, ysize, xsize = wv2.shape image_shape = shape(wv2) image_bounds = image_shape.bounds width = image_bounds[2] - image_bounds[0] clip_area = translate(image_shape, xoff=-0.5 * width) xmin, ymin, xmax, ymax = wv2.pxbounds(clip_area, clip=True) self.assertEquals(xmin, 0) self.assertEquals(ymin, 0) self.assertEquals(xmax, xsize/2) self.assertEquals(ymax, ysize)
def test_image_pxbounds_disjoint(self): wv2 = CatalogImage('1030010076B8F500') bounds = shape(wv2) clip = translate(bounds, xoff=5, yoff=5) with self.assertRaises(ValueError): clipped = wv2.pxbounds(clip)