# Zarrzipan: A raster compression benchmarking tool

Zarrzipan is a compression benchmarking tool based on Zarr.

## Usage

An example of how to use Zarrzipan is included in the
[`example.py`](./example.py) script.

To run this example and generate the benchmark results, execute:

```bash
uv run python example.py
```

### Benchmark Results

The following table summarizes the benchmark results generated by `example.py`:

<!--  [[[cog
import json
import subprocess
from cog import out

# Run the example.py script and capture its JSON output
result = subprocess.run(
    ["uv", "run", "python", "example.py"],
    capture_output=True,
    text=True,
    check=True
)

# Parse the JSON output
data = json.loads(result.stdout)

# Generate the Markdown table
out('| Dataset Name | Pipeline Name | Chunk Shape | Iterations | Compression Ratio | Space Saving | Avg Compress Time (ms) | Avg Decompress Time (ms) | Lossiness (MAE) |\n')
out('|---|---|---|---|---|---|---|---|---|\n')
for row in data:
    out(f"| {row['dataset_name']} | {row['pipeline_name']} | {row['chunk_shape']} | {row['iterations']} | {row['size_ratio']:.2f}x | {row['size_space_saving']:.2f} | {row['time_compress_avg_ms']:.2f} | {row['time_decompress_avg_ms']:.2f} | {row['lossiness_mae']:.4f} |\n")
 ]]]  -->
| Dataset Name | Pipeline Name | Chunk Shape | Iterations | Compression Ratio | Space Saving | Avg Compress Time (ms) | Avg Decompress Time (ms) | Lossiness (MAE) |
|---|---|---|---|---|---|---|---|---|
| SampleFloat32Array | ZlibCompression | (50, 50) | 3 | 3.34x | 0.30 | 2.90 | 1.59 | 0.0000 |
| SampleFloat32Array | BloscCompression | (50, 50) | 3 | 6.37x | 0.16 | 9.75 | 1.50 | 0.0000 |
<!-- [[[end]]] (sum: zGaWTm9szN) -->

## What does "zarrzipan" mean?

Zarrzipan, pronounced like marzipan, is like "Zarr zip analysis", where zip is
a general allusion to compression and not a reference to the specific zip
archive format.
