1

When I run zarr.open('result.zarr', mode='r') I get the following error:

FSPathExistNotDir: path exists but is not a directory: %r

According to the example in the Zarr documentation located at https://zarr.readthedocs.io/en/stable/tutorial.html#persistent-arrays, this zarr.open() function should return a zarr.core.Array:

z2 = zarr.open('data/example.zarr', mode='r')
np.all(z1[:] == z2[:])

How come the zarr.open() function is looking for a directory in my case?

tmor83
  • 11
  • 1
  • I've also tried the following and I get the same error. `z = zarr.open_array('./result.zarr', mode='w')` – tmor83 Feb 24 '21 at 06:00
  • Is result.zarr just a single file? If so, what type? By default, zarr creates and expects a directory. – Josh Mar 02 '21 at 08:25
  • Yes it's just a zarray single file. – tmor83 Mar 02 '21 at 19:34
  • With `import zarr` that should just work (and does for me). It produces one file on disk `data/example.zarr/.zarray` and if you set values, then numbered chunks will be produced. – Josh Mar 03 '21 at 07:12

1 Answers1

0

I see my confusion. For me, example.zarr is the name of the file (it seems I wrongly named it), and not a directory.

I was also confused because zarr.open() creates a zarray but does not open an existing zarray like the function name implies.

From kaggle.com/kneroma/zarr-files-and-l5kit-data-for-dummies:

z1 = zarr.open('data/example.zarr', mode='w', shape=(10000, 10000), chunks=(1000, 1000), dtype='i4') z1

The array above will store its configuration metadata and all compressed chunk data in a directory called ‘data/example.zarr’ relative to the current working directory. The zarr.convenience.open() function provides a convenient way to create a new persistent array or continue working with an existing array.

tmor83
  • 11
  • 1