GDAL-backed physical chunk model for the drb:image class
Project description
drb-chunk-image
GDAL-backed physical chunk model for the drb:image class, built on top of
the drb-chunk add-on.
What it is
drb-chunk-image teaches drb-chunk how to read a GDAL raster (GeoTIFF,
BigTIFF, COG, JP2, PNG, and any other format GDAL/rasterio can open) on its
native block boundaries instead of on whatever grid a product descriptor
happens to declare. It targets the generic drb:image topic class, not a
single product family — it is the first format chunk add-on, sibling to
the product-specific ones (drb-chunk-sentinel1, drb-chunk-sentinel2).
Concretely, it registers a PhysicalTilingProvider (gdal-blocks) that
probes a raster's block layout — tile shape if the file is internally tiled,
strip shape otherwise — via rasterio, without loading the full raster.
How it self-activates
Installing the package is enough; there is no product-side wiring:
- It registers
GdalBlocksProviderunder thedrb.chunk.physicalentry-point group (drb.addons.chunk.image.provider:GdalBlocksProvider), the seam thedrb-chunkcore uses to discover physical-tiling providers lazily, and a matchingrasterphysical reader viaregister_physical_reader. - It ships a
cortex.ttlcarrying a single triple —<http://www.gael.fr/drb#image> drb:physicalTiling "gdal-blocks"— declared under thedrb.topicentry-point group. The core'sManagerDaomerges every installeddrb.topicdescriptor into one RDF graph, so this triple lands on the existingdrb:imagetopic without touching the driver or any other package.
Once both are installed, any chunk descriptor whose drb:source resolves to
a GDAL-readable file automatically gets a physical chunk model: the core
resolves the source's format topic, reads drb:physicalTiling, looks up
gdal-blocks, and calls probe().
The two-layer model
drb-chunk separates the physical chunk model — the source's native
chunking, discovered (never declared), the unit of I/O this add-on
provides — from the logical chunk model — the output representation a
product chunk declares (a regular N-D grid today; burst, and later
healpix, for other formats). A chunk descriptor with no declared logical
geometry (drb:chunkShape/drb:transformer) simply adopts the physical
grid as its logical grid. A descriptor that declares its own grid (e.g. a
Sentinel-2 512×512 tile over a 1024×1024-tiled JP2) keeps that logical grid,
but reads are still issued on the physical boundaries and remapped into
the requested logical window — so adjacent logical tiles that share a
native block only pay for that block once. probe() also accepts a
multiplier (default 1), reserved for a future drb:nativeMultiplier
descriptor predicate to request an exact multiple of the native block as
the physical unit; it is not wired into the engine yet in this release. For
untiled rasters (strips), the provider falls back to the strip band shape
(rows_per_strip × width) — there is no "tile" to multiply.
Installation
pip install drb-chunk-image
Requires drb-chunk>=0.4.0,<1, rasterio and numpy (installed as
dependencies).
Usage
No API of its own to call — once installed alongside drb-chunk, any
product add-on's Chunk.select(...) over a GDAL-backed source picks up the
physical model transparently:
from drb.topics import resolver
from drb.addons.addon import AddonManager
from drb.chunk.selection import WindowSelection
topic, node = resolver.resolve("/path/to/product.SAFE")
addon = AddonManager().get_addon("chunk")
chunk = addon.apply(node, chunk_name="B04_10m") # e.g. drb-chunk-sentinel2
window = WindowSelection(x=0, y=0, w=512, h=512)
array = chunk.select(window).get_impl(numpy.ndarray)
Reads over B04_10m above are issued on the JP2's native block boundaries
(e.g. 192×192), cached per source node, and remapped into the requested
512×512 window — not read once per 512×512 tile.
Limitations
- Read-only probing: this add-on discovers the native chunking, it does not write or re-tile rasters.
- Single reference band: block shape is probed from band 1
(
ds.block_shapes[0]); mixed per-band block layouts are not modelled. drb:nativeMultiplieris a reserved predicate, not yet read by the core engine —probe(node, multiplier=1)only ever runs with the default today.
Reference
See docs/dev/writing-a-physical-tiling-provider.md
in drb-chunk for the PhysicalTilingProvider contract and how to write a
provider for another format; this add-on is the reference implementation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drb_chunk_image-0.1.1.tar.gz.
File metadata
- Download URL: drb_chunk_image-0.1.1.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4fc4254ad61cb2addb59a91e76ad5ff81c70e00c75722a99a5cf22d36193d40
|
|
| MD5 |
e137711e954e61c0c4b33cd93aed01ca
|
|
| BLAKE2b-256 |
048ab51082fd3d468d9fec90fc53f3efa5c4189f5ec7085007d5ab2d61546951
|
File details
Details for the file drb_chunk_image-0.1.1-py3-none-any.whl.
File metadata
- Download URL: drb_chunk_image-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00ad3fb99527ed7696bee32e9baebf52de014a7eb0ed1752f36411208e0096a8
|
|
| MD5 |
9536846ecbce1f3f46a6f168d05938f2
|
|
| BLAKE2b-256 |
9ef21ad70f78201750c9f459cca27fc61a754cf1e010b61654de47f26580af09
|