Skip to content
Snippets Groups Projects
Commit aef16308 authored by Siddhant Tibrewal's avatar Siddhant Tibrewal
Browse files

zarr 3 fixes

parent 9dead094
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,6 @@ import zarr
def get_var_group(v):
root = zarr.Group(store=v.store)
last_slash_idx = v.name.rindex("/")
return root[v.name[:last_slash_idx]]
store = zarr.open(v.store)
parent_group_path = '/'.join(v.path.split('/')[:-1])
return store[parent_group_path]
......@@ -134,10 +134,10 @@ def main():
# compute time start index
t0 = (
np.datetime64(start_datetime())
- np.datetime64(var_group.time.attrs["units"][len("seconds since ") :])
- np.datetime64(var_group["time"].attrs["units"][len("seconds since ") :])
) / np.timedelta64(1, "s")
t0_idx = np.searchsorted(var_group.time, t0)
assert var_group.time[t0_idx] == t0, "start_datetime not found in time axis"
t0_idx = np.searchsorted(var_group["time"], t0)
assert var_group["time"][t0_idx] == t0, "start_datetime not found in time axis"
dt = time_coordinate[t0_idx + 1] - time_coordinate[t0_idx]
......@@ -151,7 +151,7 @@ def main():
else:
assert "hiopy::parent" in var_group.attrs, f"No source for field {v.name} specified"
parent_var_name = var_group.attrs["hiopy::parent"] + "/" + v.name.split("/")[-1]
source_var = zarr.Group(store=v.store)[parent_var_name]
source_var = zarr.open(store=v.store)[parent_var_name]
source_var_gid = grid_id(source_var)
src_comp = src_grid = f"{args.process_group}_{source_var_gid}"
time_method = v.attrs.get("hiopy::time_method", "point")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment