Skip to content

Column-major arrays are returned as row-major #3072

@kapadia

Description

@kapadia

Zarr version

v3.0.8

Numcodecs version

0.16.0

Python Version

3.12.5

Operating System

macOS

Installation

uv pip into virtual environment

Description

I recall using fortran-style arrays with zarr v2 with no issue. Since zarr v3, I've observed that fortran-style arrays are read back as C-style arrays. If this is in fact a bug, and not an error on my part, I'd be happy to contribute a fix.

Steps to reproduce

import zarr

# Write fortran style array
group = zarr.group("column-major-example.zarr")
array = group.create_array(
    name="example",
    shape=(128, 128),
    dtype="float32",
    order="F",
    dimension_names=("row", "col"),
)
array[:] = 1


# Read back and ensure the order is preserved
group = zarr.open_group("column-major-example.zarr/", mode="r")
array = group["example"]
assert array[:].flags["F_CONTIGUOUS"]

Additional output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions