Grid¶
aef_bng.grid
¶
BNG output grid definition and chunk enumeration.
Enumerates 10km BNG chunks covering the requested bounds, computing the affine transform, pixel shape, and WGS84 bounds for each chunk.
ChunkSpec(bng_10km_ref, bounds_bng, bounds_wgs84, shape=(1000, 1000), transform=None)
dataclass
¶
Specification for a single 10km BNG processing chunk.
Attributes:
| Name | Type | Description |
|---|---|---|
bng_10km_ref |
str
|
10km BNG grid reference string (e.g. "SU14"). |
bounds_bng |
tuple[int, int, int, int]
|
BNG bounding box (minx, miny, maxx, maxy) in EPSG:27700. |
bounds_wgs84 |
tuple[float, float, float, float]
|
Same bounds transformed to WGS84 (EPSG:4326). |
shape |
tuple[int, int]
|
Pixel dimensions (rows, cols) - always (1000, 1000) for 10km at 10m. |
transform |
Affine | None
|
Affine transform for this chunk's raster grid. |
__post_init__()
¶
Compute the affine transform from bounds if not explicitly provided.
Source code in aef_bng/grid.py
BNGOutputGrid(bounds=BNG_BOUNDS, chunk_size=CHUNK_SIZE)
¶
Enumerates 10km BNG grid chunks within given bounds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bounds
|
tuple[int, int, int, int]
|
BNG bounding box (minx, miny, maxx, maxy) in EPSG:27700. |
BNG_BOUNDS
|
chunk_size
|
int
|
Chunk size in metres (default 10,000 for 10km). |
CHUNK_SIZE
|
Source code in aef_bng/grid.py
enumerate_chunks()
¶
Enumerate all 10km BNG chunks within the configured bounds.
Uses osbng.bbox_to_bng to generate valid 10km grid references,
then builds a ChunkSpec for each with aligned affine transforms.
Returns:
| Type | Description |
|---|---|
list[ChunkSpec]
|
List of ChunkSpec objects covering the bounds. |