Skip to content

Consolidate writer functions #530

@jo-mueller

Description

@jo-mueller

This is written based upon th state of the code in #516

In this PR, ome-zarr-py has two entrypoints to writing data, notably:

  • write_image: Calls the private method _write_dask_image, which

    • uses scale._build_pyramid to generate a list of pyramidal delayed dask images
    • writes these to disc
    • writes the metadatato disk with write_multiscales_metadata
  • write_multiscales_image: Requires a pre-computed or delayed image pyramid and

    • writes the levels to disk
    • writes the metadata to disk with write_multiscales_metadata

There is some obvious duplicity between both entrypoints. I suggest to:

  • Move _build_pyramid up from _write_dask_image into the write_image function. That way, write_dask_image would be demoted to a function to simpl write pyramidal dask data and associated metadata
  • That would make the contents of _write_dask_image and write_multiscales practically identically, so _write_dask_image could also be used inside write_multiscales.

This would greatly improve maintainability and condense the code down to a single location for writing were metadata for different ome-zarr versions would be handled.

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