# I/O and memory management
By default the chain processes the entire output in a single pass. When the raster, grid or output dimensions become large, this approach can exceed available memory. Three parameters let you trade memory against the number of I/O operations: `io_strip_size`, `io_strip_size_target` and `tile_shape`.
**What you'll learn**
- The chain's main loop: strips and tiles
- How `io_strip_size` and `io_strip_size_target` control row stripping
- How `tile_shape` further subdivides each strip
- How to enable debug logging via the `logger` argument
- The chain's separate `grid_ds` / `grid_col_ds` arguments
## The main loop
`basic_grid_resampling_chain` processes the output raster in sequential row strips. For each strip, it computes all the output columns (or the subset defined by `win`) of a contiguous range of rows. The maximum strip height is `io_strip_size`.
`io_strip_size_target` selects how that height is interpreted:
- `GridRIOMode.OUTPUT` (default): the height is expressed in **output** rows.
- `GridRIOMode.INPUT`: the height is expressed in **input grid** rows and scaled by `grid_resolution`.
Setting `io_strip_size = 0` disables stripping (the whole output is processed at once).
At each iteration the chain reads only the source-raster region needed for the current output strip. Two reusable buffers are pre-allocated (input grid data, output raster data), sized to the largest strip.
## Internal tiling
`tile_shape` further divides each strip into `(nrows, ncols)` tiles. For each tile, the chain calls `array_compute_resampling_grid_geometries` to determine the minimal bounding box of source pixels required, then reads only that region. Tiles entirely outside the source domain or fully masked by the grid mask are skipped.
Tiling is most beneficial when the grid is diagonal relative to the source raster, since rectangular reads otherwise pull in large amounts of unused data. Tiles do **not** share memory for the input data, so the same source area may be read several times; very small tiles cause redundant reads. Setting `tile_shape = None` disables tiling.
## A note on the *basic* prefix
The `basic_` prefix marks the lack of automatic parameter tuning. Optimal `io_strip_size` and `tile_shape` values depend on the actual grid coordinates, not on the chain parameters themselves. Future versions may automate this; for now, set the parameters based on what you know about your grid."),
## Configuring a debug logger
Passing a `logging.Logger` configured at `DEBUG` level through the `logger` argument enables verbose tracing of the strip/tile iterations -- useful when fine-tuning the parameters.
```python
import logging
from gridr.io.common import GridRIOMode
log_file = "./gridr_resampling_chain_007_gridr_log.log"
fhandler = logging.FileHandler(filename=log_file, mode="w")
fhandler.setFormatter(logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
))
gridr_logger = logging.getLogger("gridr")
gridr_logger.setLevel(logging.DEBUG)
gridr_logger.addHandler(fhandler)
```
## Running with explicit stripping and tiling
Below we cap the output strip at 200 rows (giving 2 strips for a 393-row output) and divide each strip into `(200, 160)` tiles.
```python
with rasterio.open(GRID_IN_F64, "r") as grid_in_ds, \
rasterio.open(RASTER_IN, "r") as array_src_ds, \
rasterio.open(grid_mask_in_path, "r") as grid_mask_in_ds, \
rasterio.open(raster_mask_in_path_u8, "r") as raster_mask_in_ds, \
rasterio.open(output_raster_path, "w", **raster_out_open_args) as array_out_ds, \
rasterio.open(output_mask_path, "w", **mask_out_open_args) as mask_out_ds:
basic_grid_resampling_chain(
grid_ds = grid_in_ds,
grid_row_coords_band = 1,
grid_col_coords_band = 2,
grid_resolution = grid_resolution,
array_src_ds = array_src_ds,
array_src_bands = 1,
array_out_ds = array_out_ds,
interp = "cubic",
nodata_out = 0,
mask_out_ds = mask_out_ds,
grid_mask_in_ds = grid_mask_in_ds,
grid_mask_in_unmasked_value = grid_mask_in_valid_value,
grid_mask_in_band = 1,
array_src_mask_ds = raster_mask_in_ds,
array_src_mask_band = 1,
array_src_mask_validity_pair = (array_src_mask_validity_valid,
array_src_mask_validity_invalid),
# I/O controls:
io_strip_size = 200,
io_strip_size_target = GridRIOMode.OUTPUT,
tile_shape = (200, 160),
logger = gridr_logger,
)
```
The log file produced is shown below (scrollable). Each line traces a strip / tile iteration with the source read window it required.
2026-06-04 17:10:18,608 - gridr.scaling.shared_array - DEBUG - shared backend auto: mmap (fork available, /dev/shm tight)
2026-06-04 17:10:18,608 - gridr.scaling.shared_array - INFO - shared backend active: mmap
2026-06-04 17:10:18,609 - gridr - INFO - Using shared-array backend: mmap
2026-06-04 17:10:18,609 - gridr - DEBUG - Grid shape : 50 rows x 40 columns
2026-06-04 17:10:18,609 - gridr - DEBUG - Grid mask shape : 50 rows x 40 columns
2026-06-04 17:10:18,609 - gridr - DEBUG - Grid mask unmasked value : 1
2026-06-04 17:10:18,609 - gridr - DEBUG - Grid mask dtype : uint8
2026-06-04 17:10:18,609 - gridr - DEBUG - Computed strip size (number of rows) : 200
2026-06-04 17:10:18,609 - gridr - DEBUG - Computed full output shape : 393 rows x 313 columns
2026-06-04 17:10:18,609 - gridr - DEBUG - No window given : the full grid is considered as window
2026-06-04 17:10:18,609 - gridr - DEBUG - Window : [[ 0 392]
[ 0 312]]
2026-06-04 17:10:18,609 - gridr - DEBUG - Shape out : [393 313]
2026-06-04 17:10:18,610 - gridr - DEBUG - Read grid buffer shape : [26 40]
2026-06-04 17:10:18,610 - gridr - DEBUG - Read grid buffer shape 3 : [ 2 26 40]
2026-06-04 17:10:18,610 - gridr - DEBUG - Create float64 computation array buffer with shape [ 1 200 313]
2026-06-04 17:10:18,610 - gridr - DEBUG - Create float64 computation array buffer with shape [ 1 200 313] DONE
2026-06-04 17:10:18,610 - gridr - DEBUG - Create write mask buffer with shape [200 313]
2026-06-04 17:10:18,611 - gridr - DEBUG - Create write mask buffer with shape [200 313] DONE
2026-06-04 17:10:18,611 - gridr - DEBUG - Initializing interpolator optimized_bicubic
2026-06-04 17:10:18,611 - gridr - DEBUG - Required margins for interpolator optimized_bicubic : [[2 2]
[2 2]]
2026-06-04 17:10:18,611 - gridr - DEBUG - Chunk 0 - chunk_win: [[ 0 199]
[ 0 312]]
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - shape : (np.int64(200), np.int64(313))
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - grid read shape : (np.int64(26), np.int64(40))
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - buffer slices : (slice(0, 200, None), slice(0, 313, None))
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - buffer slices as win : [[ 0 199]
[ 0 312]]
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - target write window : [[ 0 199]
[ 0 312]]
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - resampling starts...
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - Tiled processing with tiles of 200 x 160
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - Number of tiles to process : 2
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - preparing args...
2026-06-04 17:10:18,612 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - tile's chunk origin : [0 0]
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - tile window : [[ 0 199]
[ 0 159]]
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - tile full-resolution window within the chunk's grid : [[ 0 199]
[ 0 159]]
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Required margins for interpolator optimized_bicubic : [[2 2]
[2 2]]
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Computing grid metrics...
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - SAFECHECK_SOURCE_BOUNDARIES : Computing source boundaries...
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - SAFECHECK_SOURCE_BOUNDARIES : GeometryBoundsF64(xmin=-2.37, xmax=169.62999999999997, ymin=-54.230000000000004, ymax=129.77)
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - dst low res bounds : GeometryBoundsUsize(xmin=0, xmax=20, ymin=0, ymax=25)
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - src bounds : GeometryBoundsF64(xmin=-2.37, xmax=169.62999999999997, ymin=-54.230000000000004, ymax=129.77)
2026-06-04 17:10:18,613 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - dst win : [[ 0 25]
[ 0 20]]
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - src read win (preliminary) : [[-55 130]
[ -3 170]]
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - src read win (preliminary) overflow : [[55 0]
[ 3 0]]
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - src read win before margin : [[ 0 130]
[ 0 170]]
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - src read win after margin : [[ -2 132]
[ -2 172]]
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - src read win required pad : [[2 0]
[2 0]]
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - src read win read : [[ 0 132]
[ 0 172]] with shape (np.int64(133), np.int64(173))
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Computing required memory for array source read
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - memory needed for array_src_win + margin band 1: 181632 bytes
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Computing required memory for array source mask read
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Memory required for array_src_mask_win + margin : 22704 bytes
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Memory required for array_src_mask + margin : 22704 bytes
2026-06-04 17:10:18,614 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Total memory required for array_src_win and mask : 204336 bytes
2026-06-04 17:10:18,615 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - tile read buffer shape : [ 1 135 175]
2026-06-04 17:10:18,615 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Reading tiles...
2026-06-04 17:10:18,615 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Reading source window for source band 1 - source window : [[ 0 132]
[ 0 172]] - target indices : (0, slice(np.int64(2), np.int64(135), None), slice(np.int64(2), np.int64(175), None)) ...
2026-06-04 17:10:18,615 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Reading source window for source band 1 - source window : [[ 0 132]
[ 0 172]] - target indices : (0, slice(np.int64(2), np.int64(135), None), slice(np.int64(2), np.int64(175), None)) [DONE]
2026-06-04 17:10:18,615 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Reading source window for source mask - source window : [[ 0 132]
[ 0 172]] - target indices : (slice(np.int64(2), np.int64(135), None), slice(np.int64(2), np.int64(175), None)) ...
2026-06-04 17:10:18,616 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([ 0, 160])) - - Reading source window for source mask - source window : [[ 0 132]
[ 0 172]] - target indices : (slice(np.int64(2), np.int64(135), None), slice(np.int64(2), np.int64(175), None)) [DONE]
2026-06-04 17:10:18,618 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - preparing args...
2026-06-04 17:10:18,618 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - tile's chunk origin : [0 0]
2026-06-04 17:10:18,618 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - tile window : [[ 0 199]
[160 312]]
2026-06-04 17:10:18,618 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - tile full-resolution window within the chunk's grid : [[ 0 199]
[160 312]]
2026-06-04 17:10:18,618 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Required margins for interpolator optimized_bicubic : [[2 2]
[2 2]]
2026-06-04 17:10:18,618 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Computing grid metrics...
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - SAFECHECK_SOURCE_BOUNDARIES : Computing source boundaries...
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - SAFECHECK_SOURCE_BOUNDARIES : GeometryBoundsF64(xmin=139.62999999999997, xmax=304.53, ymin=-105.53000000000002, ymax=75.77000000000001)
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - dst low res bounds : GeometryBoundsUsize(xmin=20, xmax=39, ymin=0, ymax=25)
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - src bounds : GeometryBoundsF64(xmin=139.62999999999997, xmax=304.53, ymin=-105.53000000000002, ymax=75.77000000000001)
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - dst win : [[ 0 25]
[20 39]]
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - src read win (preliminary) : [[-106 76]
[ 139 305]]
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - src read win (preliminary) overflow : [[106 0]
[ 0 0]]
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - src read win before margin : [[ 0 76]
[139 305]]
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - src read win after margin : [[ -2 78]
[137 307]]
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - src read win required pad : [[2 0]
[0 0]]
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - src read win read : [[ 0 78]
[137 307]] with shape (np.int64(79), np.int64(171))
2026-06-04 17:10:18,619 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Computing required memory for array source read
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - memory needed for array_src_win + margin band 1: 106080 bytes
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Computing required memory for array source mask read
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Memory required for array_src_mask_win + margin : 13260 bytes
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Memory required for array_src_mask + margin : 13260 bytes
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Total memory required for array_src_win and mask : 119340 bytes
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - tile read buffer shape : [ 1 81 171]
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Reading tiles...
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Reading source window for source band 1 - source window : [[ 0 78]
[137 307]] - target indices : (0, slice(np.int64(2), np.int64(81), None), slice(np.int64(0), np.int64(171), None)) ...
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Reading source window for source band 1 - source window : [[ 0 78]
[137 307]] - target indices : (0, slice(np.int64(2), np.int64(81), None), slice(np.int64(0), np.int64(171), None)) [DONE]
2026-06-04 17:10:18,620 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Reading source window for source mask - source window : [[ 0 78]
[137 307]] - target indices : (slice(np.int64(2), np.int64(81), None), slice(np.int64(0), np.int64(171), None)) ...
2026-06-04 17:10:18,621 - gridr - DEBUG - Chunk 0 - tile ((0, np.int64(200)), array([160, 313])) - - Reading source window for source mask - source window : [[ 0 78]
[137 307]] - target indices : (slice(np.int64(2), np.int64(81), None), slice(np.int64(0), np.int64(171), None)) [DONE]
2026-06-04 17:10:18,622 - gridr - DEBUG - Chunk 0 - write for full strip...
2026-06-04 17:10:18,622 - gridr - DEBUG - Chunk 0 - write ends.
2026-06-04 17:10:18,622 - gridr - DEBUG - Chunk 0 - write mask for full strip...
2026-06-04 17:10:18,622 - gridr - DEBUG - Chunk 0 - write mask ends.
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - chunk_win: [[200 392]
[ 0 312]]
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - shape : (np.int64(193), np.int64(313))
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - grid read shape : (np.int64(25), np.int64(40))
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - buffer slices : (slice(0, 193, None), slice(0, 313, None))
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - buffer slices as win : [[ 0 192]
[ 0 312]]
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - target write window : [[200 392]
[ 0 312]]
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - resampling starts...
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - Tiled processing with tiles of 200 x 160
2026-06-04 17:10:18,623 - gridr - DEBUG - Chunk 1 - Number of tiles to process : 2
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - preparing args...
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - tile's chunk origin : [200 0]
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - tile window : [[ 0 192]
[ 0 159]]
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - tile full-resolution window within the chunk's grid : [[ 0 192]
[ 0 159]]
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Required margins for interpolator optimized_bicubic : [[2 2]
[2 2]]
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Computing grid metrics...
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - SAFECHECK_SOURCE_BOUNDARIES : Computing source boundaries...
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - SAFECHECK_SOURCE_BOUNDARIES : GeometryBoundsF64(xmin=27.63, xmax=198.42999999999998, ymin=75.77000000000001, ymax=254.57)
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - dst low res bounds : GeometryBoundsUsize(xmin=0, xmax=20, ymin=0, ymax=24)
2026-06-04 17:10:18,624 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - src bounds : GeometryBoundsF64(xmin=27.63, xmax=198.42999999999998, ymin=75.77000000000001, ymax=254.57)
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - dst win : [[ 0 24]
[ 0 20]]
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - src read win (preliminary) : [[ 75 255]
[ 27 199]]
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - src read win (preliminary) overflow : [[0 0]
[0 0]]
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - src read win before margin : [[ 75 255]
[ 27 199]]
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - src read win after margin : [[ 73 257]
[ 25 201]]
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - src read win required pad : [[0 0]
[0 0]]
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - src read win read : [[ 73 257]
[ 25 201]] with shape (np.int64(185), np.int64(177))
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Computing required memory for array source read
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - memory needed for array_src_win + margin band 1: 259072 bytes
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Computing required memory for array source mask read
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Memory required for array_src_mask_win + margin : 32384 bytes
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Memory required for array_src_mask + margin : 32384 bytes
2026-06-04 17:10:18,625 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Total memory required for array_src_win and mask : 291456 bytes
2026-06-04 17:10:18,626 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - tile read buffer shape : [ 1 185 177]
2026-06-04 17:10:18,626 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Reading tiles...
2026-06-04 17:10:18,626 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Reading source window for source band 1 - source window : [[ 73 257]
[ 25 201]] - target indices : (0, slice(np.int64(0), np.int64(185), None), slice(np.int64(0), np.int64(177), None)) ...
2026-06-04 17:10:18,626 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Reading source window for source band 1 - source window : [[ 73 257]
[ 25 201]] - target indices : (0, slice(np.int64(0), np.int64(185), None), slice(np.int64(0), np.int64(177), None)) [DONE]
2026-06-04 17:10:18,627 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Reading source window for source mask - source window : [[ 73 257]
[ 25 201]] - target indices : (slice(np.int64(0), np.int64(185), None), slice(np.int64(0), np.int64(177), None)) ...
2026-06-04 17:10:18,627 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([ 0, 160])) - - Reading source window for source mask - source window : [[ 73 257]
[ 25 201]] - target indices : (slice(np.int64(0), np.int64(185), None), slice(np.int64(0), np.int64(177), None)) [DONE]
2026-06-04 17:10:18,628 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - preparing args...
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - tile's chunk origin : [200 0]
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - tile window : [[ 0 192]
[160 312]]
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - tile full-resolution window within the chunk's grid : [[ 0 192]
[160 312]]
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Required margins for interpolator optimized_bicubic : [[2 2]
[2 2]]
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Computing grid metrics...
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - SAFECHECK_SOURCE_BOUNDARIES : Computing source boundaries...
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - SAFECHECK_SOURCE_BOUNDARIES : GeometryBoundsF64(xmin=169.62999999999997, xmax=333.33, ymin=24.47, ymax=200.57)
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - dst low res bounds : GeometryBoundsUsize(xmin=20, xmax=39, ymin=0, ymax=24)
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - src bounds : GeometryBoundsF64(xmin=169.62999999999997, xmax=333.33, ymin=24.47, ymax=200.57)
2026-06-04 17:10:18,629 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - dst win : [[ 0 24]
[20 39]]
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - src read win (preliminary) : [[ 24 201]
[169 334]]
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - src read win (preliminary) overflow : [[0 0]
[0 0]]
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - src read win before margin : [[ 24 201]
[169 334]]
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - src read win after margin : [[ 22 203]
[167 336]]
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - src read win required pad : [[0 0]
[0 0]]
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - src read win read : [[ 22 203]
[167 336]] with shape (np.int64(182), np.int64(170))
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Computing required memory for array source read
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - memory needed for array_src_win + margin band 1: 244712 bytes
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Computing required memory for array source mask read
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Memory required for array_src_mask_win + margin : 30589 bytes
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Memory required for array_src_mask + margin : 30589 bytes
2026-06-04 17:10:18,630 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Total memory required for array_src_win and mask : 275301 bytes
2026-06-04 17:10:18,631 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - tile read buffer shape : [ 1 182 170]
2026-06-04 17:10:18,631 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Reading tiles...
2026-06-04 17:10:18,631 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Reading source window for source band 1 - source window : [[ 22 203]
[167 336]] - target indices : (0, slice(np.int64(0), np.int64(182), None), slice(np.int64(0), np.int64(170), None)) ...
2026-06-04 17:10:18,631 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Reading source window for source band 1 - source window : [[ 22 203]
[167 336]] - target indices : (0, slice(np.int64(0), np.int64(182), None), slice(np.int64(0), np.int64(170), None)) [DONE]
2026-06-04 17:10:18,631 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Reading source window for source mask - source window : [[ 22 203]
[167 336]] - target indices : (slice(np.int64(0), np.int64(182), None), slice(np.int64(0), np.int64(170), None)) ...
2026-06-04 17:10:18,631 - gridr - DEBUG - Chunk 1 - tile ((0, np.int64(193)), array([160, 313])) - - Reading source window for source mask - source window : [[ 22 203]
[167 336]] - target indices : (slice(np.int64(0), np.int64(182), None), slice(np.int64(0), np.int64(170), None)) [DONE]
2026-06-04 17:10:18,633 - gridr - DEBUG - Chunk 1 - write for full strip...
2026-06-04 17:10:18,633 - gridr - DEBUG - Chunk 1 - write ends.
2026-06-04 17:10:18,633 - gridr - DEBUG - Chunk 1 - write mask for full strip...
2026-06-04 17:10:18,633 - gridr - DEBUG - Chunk 1 - write mask ends.
## Separate datasets for row and column grids
`basic_grid_resampling_chain` accepts `grid_ds` for row coordinates and an optional `grid_col_ds` for column coordinates. When `grid_col_ds` is `None` (default) or the same object as `grid_ds`, band 1 holds row coordinates and band 2 holds column coordinates in the same file -- the convention used throughout this tutorial series. Providing two distinct files is useful when the grid is stored split across separate rasters.