Skip to content

Commit

Permalink
DAS-None update harmony_service_lib to v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
flamingbear committed Oct 8, 2024
1 parent 45dbf82 commit 2e1d99f
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion docs/HyBIG-Example-Usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"metadata": {},
"outputs": [],
"source": [
"from harmony import Collection, Environment, Client, Request\n",
"from harmony_service_lib import Collection, Environment, Client, Request\n",
"\n",
"# creates an output directory for the downloaded files\n",
"from pathlib import Path\n",
Expand Down
2 changes: 1 addition & 1 deletion harmony_service/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from argparse import ArgumentParser
from sys import argv

from harmony import is_harmony_cli, run_cli, setup_cli
from harmony_service_lib import is_harmony_cli, run_cli, setup_cli

from .adapter import BrowseImageGeneratorAdapter
from .exceptions import SERVICE_NAME
Expand Down
13 changes: 9 additions & 4 deletions harmony_service/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@
from shutil import rmtree
from tempfile import mkdtemp

from harmony import BaseHarmonyAdapter
from harmony.message import Source as HarmonySource
from harmony.message_utility import (
from harmony_service_lib import BaseHarmonyAdapter
from harmony_service_lib.message import Source as HarmonySource
from harmony_service_lib.message_utility import (
has_crs,
has_scale_extents,
has_scale_sizes,
has_valid_scale_extents,
)
from harmony.util import bbox_to_geometry, download, generate_output_filename, stage
from harmony_service_lib.util import (
bbox_to_geometry,
download,
generate_output_filename,
stage,
)
from pystac import Asset, Catalog, Item

from harmony_service.exceptions import HyBIGInvalidMessageError, HyBIGServiceError
Expand Down
2 changes: 1 addition & 1 deletion harmony_service/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Module defining harmony service errors raised by HyBIG service."""

from harmony.util import HarmonyException
from harmony_service_lib.util import HarmonyException

SERVICE_NAME = 'harmony-browse-image-generator'

Expand Down
4 changes: 2 additions & 2 deletions hybig/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import numpy as np
import rasterio
from affine import dumpsw
from harmony.message import Message as HarmonyMessage
from harmony.message import Source as HarmonySource
from harmony_service_lib.message import Message as HarmonyMessage
from harmony_service_lib.message import Source as HarmonySource
from matplotlib.cm import ScalarMappable
from matplotlib.colors import Normalize
from numpy import ndarray
Expand Down
2 changes: 1 addition & 1 deletion hybig/browse_utility.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Module containing utility functionality for browse generation."""

from harmony.message import Message as HarmonyMessage
from harmony_service_lib.message import Message as HarmonyMessage


def get_harmony_message_from_params(params: dict | None) -> HarmonyMessage:
Expand Down
2 changes: 1 addition & 1 deletion hybig/color_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np
import requests
from harmony.message import Source as HarmonySource
from harmony_service_lib.message import Source as HarmonySource
from osgeo_utils.auxiliary.color_palette import ColorPalette
from pystac import Item
from rasterio.io import DatasetReader
Expand Down
2 changes: 1 addition & 1 deletion hybig/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

from harmony.message import SRS
from harmony_service_lib.message import SRS
from pyproj.crs import CRS as pyCRS

# pylint: disable-next=no-name-in-module
Expand Down
8 changes: 6 additions & 2 deletions hybig/sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@

import numpy as np
from affine import Affine
from harmony.message import Message
from harmony.message_utility import has_dimensions, has_scale_extents, has_scale_sizes
from harmony_service_lib.message import Message
from harmony_service_lib.message_utility import (
has_dimensions,
has_scale_extents,
has_scale_sizes,
)

# pylint: disable-next=no-name-in-module
from rasterio.crs import CRS
Expand Down
4 changes: 2 additions & 2 deletions pip_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
harmony-service-lib~=1.0.27
harmony-service-lib~=2.0.0
matplotlib==3.9.0
numpy==1.26.4
pillow==10.4.0
pyproj==3.6.1
pystac~=0.5.6
pystac~=1.0.1
rasterio==1.3.10
rioxarray==0.17.0
4 changes: 2 additions & 2 deletions tests/test_service/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from unittest.mock import call, patch

import numpy as np
from harmony.message import Message
from harmony.util import config
from harmony_service_lib.message import Message
from harmony_service_lib.util import config
from pystac import Catalog
from rasterio.transform import array_bounds, from_bounds
from rasterio.warp import Resampling
Expand Down
4 changes: 2 additions & 2 deletions tests/test_service/unit/test_adapter_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from unittest import TestCase
from unittest.mock import Mock

from harmony.message import Message
from harmony.util import config
from harmony_service_lib.message import Message
from harmony_service_lib.util import config
from pystac import Asset, Item

from harmony_service.adapter import BrowseImageGeneratorAdapter
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from unittest.mock import MagicMock, Mock, call, patch

import numpy as np
from harmony.message import SRS
from harmony.message import Message as HarmonyMessage
from harmony.message import Source as HarmonySource
from harmony_service_lib.message import SRS
from harmony_service_lib.message import Message as HarmonyMessage
from harmony_service_lib.message import Source as HarmonySource
from numpy.testing import assert_array_equal
from osgeo_utils.auxiliary.color_palette import ColorPalette
from PIL import Image
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_color_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from unittest import TestCase
from unittest.mock import Mock, patch

from harmony.message import Source as HarmonySource
from harmony_service_lib.message import Source as HarmonySource
from osgeo_utils.auxiliary.color_palette import ColorPalette
from pystac import Asset, Item
from rasterio import DatasetReader
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from unittest.mock import patch

from affine import Affine
from harmony.message import SRS
from harmony_service_lib.message import SRS
from rasterio.crs import CRS
from rioxarray import open_rasterio

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from unittest.mock import MagicMock, patch

import rasterio
from harmony.message import Message
from harmony_service_lib.message import Message
from rasterio import Affine
from rasterio.crs import CRS
from rioxarray import open_rasterio
Expand Down
2 changes: 1 addition & 1 deletion tests/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections import namedtuple
from datetime import datetime

from harmony.util import bbox_to_geometry
from harmony_service_lib.util import bbox_to_geometry
from pystac import Asset, Catalog, Item

Granule = namedtuple('Granule', ['url', 'media_type', 'roles'])
Expand Down

0 comments on commit 2e1d99f

Please sign in to comment.