diff --git a/src/dolphin/io/_blocks.py b/src/dolphin/io/_blocks.py index e4f120495..78512739c 100644 --- a/src/dolphin/io/_blocks.py +++ b/src/dolphin/io/_blocks.py @@ -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]: diff --git a/tests/test_io_blocks.py b/tests/test_io_blocks.py index 34c815cd0..3e82b2c41 100644 --- a/tests/test_io_blocks.py +++ b/tests/test_io_blocks.py @@ -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