Skip to content

Commit bab4146

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent bc0a938 commit bab4146

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

hybig/browse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def scale_paletted_1band(
315315
data_array: DataArray, palette: ColorPalette
316316
) -> tuple[ndarray, ColorMap]:
317317
"""Scale a 1-band image with palette into modified image and associated color_map.
318-
318+
319319
Use the palette's levels and values, transform the input data_array into
320320
the correct levels indexed from 0-255 return the scaled array along side of
321321
a colormap corresponding to the new levels.

hybig/color_utility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def get_color_palette(
9898
# (usually the only one)
9999
ds_cmap['nv'] = ds_cmap[ndv_tuple[0]]
100100
# then remove the value associated with the ndv key
101-
ds_cmap.pop(ndv_tuple[0])
101+
ds_cmap.pop(ndv_tuple[0])
102102
return convert_colormap_to_palette(ds_cmap)
103103
except ValueError:
104104
return None

tests/unit/test_browse.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def test_create_browse_imagery_with_mocks(
220220
src_crs=da_mock.rio.crs,
221221
dst_transform=target_transform,
222222
dst_crs=CRS.from_string('EPSG:4326'),
223-
dst_nodata=255, # NODATA_IDX
223+
dst_nodata=255, # NODATA_IDX
224224
resampling=Resampling.nearest,
225225
),
226226
]
@@ -305,19 +305,18 @@ def test_convert_singleband_to_raster_with_colormap(self):
305305
dtype='uint8',
306306
)
307307
expected_palette = {
308-
0: (255, 0, 0, 255), # red
309-
1: (255, 255, 0, 255), # yellow
310-
2: (0, 255, 0, 255), # green
311-
3: (0, 0, 255, 255), # blue
312-
4: (0, 0, 0, 0), # alpha
308+
0: (255, 0, 0, 255), # red
309+
1: (255, 255, 0, 255), # yellow
310+
2: (0, 255, 0, 255), # green
311+
3: (0, 0, 255, 255), # blue
312+
4: (0, 0, 0, 0), # alpha
313313
}
314314
# Read down: red, yellow, green, blue
315315
image_palette = convert_colormap_to_palette(self.colormap)
316316
actual_raster, actual_palette = convert_singleband_to_raster(ds, image_palette)
317317
assert_array_equal(expected_raster, actual_raster, strict=True)
318318
assert_equal(expected_palette, actual_palette)
319319

320-
321320
def test_convert_singleband_to_raster_with_colormap_and_bad_data(self):
322321
data_array = np.array(self.data, dtype='float')
323322
data_array[0, 0] = np.nan
@@ -337,11 +336,11 @@ def test_convert_singleband_to_raster_with_colormap_and_bad_data(self):
337336
dtype='uint8',
338337
)
339338
expected_palette = {
340-
0: (255, 0, 0, 255), # red
341-
1: (255, 255, 0, 255), # yellow
342-
2: (0, 255, 0, 255), # green
343-
3: (0, 0, 255, 255), # blue
344-
4: (10, 20, 30, 40), # nv
339+
0: (255, 0, 0, 255), # red
340+
1: (255, 255, 0, 255), # yellow
341+
2: (0, 255, 0, 255), # green
342+
3: (0, 0, 255, 255), # blue
343+
4: (10, 20, 30, 40), # nv
345344
}
346345

347346
colormap = {**self.colormap, 'nv': nv_color}

0 commit comments

Comments
 (0)