| Title: | Geospatial Codec Extensions for 'OpenZL' |
|---|---|
| Description: | R bindings to libgeozl, the geospatial codec extensions for OpenZL. |
| Authors: | Cesar Aybar [aut, cre], Asterisk Labs [cph], Meta Platforms, Inc. and affiliates [cph] (OpenZL and Zstandard), Yann Collet [cph] (LZ4) |
| Maintainer: | Cesar Aybar <[email protected]> |
| License: | BSD_3_clause + file LICENSE |
| Version: | 0.19.0 |
| Built: | 2026-10-09 15:09:14 UTC |
| Source: | https://github.com/asterisk-labs/geozl |
Only the frame header is read; the payload is not decompressed.
geozl_coeffs(frame)geozl_coeffs(frame)
frame |
A frame, as a raw vector. |
A list of integer vectors, or NULL when the frame carries none.
Compress a tile
geozl_compress(x, graph, coeffs = NULL)geozl_compress(x, graph, coeffs = NULL)
x |
Tile samples, converted to the graph's datatype. Its geometry is not checked against the graph. |
graph |
A graph from |
coeffs |
Optional list of integer vectors to attach to this frame. Read
them back with |
The frame, as a raw vector.
A frame does not record its datatype or shape; keep them beside it, as Rumi does.
geozl_decompress( frame, datatype = NULL, dim = NULL, as = NULL, nodata = NULL, verify = TRUE, max_output_size = NULL )geozl_decompress( frame, datatype = NULL, dim = NULL, as = NULL, nodata = NULL, verify = TRUE, max_output_size = NULL )
frame |
A frame, as a raw vector. |
datatype |
The storage type the frame was written with. Without it the result is the raw native bytes. |
dim |
Optional dimensions for the result. |
as |
|
nodata |
Samples equal to this value become |
verify |
Whether to check the frame's checksums. |
max_output_size |
Refuse frames that declare more output bytes than this; set it when reading untrusted frames. |
A vector of samples, with dim when given.
A graph fixes the recipe, the storage type and the predictor geometry for every tile compressed with it.
geozl_graph( x, method, width = NULL, planes = NULL, error = NULL, nodata = NULL, datatype = NULL )geozl_graph( x, method, width = NULL, planes = NULL, error = NULL, nodata = NULL, datatype = NULL )
x |
Raster samples: a double, integer or raw vector or array. For a bounded-error graph it fixes the domain later tiles are checked against, so use data spanning the product. |
method |
A recipe such as |
width, planes
|
Row width in samples and number of stacked images. |
error |
|
nodata |
A sentinel value marking missing samples. |
datatype |
Storage type: |
The fastest-varying dimension of x is the row: width defaults to
dim(x)[1] and planes to the last dimension of an array with three or
more. An array shaped (x, y, band), as stars holds a raster, therefore
produces the same frames as Python does for (band, y, x). The matrix from
terra::values(r) is shaped (ncell, nlyr), so pass
width = terra::ncol(r), planes = terra::nlyr(r). Row-based predictors
reset at each plane; use width = nx * ny, planes = 1 to predict across
bands.
Samples are converted to datatype before compression. Integer types refuse
values that are not whole or do not fit, and float types round to nearest.
A raw vector is taken as native samples of datatype already.
A geozl_graph. It wraps native state, so it is not thread-safe and
does not survive saving and reloading.
tile <- matrix(1000L + 1:(64 * 64) %% 97L, 64, 64) g <- geozl_graph(tile, "planar>zigzag>pfor", datatype = "uint16") frame <- geozl_compress(tile, g) back <- geozl_decompress(frame, "uint16", dim = dim(tile), as = "integer") identical(back, tile)tile <- matrix(1000L + 1:(64 * 64) %% 97L, 64, 64) g <- geozl_graph(tile, "planar>zigzag>pfor", datatype = "uint16") frame <- geozl_compress(tile, g) back <- geozl_decompress(frame, "uint16", dim = dim(tile), as = "integer") identical(back, tile)
Compresses and decompresses x with every recipe the prior allows and
ranks them by compression ratio. Recipes that do not apply to the input are
left out.
geozl_profile( x, prior = "planar", width = NULL, planes = NULL, error = NULL, reps = 5L, nodata = NULL, datatype = NULL, verify = FALSE )geozl_profile( x, prior = "planar", width = NULL, planes = NULL, error = NULL, reps = 5L, nodata = NULL, datatype = NULL, verify = FALSE )
x |
Raster samples: a double, integer or raw vector or array. For a bounded-error graph it fixes the domain later tiles are checked against, so use data spanning the product. |
prior |
One predictor plus the identity path: |
width, planes
|
Row width in samples and number of stacked images. |
error |
|
reps |
Round trips per recipe; the best time is kept. |
nodata |
A sentinel value marking missing samples. |
datatype |
Storage type: |
verify |
Whether to check checksums while timing decode. The frames carry checksums either way. |
A data frame with one row per recipe: graph, bytes, ratio,
encode_mbps, decode_mbps and shannon_pct, the order-0 entropy bound
as a percentage of the frame size.