Skip to content

Commit

Permalink
add zgroup file (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
sameeul authored Jan 29, 2025
1 parent c372612 commit ccaaf6a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/python/argolid/volume_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def generate_volume(self):
self.init_base_zarr_file()
self.write_image_stack()
self._create_zattr_file()
self._create_zgroup_file()

def write_image_stack(self):
"""
Expand Down Expand Up @@ -240,6 +241,17 @@ def _get_default_axes_metadata(self) -> List[dict]:
]
return axes_metadata

def _create_zgroup_file(self) -> None:
"""
Creates a .zgroup file for the zarr pyramid.
"""
zgroup_dict: dict = {"zarr_format": 2}

with open(f"{self._out_dir}/{self._image_name}/.zgroup", "w") as json_file:
json.dump(zgroup_dict, json_file)

with open(f"{self._out_dir}/{self._image_name}/{self._base_scale_key}/.zgroup", "w") as json_file:
json.dump(zgroup_dict, json_file)

def _create_zattr_file(self) -> None:
"""
Expand Down Expand Up @@ -384,6 +396,16 @@ def downsample_pyramid(self, level: int) -> None:

for future in write_futures:
future.result()
self._create_zgroup_file(f"{self._zarr_loc_dir}/{level}")

def _create_zgroup_file(self, file_loc: str) -> None:
"""
Creates a .zgroup file for the zarr pyramid.
"""
zgroup_dict: dict = {"zarr_format": 2}

with open(f"{file_loc}/.zgroup", "w") as json_file:
json.dump(zgroup_dict, json_file)

def _create_zattr_file(self, num_levels: int) -> None:
"""
Expand Down

0 comments on commit ccaaf6a

Please sign in to comment.