Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakharov committed Aug 30, 2024
1 parent c27e0db commit 3b74bf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion aeronet_raster/aeronet_raster/__version__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION = (0, 2, 3)
VERSION = (0, 2, 4)

__version__ = '.'.join(map(str, VERSION))
15 changes: 8 additions & 7 deletions aeronet_raster/aeronet_raster/dataprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,20 @@ def get_auto_cropped_processor(processor: Callable, margin: Sequence[int], mode:
blend_mask: mask to use. Must be same size as the sample. If not specified, will be calculated for each sample
Returns: Callable
"""
if mode not in DST_MARGIN_MODES:
raise ValueError(f'mode must be one of {DST_MARGIN_MODES}')

def inner(x):
if mode == 'crop':
return processor(x)[tuple(slice(margin[i], x.shape[i]-margin[i], 1) for i in range(len(margin)))]
if mode == 'crossfade':
if mode == 'crop':
def inner(x):
output = processor(x)
return output[tuple(slice(margin[i], output.shape[i]-margin[i], 1) for i in range(len(margin)))]
elif mode == 'crossfade':
def inner(x):
output = processor(x)
if blend_mask is None:
mask = get_blend_mask(output.shape, margin)
else:
mask = blend_mask
return output*mask
else:
raise ValueError(f'mode must be one of {DST_MARGIN_MODES}')
return inner


Expand Down

0 comments on commit 3b74bf9

Please sign in to comment.