Repository: scalableminds/webknossos-libs

Issue:
Converting Knossos dataset fails, chunk_shape must be multiple of mag*chunk_shape*chunks_per_shard of the view
## Context
- Affected library: wkcuber

## Expected Behavior
Should output wkw dataset

## Current Behavior
```
2023-01-13 23:33:20,047 INFO Converting KNOSSOS dataset
2023-01-13 23:33:20,048 INFO Assumed data type is uint8
2023-01-13 23:33:21,125 INFO Using pool of 2 workers.
Converting knossos layer my_layer ━━━━━━━━━━━━━━━━━ 100% 0:01:17 | 0:00:002023-01-13 23:34:39,207 INFO Using pool of 2 workers.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/site-packages/wkcuber/__main__.py", line 117, in <module>
    main()
  File "/usr/local/lib/python3.9/site-packages/wkcuber/__main__.py", line 113, in main
    cube_with_args(args)
  File "/usr/local/lib/python3.9/site-packages/wkcuber/__main__.py", line 81, in cube_with_args
    auto_detect_and_run_conversion(args)
  File "/usr/local/lib/python3.9/site-packages/wkcuber/converter.py", line 567, in main
    should_write_metadata = matching_converters[0].convert_input(args)
  File "/usr/local/lib/python3.9/site-packages/wkcuber/converter.py", line 258, in convert_input
    convert_knossos(args)
  File "/usr/local/lib/python3.9/site-packages/wkcuber/convert_knossos.py", line 144, in main
    convert_knossos(
  File "/usr/local/lib/python3.9/site-packages/wkcuber/convert_knossos.py", line 135, in convert_knossos
    target_mag.for_each_chunk(
  File "/usr/local/lib/python3.9/site-packages/webknossos/dataset/view.py", line 742, in for_each_chunk
    self._check_chunk_shape(chunk_shape, read_only=self.read_only)
  File "/usr/local/lib/python3.9/site-packages/webknossos/dataset/view.py", line 944, in _check_chunk_shape
    assert chunk_shape % divisor == Vec3Int.zeros(), (
AssertionError: The chunk_shape Vec3Int(1024,1024,1024) must be a multiple of mag*chunk_shape*chunks_per_shard of the view, which is Vec3Int(8192,8192,8192)).
```

## Steps to Reproduce the bug
Got this for two knossos datasets recently, tested no other. Talk to me for sample data.

## Your Environment for bug
linux, python 3.9, wkcuber 0.11.1


Discussion:

Resolving patch:
diff --git a/wkcuber/wkcuber/convert_knossos.py b/wkcuber/wkcuber/convert_knossos.py
--- a/wkcuber/wkcuber/convert_knossos.py
+++ b/wkcuber/wkcuber/convert_knossos.py
@@ -98,7 +98,7 @@ def convert_knossos(
     dtype: str,
     voxel_size: Tuple[float, float, float],
     data_format: DataFormat,
-    chunk_shape: Vec3Int,
+    chunk_shape: Vec3Int,  # in target-mag
     chunks_per_shard: Vec3Int,
     mag: int = 1,
     args: Optional[Namespace] = None,
@@ -134,7 +134,7 @@ def convert_knossos(
     with get_executor_for_args(args) as executor:
         target_mag.for_each_chunk(
             partial(convert_cube_job, source_knossos_info),
-            chunk_shape=chunk_shape * chunks_per_shard,
+            chunk_shape=chunk_shape * mag * chunks_per_shard,
             executor=executor,
             progress_desc=f"Converting knossos layer {layer_name}",
         )


Test patch: