diff --git a/hybig/browse.py b/hybig/browse.py index c5237fb..a9a020d 100644 --- a/hybig/browse.py +++ b/hybig/browse.py @@ -181,7 +181,7 @@ def create_browse_imagery( f'incorrect number of bands for image: {rio_in_array.rio.count}' ) - raster, color_map = prepare_raster_for_writing( + raster, color_map = standardize_raster_for_writing( raster, output_driver, rio_in_array.rio.count ) @@ -357,7 +357,7 @@ def image_driver(mime: str) -> str: return 'PNG' -def prepare_raster_for_writing( +def standardize_raster_for_writing( raster: ndarray, driver: str, band_count: int, diff --git a/tests/test_service/test_adapter.py b/tests/test_service/test_adapter.py index f4e87ff..eb11b65 100644 --- a/tests/test_service/test_adapter.py +++ b/tests/test_service/test_adapter.py @@ -19,7 +19,7 @@ from harmony_service.exceptions import HyBIGServiceError from hybig.browse import ( convert_mulitband_to_raster, - prepare_raster_for_writing, + standardize_raster_for_writing, ) from tests.utilities import Granule, create_stac @@ -460,7 +460,7 @@ def move_tif(*args, **kwargs): 'count': 3, } raster = convert_mulitband_to_raster(rio_data_array) - raster, color_map = prepare_raster_for_writing(raster, 'PNG', 3) + raster, color_map = standardize_raster_for_writing(raster, 'PNG', 3) dest = np.full( (expected_params['height'], expected_params['width']), diff --git a/tests/unit/test_browse.py b/tests/unit/test_browse.py index dc89feb..4f9c1c2 100644 --- a/tests/unit/test_browse.py +++ b/tests/unit/test_browse.py @@ -30,7 +30,7 @@ output_image_file, output_world_file, palettize_raster, - prepare_raster_for_writing, + standardize_raster_for_writing, validate_file_crs, validate_file_type, ) @@ -653,48 +653,48 @@ def test_convert_5_multiband_to_raster(self): 'Cannot create image from 5 band image. Expecting 3 or 4 bands.', ) - def test_prepare_raster_for_writing_jpeg_3band(self): + def test_standardize_raster_for_writing_jpeg_3band(self): raster = self.random.integers(255, size=(3, 5, 6)) count = 'irrelevant' driver = 'JPEG' expected_raster = np.copy(raster) expected_color_map = None - actual_raster, actual_color_map = prepare_raster_for_writing( + actual_raster, actual_color_map = standardize_raster_for_writing( raster, driver, count ) self.assertEqual(expected_color_map, actual_color_map) np.testing.assert_array_equal(expected_raster, actual_raster, strict=True) - def test_prepare_raster_for_writing_jpeg_4band(self): + def test_standardize_raster_for_writing_jpeg_4band(self): raster = self.random.integers(255, size=(4, 7, 8)) driver = 'JPEG' count = 'irrelevant' expected_raster = np.copy(raster[0:3, :, :]) expected_color_map = None - actual_raster, actual_color_map = prepare_raster_for_writing( + actual_raster, actual_color_map = standardize_raster_for_writing( raster, driver, count ) self.assertEqual(expected_color_map, actual_color_map) np.testing.assert_array_equal(expected_raster, actual_raster, strict=True) @patch('hybig.browse.palettize_raster') - def test_prepare_raster_for_writing_png_4band(self, palettize_mock): + def test_standardize_raster_for_writing_png_4band(self, palettize_mock): raster = self.random.integers(255, size=(4, 7, 8)) driver = 'PNG' count = 'not 1' - expected, _ = prepare_raster_for_writing(raster, driver, count) + expected, _ = standardize_raster_for_writing(raster, driver, count) np.testing.assert_array_equal(raster, expected, strict=True) palettize_mock.assert_not_called() @patch('hybig.browse.palettize_raster') - def test_prepare_raster_for_writing_png_3band(self, palettize_mock): + def test_standardize_raster_for_writing_png_3band(self, palettize_mock): raster = self.random.integers(255, size=(3, 7, 8)) driver = 'PNG' count = 'not 1' - expected, _ = prepare_raster_for_writing(raster, driver, count) + expected, _ = standardize_raster_for_writing(raster, driver, count) np.testing.assert_array_equal(raster, expected, strict=True) palettize_mock.assert_not_called() @@ -704,7 +704,7 @@ def test_prepare_1band_raster_for_writing_png(self, palettize_mock): driver = 'PNG' count = 1 palettize_mock.return_value = (None, None) - expected, _ = prepare_raster_for_writing(raster, driver, count) + expected, _ = standardize_raster_for_writing(raster, driver, count) palettize_mock.assert_called_with(raster) @patch('hybig.browse.Image')