←

A compression benchmark for Earth observation data

Asterisk Labs ARIA National Oceanography Centre
Earth Compress02 / 14

Every codec paper measures on its own terms

Today different data a few scenes picked by each author different starting bytes floats in one, the same values as integers in another different error rules PSNR in one, a bound in another, NoData ignored different machines threads, files and network mixed into the timing There are no shared rules, so the numbers cannot be put side by side. Earth Compress the same 27 corpora → rebuilt from their sources, shared on Hugging Face one protocol → the same starting bytes, promises and error budgets one machine, one thread the machine and versions recorded with each run every result in git → anyone can run it again and diff
Earth Compress03 / 14

One measurement is one array, in memory

The whole array goes to the codec in one call, on one thread. No files, no network.

array integers, in memory encode one call bytes one frame compressed size ratio, bits per value encode time indicative, one call decode 3 to 10 calls decode time the median, stop after 0.5 s array back same shape and dtype compare with the input distortion max error, RMSE, PSNR and check every promise of the mode

How the protocol measures →click to step

Earth Compress04 / 14

27 corpora, from satellites to embeddings

All datasets →

Earth Compress05 / 14

A corpus is a folder you can rebuild

corpora/s2-l1c-10m-4/
  spec.md          # source, samples, licence
  build.py         # select and build the samples
  manifest.csv     # asset, CRS, dates, bands, sha256
  npz/             # the samples, from Hugging Face
  png/             # previews
  results.csv      # one row per sample and codec
  environment.json # machine and versions of the run

Samples come ready

The first run downloads them from the Hugging Face dataset earth-compress/benchmark.

Or rebuild them

build.py fetches every source asset again and checks each sample against its sha256.

Results sit beside the data

So a new run shows up as a diff of results.csv.

s2-l1c-10m-4 on the site →DATASETS.md →

Earth Compress06 / 14

Codecs see integers plus a scale and offset

When integers reproduce the published values bit for bit, the corpus stores them that way. Every codec starts from the same bytes.

value = offset + scale × q corpus q scale offset s2-l1c-10m-4 uint16 1 DN 0 imerg-pcp-12 uint16 0.01 mm/h 0 era5-t2m-1h uint16 2⁻⁹ K one per hour goes-abi-16 uint16 one per channel one per channel

Every corpus with its scale and offset →

Earth Compress07 / 14

Three modes, each with its promises

lossless → near-lossless → lossy → structuresame shape and dtype determinismsame bytes, same array exactnessevery value comes back equal structuresame shape and dtype determinismsame bytes, same array boundevery value within tau sentinelNoData stays where it was zerozeros come back as zeros structuresame shape and dtype determinismsame bytes, same array rmsRMS error within tau sentinelNoData stays where it was A broken promise is a result status violation, or crash, in results.csv Nothing is dropped the row keeps every measurement

The promises in the protocol →click to step

Earth Compress08 / 14

The error budget comes from the data's own noise

Each corpus has a reference error sigma, from instrument noise, retrieval error or model spread. The bound tau is set from it.

0 error per value, to scale conservative sigma / 4 2 DN matched sigma 10 DN aggressive 4 · sigma 40 DN Sentinel-2 L1C at 10 m, sigma about 10 DN. Integer bounds round down to whole steps.

Sigma and the bounds of every corpus →click to step

Earth Compress09 / 14

Codecs from GIS, imaging and science

lossless

Byte codecs, TIFF predictors, numeric codecs and OpenZL graphs.

  • zstd
  • deflate
  • lzw
  • hdiff-zstd9
  • blosc
  • pco
  • openzl
  • geozl
  • jpeg2000

near-lossless

A bound on every value. Each codec at each budget level.

  • geozl
  • lerc
  • jpeg-ls near
  • sz3
  • zfp
  • sperr
  • quant + any lossless
  • safeguards + a codec

lossy

A bound on the RMS error. The setting may be searched.

  • jpeg2000
  • jpeg-xl
  • sperr
  • sz3
  • quant + pco

Quantize then compress, or add safeguards to any codec. Both count as their own family.

Every configuration and version →

Earth Compress10 / 14

Adding a codec is one Python module

# earthcompress/codecs/mycodec.py
import mycodec
from ..spec import ArraySpec
from .base import lossless, unpack

class MyCodec:
    def __init__(self, spec: ArraySpec):
        self.spec = spec

    def encode(self, array):
        return mycodec.compress(array.tobytes())

    def decode(self, data):
        return unpack(mycodec.decompress(data), self.spec)

CONFIGURATIONS = (lossless("mycodec", "mycodec",
                           mycodec.__version__, MyCodec),)

Two methods

encode takes the array and returns bytes. decode gives the array back.

Found on its own

The runner loads every module in earthcompress/codecs/.

Bounded modes

FAMILIES for near-lossless and LOSSY for lossy. The codec receives tau.

Adding a codec, step by step →

Earth Compress11 / 14

Run it, then git diff

# get the benchmark
git clone https://github.com/earth-compress/benchmark
cd benchmark

# every codec on one corpus
uv run earthcompress corpora/s2-l1c-10m-4

# only yours
uv run earthcompress corpora/s2-l1c-10m-4 --codec mycodec

# against the published results
git diff corpora/s2-l1c-10m-4/results.csv

First run

Downloads the samples of that corpus.

Written in place

Results go over the published results.csv. A run replaces only the rows of the configurations it measures.

With its machine

environment.json records the CPU, the platform and the versions.

github.com/earth-compress/benchmark →

Earth Compress12 / 14

Does the error matter for the task?

Earth Compress13 / 14

Three ways to take part

A codec →

One module that encodes and decodes. Run it on the corpora and send the new rows.

earthcompress/codecs/
  mycodec.py

A corpus →

Samples anyone can rebuild, with a sigma for the error budgets.

corpora/<id>/
  spec.md
  build.py
  manifest.csv

A use case →

A product people rely on, and a score that says when compression changed it.

usecases/<case>/
  manifest.csv
  run.py

Open a pull request on github.com/earth-compress/benchmark.

uv run earthcompress corpora/s2-l1c-10m-4

Asterisk Labs ARIA National Oceanography Centre