def test_intersection_by_geom(self): """ Tests intersection of a geometry with the regular mosaic geometry. """ geom = any_geom2ogr_geom(self._get_roi(), sref=self.mosaic_geom.sref) mosaic_intsct = self.mosaic_geom.slice_by_geom(geom) outer_boundary_extent = RasterGeometry.from_raster_geometries(mosaic_intsct.tiles).outer_boundary_extent self.assertTupleEqual(outer_boundary_extent, self._get_roi())
def test_subset_by_geom(self): """ Tests sub-setting a regular mosaic geometry with another geometry. """ geom = any_geom2ogr_geom(self._get_roi(), sref=self.mosaic_geom.sref) sub_mosaic = self.mosaic_geom.subset_by_geom(geom) assert len(sub_mosaic.tiles) == 4 assert sub_mosaic.tile_ids == ['S000W000', 'S000W001', 'S001W000', 'S001W001']
def test_subset_by_geom(self): """ Tests sub-setting a mosaic geometry with another geometry. """ geom = any_geom2ogr_geom(self._get_roi(), sref=self.mosaic_geom.sref) sub_mosaic = self.mosaic_geom.subset_by_geom(geom) assert len(sub_mosaic.tiles) == 5 assert sub_mosaic.tile_ids == [1, 2, 6, 3, 7]
def test_slice_by_geom(self): """ Tests sub-setting a regular mosaic geometry with another geometry. """ geom = any_geom2ogr_geom(self._get_roi(), sref=self.mosaic_geom.sref) self.mosaic_geom.slice_by_geom(geom) assert len(self.mosaic_geom.tiles) == 4 assert sorted(self.mosaic_geom.tile_names) == sorted( ['S000W000', 'S000W001', 'S001W000', 'S001W001'])
def test_slice_tiles_by_geom(self): """ Tests intersection of a geometry with the tiles contained in the regular mosaic geometry. """ geom = any_geom2ogr_geom(self._get_roi(), sref=self.mosaic_geom.sref) intscted_tiles = list( self.mosaic_geom.slice_tiles_by_geom(geom).values()) outer_boundary_extent = RasterGeometry.from_raster_geometries( intscted_tiles).outer_boundary_extent self.assertTupleEqual(outer_boundary_extent, self._get_roi())
def test_slice_by_geom(self): """ Tests sub-setting a mosaic geometry with another geometry. """ geom = any_geom2ogr_geom(self._get_roi(), sref=self.mosaic_geom.sref) self.mosaic_geom.slice_by_geom(geom) assert len(self.mosaic_geom.tiles) == 5 assert sorted(self.mosaic_geom.tile_names) == [ "R1S000W000", "R1S000W001", "R1S000W002", "R2S000W000", "R2S000W001" ]