When I export an image using a specific id for the first time, it works fine:
omero zarr export Image:xx
But if I try to export it again using the same id, I get the error message at the end of this issue description.
Will mentioned that this is expected as Zarr won't overwrite the existing data that the user creates with the first export. The user can either delete before repeating or output to a different directory.
I think we need a more user-friendly message to inform the user explicitly about this rather than throwing an exception.
Traceback (most recent call last):
File "/home/khaled/anaconda3/envs/ome_ngff/bin/omero", line 8, in
sys.exit(main())
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/main.py", line 125, in main
rv = omero.cli.argv()
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1784, in argv
cli.invoke(args[1:])
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1222, in invoke
stop = self.onecmd(line, previous_args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1299, in onecmd
self.execute(line, previous_args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1381, in execute
args.func(args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/cli.py", line 65, in _wrapper
return func(self, args, kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/cli.py", line 260, in export
image_to_zarr(image, args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 27, in image_to_zarr
n_levels, axes = add_image(image, root, cache_dir=cache_dir)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 82, in add_image
return add_raw_image(
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 155, in add_raw_image
parent.create(
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 891, in create
return self._write_op(self._create_nosync, name, kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 661, in _write_op
return f(args, **kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 897, in _create_nosync
return create(store=self._store, path=path, chunk_store=self._chunk_store,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/creation.py", line 138, in create
init_array(store, shape=shape, chunks=chunks, dtype=dtype, compressor=compressor,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/storage.py", line 353, in init_array
_init_array_metadata(store, shape=shape, chunks=chunks, dtype=dtype,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/storage.py", line 384, in _init_array_metadata
raise ContainsArrayError(path)
zarr.errors.ContainsArrayError: path '0' contains an array
I suspect the OMERO path needs to check the existence of of the target Zarr folder and report an informative message to the user to what is implemented in the bioformats2raw export path
When I export an image using a specific id for the first time, it works fine: omero zarr export Image:xx
But if I try to export it again using the same id, I get the error message at the end of this issue description.
Will mentioned that this is expected as Zarr won't overwrite the existing data that the user creates with the first export. The user can either delete before repeating or output to a different directory.
I think we need a more user-friendly message to inform the user explicitly about this rather than throwing an exception.
Traceback (most recent call last): File "/home/khaled/anaconda3/envs/ome_ngff/bin/omero", line 8, in
sys.exit(main())
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/main.py", line 125, in main
rv = omero.cli.argv()
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1784, in argv
cli.invoke(args[1:])
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1222, in invoke
stop = self.onecmd(line, previous_args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1299, in onecmd
self.execute(line, previous_args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1381, in execute
args.func(args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/cli.py", line 65, in _wrapper
return func(self, args, kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/cli.py", line 260, in export
image_to_zarr(image, args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 27, in image_to_zarr
n_levels, axes = add_image(image, root, cache_dir=cache_dir)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 82, in add_image
return add_raw_image(
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 155, in add_raw_image
parent.create(
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 891, in create
return self._write_op(self._create_nosync, name, kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 661, in _write_op
return f(args, **kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 897, in _create_nosync
return create(store=self._store, path=path, chunk_store=self._chunk_store,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/creation.py", line 138, in create
init_array(store, shape=shape, chunks=chunks, dtype=dtype, compressor=compressor,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/storage.py", line 353, in init_array
_init_array_metadata(store, shape=shape, chunks=chunks, dtype=dtype,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/storage.py", line 384, in _init_array_metadata
raise ContainsArrayError(path)
zarr.errors.ContainsArrayError: path '0' contains an array