Skip to content

Saving and re-opening a v2 array does not report (or save) correct memory order #2950

Closed

Description

@dstansby
import zarr
import zarr.storage

store = zarr.storage.MemoryStore()
arr = zarr.create((100,), store=store, path="a", zarr_format=2, order="F")
print(arr.order)
# "F"

arr = zarr.open(store, path="a")
print(arr.order)
# "C"

I would expect the memory order to be persisted and the same when I re-open the array.

Activity

  1. added
    bug
    on Apr 3, 2025
  2. d-v-b commented on Apr 3, 2025

    @d-v-b
    Contributor

    iirc this is because we made order part of the runtime configuration, due to order not being part of the zarr v3 metadata model. I'm pretty sure a global config is the wrong location for this parameter -- I think we need a per-array namespace for runtime configuration like this.

  3. dstansby commented on Apr 3, 2025

    @dstansby
    ContributorAuthor

    It's part of the v2 metadata though, so shouldn't this be persisted and read in with the array itself (for zarr format 2)?

  4. d-v-b commented on Apr 3, 2025

    @d-v-b
    Contributor

    if you inspect the array.metadata.order, I think you should see that it has the expected F value. The issue is that when zarr opens an array, it defers to the global config when setting the order of the in-memory array associated with that zarr array, whether the array is v2 or v3. The problem is our use of this global config.

  5. dstansby commented on Apr 3, 2025

    @dstansby
    ContributorAuthor

    if you inspect the array.metadata.order, I think you should see that it has the expected F value.

    Nope, arr.metadata.order still gives the wrong order.

  6. d-v-b commented on Apr 3, 2025

    @d-v-b
    Contributor

    :( that's bad! we definitely need to fix this!

  7. d-v-b commented on Apr 3, 2025

    @d-v-b
    Contributor

    i can get to this in the next few days unless someone does it first

  8. d-v-b commented on Apr 3, 2025

    @d-v-b
    Contributor

    if you inspect the array.metadata.order, I think you should see that it has the expected F value. The issue is that when zarr opens an array, it defers to the global config when setting the order of the in-memory array associated with that zarr array, whether the array is v2 or v3. The problem is our use of this global config.

    this explanation is actually very wrong -- we are already using the array-specific config. the underlying issue, addressed in #2951, is a simple bug in our implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions