Skip to content

Commit

Permalink
DAS-2161: Updates libs with no user visible changes. (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
flamingbear authored Jun 10, 2024
1 parent bad8970 commit 73058ae
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
language-settings:
python: "3.7"
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ HyBIG follows semantic versioning. All notable changes to this project will be
documented in this file. The format is based on [Keep a
Changelog](http://keepachangelog.com/en/1.0.0/).

## [v1.2.1] - 2024-06-10

### Changed
Updated internal library dependencies.

## [v1.2.0] - 2024-05-28

Expand Down Expand Up @@ -43,7 +47,8 @@ outlined by the NASA open-source guidelines.
For more information on internal releases prior to NASA open-source approval,
see legacy-CHANGELOG.md.

[unreleased]:https://github.com/nasa/harmony-browse-image-generator/compare/1.2.0..HEAD
[unreleased]:https://github.com/nasa/harmony-browse-image-generator/compare/1.2.1..HEAD
[v1.2.1]: https://github.com/nasa/harmony-browse-image-generator/compare/1.2.0..1.2.1
[v1.2.0]: https://github.com/nasa/harmony-browse-image-generator/compare/1.1.0..1.2.0
[v1.1.0]: https://github.com/nasa/harmony-browse-image-generator/compare/1.0.2..1.1.0
[v1.0.2]: https://github.com/nasa/harmony-browse-image-generator/compare/1.0.1..1.0.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ environment via conda, and then install the necessary dependencies for the
service within that environment via conda and pip then install the pre-commit hooks.

```
> conda create -name hybig-env python==3.11
> conda create --name hybig-env python==3.11
> conda install --file conda_requirements.txt
> pip install -r pip_requirements.txt
> pip install -r dev-requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion conda_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gdal==3.6.3
gdal==3.9
2 changes: 1 addition & 1 deletion docker/service_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.2.1
7 changes: 4 additions & 3 deletions harmony_browse_image_generator/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
TRANSPARENT,
TRANSPARENT_IDX,
TRANSPARENT_RGBA,
all_black_color_map,
get_color_palette,
remove_alpha,
)
Expand Down Expand Up @@ -286,9 +287,9 @@ def get_color_map_from_image(image: Image) -> dict:
"""
color_tuples = np.array(image.getpalette(rawmode='RGBA')).reshape(-1, 4)
color_map = {}
for idx in range(0, color_tuples.shape[0]):
color_map[idx] = tuple(color_tuples[idx])
color_map = all_black_color_map()
for idx, color_tuple in enumerate(color_tuples):
color_map[idx] = tuple(color_tuple)
return color_map


Expand Down
5 changes: 5 additions & 0 deletions harmony_browse_image_generator/color_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def get_remote_palette_from_source(source: HarmonySource) -> dict:
raise HyBIGNoColorInformation('No color in source') from exc


def all_black_color_map():
"""Return a full length rgba color map with all black values."""
return {idx: (0, 0, 0, 255) for idx in range(256)}


def convert_colormap_to_palette(colormap: dict) -> ColorPalette:
"""Convert a GeoTIFF palette to GDAL ColorPalette.
Expand Down
14 changes: 7 additions & 7 deletions pip_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
harmony-service-lib~=1.0.26
harmony-service-lib~=1.0.27
pystac~=0.5.6
matplotlib==3.7.1
rasterio==1.3.6
rioxarray==0.15.0
numpy==1.24.2
pillow==10.0.0
pyproj==3.6.0
matplotlib==3.9.0
rasterio==1.3.10
rioxarray==0.15.5
numpy==1.26.4
pillow==10.3.0
pyproj==3.6.1
13 changes: 8 additions & 5 deletions tests/unit/test_browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,14 @@ def test_get_color_map_from_image(self):
test_image.putpalette(palette_sequence, rawmode='RGBA')

expected_color_map = {
0: (255, 0, 0, 255),
1: (0, 255, 0, 255),
2: (0, 0, 255, 255),
3: (225, 100, 25, 25),
4: (0, 0, 0, 0),
**{
0: (255, 0, 0, 255),
1: (0, 255, 0, 255),
2: (0, 0, 255, 255),
3: (225, 100, 25, 25),
4: (0, 0, 0, 0),
},
**{idx: (0, 0, 0, 255) for idx in range(5, 256)},
}

actual_color_map = get_color_map_from_image(test_image)
Expand Down

0 comments on commit 73058ae

Please sign in to comment.