Skip to content

Commit 7159575

Browse files
authored
Change default dimension_separator for Zarr2 (#1274)
* Change default dimension_separator for Zarr2 * changelog * fix copytree
1 parent 8b1486a commit 7159575

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
1717
### Added
1818

1919
### Changed
20+
- Changed the default dimension separator for Zarr 2 arrays from `.` to `/`. [#1274](https://github.com/scalableminds/webknossos-libs/pull/1274)
2021

2122
### Fixed
2223

webknossos/webknossos/dataset/_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ def create(cls, path: Path, array_info: ArrayInfo) -> "Zarr2Array":
842842
else None
843843
),
844844
"filters": None,
845-
"dimension_separator": ".",
845+
"dimension_separator": "/",
846846
},
847847
"create": True,
848848
}

webknossos/webknossos/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,11 @@ def _walk(path: Path) -> Iterator[Path]:
324324

325325
def copytree(in_path: Path, out_path: Path) -> None:
326326
def _walk(path: Path, base_path: Path) -> Iterator[Tuple[Path, Tuple[str, ...]]]:
327-
yield (path, tuple(p for p in path.parts if p not in base_path.parts))
327+
# base_path.parts is a prefix of path.parts; strip it
328+
assert len(path.parts) >= len(base_path.parts)
329+
assert path.parts[: len(base_path.parts)] == base_path.parts
330+
yield (path, path.parts[len(base_path.parts) :])
331+
328332
if path.is_dir():
329333
for p in path.iterdir():
330334
yield from _walk(p, base_path)

0 commit comments

Comments
 (0)