Skip to main content

Geospatial codec extensions for OpenZL.

Project description

geozl

License: BSD-3-Clause Coverage Platform C11 Built on OpenZL

What is geozl?

OpenZL treats compression as a graph of codecs. Each frame carries the recipe needed to decode it, which lets a universal OpenZL decoder follow the graph without knowing how the data was originally encoded.

That model works well for one-dimensional streams, but it does not know that a raster has rows, columns, neighbours, or spatial structure. geozl adds that missing spatial layer.

A geozl codec is an OpenZL graph node that understands raster tiles. It transforms a typed numeric stream, stores the metadata needed to reverse that transform in the codec header, and lets the rest of the OpenZL graph continue as usual.

The full wire-level rules are described in SPEC.md. If you want to implement a new codec, see docs/adding-a-codec.md.

Status

geozl is experimental.

The codec set, parameters, and header layouts may change between versions. There may be no migration path for old frames if the format changes, so pin the exact geozl version for any data you cannot regenerate.

[!WARNING] geozl codecs are not part of OpenZL.

They are registered at runtime as OpenZL custom transforms and use CTids in the 0x72D700-0x72D7FF range. A frame that uses geozl codecs can only be decoded by a reader that has geozl registered. Frames that use only built-in OpenZL codecs remain portable OpenZL frames.

Install

pip install geozl

Example

geozl codecs are composed into an openzl.ext graph just like regular OpenZL nodes.

import openzl.ext as zl
import geozl

c = zl.Compressor()
g = zl.graphs.Compress()

g = zl.nodes.Zigzag()(c, g)
g = geozl.lossless.Planar(width=512)(c, g)

c.select_starting_graph(g)

Codecs

geozl currently provides two codec families:

  • near-lossless codecs, under geozl.lossy
  • lossless codecs, under geozl.lossless

Both families are registered as OpenZL custom codecs and can be chained with other OpenZL graph nodes.

The call column shows the Python call used to place the codec in a graph.

Near-lossless codecs

Near-lossless codecs quantize the tile once, then store enough information in the frame to report and bound the reconstruction error.

A near-lossless frame is no longer bit-exact. Instead, it declares one error mode:

  • ABS: a fixed absolute tolerance, useful for elevation, depth, coordinates, and similar values.
  • REL: a fixed relative tolerance, useful for radiance, reflectance, SAR amplitude, and other values where percentage error matters.
codec call CTid mode error
quant_linear geozl.lossy.QuantLinear(max_error, dtype) 0x72D780 ABS every value reconstructs within max_error
quant_log geozl.lossy.QuantLog(rel_error, dtype) 0x72D781 REL every value reconstructs within rel_error of itself

Lossless codecs

Lossless codecs are bit-exact transforms over a raster tile. After decoding, the reconstructed tile is identical to the original input.

codec call CTid what it does
delta_w geozl.lossless.DeltaW(width) 0x72D701 stores each value as a difference from its west neighbour
delta_n geozl.lossless.DeltaN(width) 0x72D702 stores each value as a difference from its north neighbour
planar geozl.lossless.Planar(width) 0x72D703 predicts each pixel from W + N - NW
deinterleave geozl.lossless.Deinterleave() 0x72D704 splits an interleaved complex stream into real and imaginary lanes
med geozl.lossless.Med(width) 0x72D705 uses the median edge detector predictor
average geozl.lossless.Average(width) 0x72D706 predicts from the floor average of west and north neighbours
wp_static geozl.lossless.WpStatic(width) 0x72D707 fits a static weighted predictor and stores the weights in the frame

License

BSD-3-Clause


Made with ♥ by

Asterisk Labs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

geozl-0.6.5-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (49.7 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

geozl-0.6.5-py3-none-macosx_11_0_arm64.whl (33.2 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file geozl-0.6.5-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for geozl-0.6.5-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88530d9426ea4cb5223b18194da45eedb2e9f00909bceee3a28ebfcbcafdaf12
MD5 03b3ff930559edaba70bfe637b6a38e3
BLAKE2b-256 6b620e83149f77c114a534e5e6f799905a1ac4a476f37c2962c8c5c6e4b7dd33

See more details on using hashes here.

Provenance

The following attestation bundles were made for geozl-0.6.5-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on asterisk-labs/geozl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geozl-0.6.5-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: geozl-0.6.5-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for geozl-0.6.5-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fdf07d688979f00f7ab2f073b0561d4cc87aedbdce99bd450a67f31a6a0d4dff
MD5 ce0a0c7a52d952d1429e57e9beabb041
BLAKE2b-256 2591883a3afabbaa1f054c0fff4e5e5da4cf7f77c65a8c5bf3f511fbdd43537e

See more details on using hashes here.

Provenance

The following attestation bundles were made for geozl-0.6.5-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on asterisk-labs/geozl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page