Skip to content

Proposal: "generic" chunk key encoding #67

Description

@clbarnes

Motivated by the incoming image codecs and existing data sets which are stacks of 2D images.

The generic chunk key encoding would be flexible enough to allow prefixes, suffixes, re-ordering the chunk index, and more besides. Its configuration values would be a format string (using e.g. python/rust-like {value} interpolation, or js-like ${value}, or mustache-like {{value}}, or whatever), whose inner values refer to the index within the chunk index (e.g. for chunk index (10, 11, 12), "c/{0}/{2}/{1}" would resolve to "c/10/12/11"). There could further be an empty interpolator {}meaning "all unused items", and aseparator` field with how to separate them.

For example, the default CKE could be written

{
  // ...
  "chunk_key_encoding": {
    "name": "generic",
    "configuration": {
      "format": "c/{}",
      "separator": "/"
    }
  }
}

and the v2 CKE could be written

{
  // ...
  "chunk_key_encoding": {
    "name": "generic",
    "configuration": {
      "format": "{}",
      "separator": "."
    }
  }
}

A 3D greyscale JPEG stack with Z slice directories and file names like {column}_{row}.jpeg could be

{
  // ...
  "chunk_key_encoding": {
    "name": "generic",
    "configuration": {
      "format": "images/{0}/{2}_{1}.jpeg",
      "separator": "/"  // unused, could be omitted
    }
  }
}

Some discussion points

  • should both indexed and empty interpolations be allowed together?
  • if so, might we also want to allow negative indices so that e.g. the last 2 dimensions are switched regardless of how many have come before?
  • should there be a default separator for when it's not given, like there is for default and v2?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions