Skip to content

0.2.1

Compare
Choose a tag to compare
@KipCrossing KipCrossing released this 18 Jul 23:01
· 80 commits to main since this release

Adds aszarr param to the read_box() method:

    def read_box(
        self, 
        bBox: BBox, 
        outer_points: Union[bool, int] = False,
        aszarr: bool = False,
    ) -> Union[np.ndarray, zarr.Array]:
        """Reads a boxed sections of the geotiff to a zarr/numpy array

        Args:
            bBox (BBox): A bounding box
            outer_points (Union[bool, int]): Takes an int (n) that gets extra n layers of points/pixels that directly surround the bBox. Defaults to False.
            safe (bool): If True, returns a zarr array. If False, forces a returns as a numpy array by putting the data into memory.  Defaults to False.

        

        Returns:
            np.ndarray: zarr array of the geotiff file
        """
        ((x_min, y_min), (x_max, y_max)) = self.get_int_box(
            bBox, outer_points=outer_points
        )
        tiff_array = self.read()
        boxed_array = tiff_array[y_min:y_max, x_min:x_max]
        if aszarr:
            return zarr.array(boxed_array)
        return np.array(boxed_array)