Skip to content

Commit

Permalink
DAS-2108: fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
flamingbear committed Apr 16, 2024
1 parent 37ff062 commit 3dbba3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 1 addition & 3 deletions harmony_browse_image_generator/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
from harmony.message import Source as HarmonySource
from matplotlib.cm import ScalarMappable
from matplotlib.colors import Normalize
from numpy import ndarray
from osgeo_utils.auxiliary.color_palette import ColorPalette
from PIL import Image
from rasterio.io import DatasetReader
from rasterio.plot import reshape_as_image, reshape_as_raster
from rasterio.warp import Resampling, reproject
from rioxarray import open_rasterio
from xarray import DataArray
from numpy import ndarray


from harmony_browse_image_generator.color_utility import (
NODATA_IDX,
Expand All @@ -33,7 +32,6 @@
get_color_palette,
remove_alpha,
)

from harmony_browse_image_generator.exceptions import HyBIGError
from harmony_browse_image_generator.sizes import (
GridParams,
Expand Down
11 changes: 8 additions & 3 deletions harmony_browse_image_generator/color_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"""

from typing import TYPE_CHECKING

import numpy as np
import requests
from harmony.message import Source as HarmonySource
import numpy as np
from numpy import ndarray
from osgeo_utils.auxiliary.color_palette import ColorPalette
from pystac import Item
from rasterio.io import DatasetReader
Expand All @@ -18,6 +19,10 @@
HyBIGNoColorInformation,
)

if TYPE_CHECKING:
from numpy import ndarray


# Constants for output PNG images
# Applied to transparent pixels where alpha < 255
TRANSPARENT = np.uint8(0)
Expand All @@ -30,7 +35,7 @@
NODATA_IDX = 255


def remove_alpha(raster: ndarray) -> tuple[ndarray, ndarray, None]:
def remove_alpha(raster: 'ndarray') -> tuple['ndarray', 'ndarray', None]:
"""remove alpha layer when it exists."""
if raster.shape[0] == 4:
return raster[0:3, :, :], raster[3, :, :]
Expand Down

0 comments on commit 3dbba3c

Please sign in to comment.