raster_tools.blocks.GeoBlockInfo#

class raster_tools.blocks.GeoBlockInfo(geobox, band_slice, row_slice, col_slice, chunk_location, parent_affine, parent_shape)[source]#

Geo-aware metadata for a single dask block.

Mirrors dask’s per-block block_info dict, but carries the block’s geographic grid (a 2D GeoBox) plus enough parent-array context for chunk-local code to locate itself within the full raster. Holds no pixel data.

Parameters
  • geobox (odc.geo.geobox.GeoBox) – The 2D grid ((ny, nx)) for this block. Source of truth for affine, crs, and bbox.

  • band_slice (slice) – Half-open [start, stop) slices identifying where this block sits inside the parent array’s band, row, and column axes.

  • row_slice (slice) – Half-open [start, stop) slices identifying where this block sits inside the parent array’s band, row, and column axes.

  • col_slice (slice) – Half-open [start, stop) slices identifying where this block sits inside the parent array’s band, row, and column axes.

  • chunk_location (tuple of int) – The (bi, yi, xi) block index in the parent array’s numblocks grid. Preserved across mutators (still names the originating block even after padding/shifting).

  • parent_affine (affine.Affine) – Affine of the full raster this block came from. Needed by callers like Raster.to_points to map block-local cells back to parent row/col.

  • parent_shape (tuple of int) – (nbands, ny, nx) of the full raster. Used for parent-array ravel-index computations.

__init__(geobox, band_slice, row_slice, col_slice, chunk_location, parent_affine, parent_shape)[source]#

Methods

__init__(geobox, band_slice, row_slice, ...)

pad(y[, x])

Symmetrically pad the block in both axes by y and x.

pad_x(left, right)

Grow (or trim, with negative values) the block on left/right.

pad_y(top, bottom)

Grow (or trim, with negative values) the block on top/bottom.

shift(y[, x])

Slide the window in both axes.

shift_x(n)

Slide the block window horizontally.

shift_y(n)

Slide the block window vertically.

to_dataarray(data, *[, mask, nodata])

Wrap a block's pixel data as a georeferenced xarray.DataArray.

Attributes

affine

band

bbox

crs

shape

3D (nbands, ny, nx) block shape.

x

y