Skip to content

Commit

Permalink
comment it all
Browse files Browse the repository at this point in the history
  • Loading branch information
RondeauG committed Nov 19, 2024
1 parent c676877 commit c316993
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/xscen/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,16 @@ def _del_var(pth):
logger.warning(msg)
sh.rmtree(pth)

# Update the .zmetadata file
with (Path(path) / ".zmetadata").open("r") as f:
metadata = json.load(f)
[
metadata["metadata"].pop(k)
for k in list(metadata["metadata"].keys())
if k.startswith(f"{pth.name}/.")
]
with (Path(path) / ".zmetadata").open("w") as f:
json.dump(metadata, f, indent=2)
# # Update the .zmetadata file
# with (Path(path) / ".zmetadata").open("r") as f:
# metadata = json.load(f)
# [
# metadata["metadata"].pop(k)
# for k in list(metadata["metadata"].keys())
# if k.startswith(f"{pth.name}/.")
# ]
# with (Path(path) / ".zmetadata").open("w") as f:
# json.dump(metadata, f, indent=2)

if complete is not None and incomplete is not None:
raise ValueError("Use either `complete` or `incomplete`, not both.")
Expand All @@ -290,10 +290,10 @@ def _del_var(pth):
_del_var(fold)

elif incomplete is not None:
with xr.open_zarr(path) as ds:
incomplete = [
v for v in incomplete if (v not in ds.coords) and (v not in ds.dims)
]
# with xr.open_zarr(path) as ds:
# incomplete = [
# v for v in incomplete if (v not in ds.coords) and (v not in ds.dims)
# ]

for fold in filter(lambda p: p.is_dir(), path.iterdir()):
if fold.name in incomplete:
Expand Down

0 comments on commit c316993

Please sign in to comment.