Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dolphin/io/_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def iter_blocks(
def _get_out_nodata_size(self, direction: str) -> int:
half_win = getattr(self.half_window, direction)
stride = getattr(self.strides, direction)
return round(half_win / stride)
return (half_win + stride // 2) // stride

@property
def output_shape(self) -> tuple[int, int]:
Expand Down
12 changes: 10 additions & 2 deletions tests/test_io_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,17 @@ def fake_process_blocks(
@pytest.mark.parametrize("in_shape", [(100, 200), (101, 201)])
@pytest.mark.parametrize(
"half_window",
[HalfWindow(x=1, y=1), HalfWindow(x=3, y=1), HalfWindow(x=3, y=3)],
[
HalfWindow(x=1, y=1),
HalfWindow(x=3, y=1),
HalfWindow(x=3, y=3),
HalfWindow(x=5, y=5),
],
)
@pytest.mark.parametrize(
"strides",
[Strides(1, 1), Strides(2, 2), Strides(1, 3), Strides(3, 3)],
)
@pytest.mark.parametrize("strides", [Strides(1, 1), Strides(1, 3), Strides(3, 3)])
@pytest.mark.parametrize("block_shape", [(15, 15), (20, 30), (17, 27)])
def test_block_manager_fake_process(
self, in_shape, half_window, strides, block_shape
Expand Down
Loading