Closed michalk8 closed 1 year ago
Requires https://github.com/VolkerH/DaskFusion to be cloned into the current folder.
Current TODOs:
To work with shapely>=2.0, one needs to modify this original function:
shapely>=2.0
def find_chunk_tile_intersections( tiles_shapely: List["shapely.geometry.base.BaseGeometry"], chunks_shapely: List["shapely.geometry.base.BaseGeometry"], fuse_info: Dict["shapely.geometry.base.BaseGeometry", Any], ) -> Dict[Tuple[int, int], Tuple[str, np.ndarray]]: """ For each output array chunk, find the intersecting image tiles Args: tile_shapes: Contains the shapely objects corresponding to transformed image outlines. chunk_shapes: Contains the shapely objects representing dask array chunks. fuse_info: TODO. Returns: The chunk_to_tiles dictionary, which has the chunk anchor points as keys and tuples of image file names and their corresponding affine transform matrix as values. """ chunk_to_tiles = {} tile_tree = STRtree(tiles_shapely) for chunk_shape in chunks_shapely: chunk_boundary = fuse_info[chunk_shape]["chunk_boundary"] anchor_point = (chunk_boundary[0][0], chunk_boundary[1][0]) intersecting_tiles = tile_tree.query(chunk_shape) chunk_to_tiles[anchor_point] = [ ((fuse_info[tiles_shapely[ix]]["file"], fuse_info[tiles_shapely[ix]]["transform"])) for ix in intersecting_tiles ] return chunk_to_tiles
Requires https://github.com/VolkerH/DaskFusion to be cloned into the current folder.
Current TODOs:
To work with
shapely>=2.0
, one needs to modify this original function: