Skip to content

Commit

Permalink
remove zarr import
Browse files Browse the repository at this point in the history
  • Loading branch information
ghidalgo3 committed Jul 16, 2024
1 parent f427f40 commit d6c12e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions kerchunk/grib2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
)

import fsspec
import zarr
import xarray
import numpy as np

Expand Down Expand Up @@ -403,7 +402,7 @@ def grib_tree(

# TODO allow passing a LazyReferenceMapper as output?
zarr_store = {}
zroot = zarr.open_group(store=zarr_store)
zroot, zarr_store = zarr_init_group_and_store(zarr_store, overwrite=False)

aggregations: Dict[str, List] = defaultdict(list)
aggregation_dims: Dict[str, Set] = defaultdict(set)
Expand Down
4 changes: 2 additions & 2 deletions kerchunk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ def rename_target_files(
ujson.dump(new, f)


def zarr_init_group_and_store(store=None, zarr_version=None):
def zarr_init_group_and_store(store=None, zarr_version=None, overwrite=True):
zarr_version = zarr_version or 2
if _ZARR_VERSION == 3 and zarr_version == 2:
return group(store, overwrite=True), store
elif _ZARR_VERSION == 3 and zarr_version == 3:
store = store or StorePath(MemoryStore(mode="w"))
return zarr.group(store, overwrite=True), store
else:
return zarr.group(store, overwrite=True, zarr_version=zarr_version), store
return zarr.group(store, overwrite=overwrite, zarr_version=zarr_version), store


def zarr_open(store, zarr_version=None, mode=None):
Expand Down

0 comments on commit d6c12e2

Please sign in to comment.