Skip to content

Commit

Permalink
Merge pull request #861 from danielballan/zarr-cleanup
Browse files Browse the repository at this point in the history
Zarr cleanup
  • Loading branch information
genematx authored Jan 28, 2025
2 parents 7e54cd5 + 58fcc45 commit 9dc91de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Write the date in place of the "Unreleased" in the case a new version is release

## Unreleased

### Changed

- Refactor and standardize Adapter API: implement from_uris and from_catalog
classmethods for instantiation from files and registered Tiled nodes, respectively.
- Refactor CSVAdapter to allow pd.read_csv kwargs
- Removed `tiled.adapters.zarr.read_zarr` utility function.

### Added

- Added `.get` methods on TableAdapter and ParquetDatasetAdapter
Expand All @@ -18,6 +25,7 @@ Write the date in place of the "Unreleased" in the case a new version is release
mode in the `AboutAuthenticationProvider` schema to be `internal`|`external`.
- Improved type hinting and efficiency of caching singleton values


## v0.1.0-b16 (2024-01-23)

### Maintenance
Expand All @@ -39,9 +47,6 @@ Write the date in place of the "Unreleased" in the case a new version is release
`public_keys`, which can be fetched at initialization (server startup) time.
See examples `example_configs/orcid_auth.yml`,
`example_configs/google_auth.yml`, and `example_configs/simple_oidc`.
- Refactor and standardize Adapter API: implement from_uris and from_catalog
classmethods for instantiation from files and registered Tiled nodes, respectively.
- Refactor CSVAdapter to allow pd.read_csv kwargs

### Maintenance

Expand Down
20 changes: 1 addition & 19 deletions tiled/adapters/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,6 @@
INLINED_DEPTH = int(os.getenv("TILED_HDF5_INLINED_CONTENTS_MAX_DEPTH", "7"))


def read_zarr(
data_uri: str,
structure: Optional[ArrayStructure] = None,
**kwargs: Any,
) -> Union["ZarrGroupAdapter", ArrayAdapter]:
filepath = path_from_uri(data_uri)
zarr_obj = zarr.open(filepath) # Group or Array
adapter: Union[ZarrGroupAdapter, ArrayAdapter]
if isinstance(zarr_obj, zarr.hierarchy.Group):
adapter = ZarrGroupAdapter(zarr_obj, **kwargs)
else:
if structure is None:
adapter = ZarrArrayAdapter.from_array(zarr_obj, **kwargs)
else:
adapter = ZarrArrayAdapter(zarr_obj, structure=structure, **kwargs)
return adapter


class ZarrArrayAdapter(ArrayAdapter):
""" """

Expand Down Expand Up @@ -381,7 +363,7 @@ def from_catalog(
zarr_obj = zarr.open(
path_from_uri(data_source.assets[0].data_uri)
) # Group or Array
if isinstance(zarr_obj, zarr.hierarchy.Group):
if node.structure_family == StructureFamily.container:
return ZarrGroupAdapter(
zarr_obj,
structure=data_source.structure,
Expand Down

0 comments on commit 9dc91de

Please sign in to comment.