Skip to content

Commit

Permalink
NGFF source validation for remote
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Schorb committed Mar 5, 2024
1 parent f1f2044 commit 8b92a75
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mobie/validation/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ def _check_bdv_n5_s3(xml, assert_true):

def _check_ome_zarr_s3(address, name, assert_true, assert_equal, channel):
try:
load_json_from_s3(os.path.join(address, ".zattrs"))
zattrs = load_json_from_s3(os.path.join(address, ".zattrs"))
except Exception:
assert_true(False, f"Can't find ome.zarr..s3file at {address}")

validate_with_schema(zattrs, "NGFF")

# we disable the name check for the time being since it seems to not be necessary,
# AND restricting the name in this fashion prevents embedding existing ome.zarr files in mobie projects
# if channel is None:
Expand Down Expand Up @@ -64,13 +66,13 @@ def bdv_check():
path = os.path.join(dataset_folder, storage["relativePath"])
assert_true(os.path.exists(path), f"Could not find data for {name} at {path}")

attr_path =os.path.join(path, ".zattrs")
attr_path = os.path.join(path, ".zattrs")
assert_true(os.path.exists(attr_path), f"Could not find metadata for {name} at {path}")

with open(attr_path) as f:
zattr = json.load(f)
zattrs = json.load(f)

validate_with_schema(zattr, "NGFF")
validate_with_schema(zattrs, "NGFF")

# we disable the name check for the time being since it seems to not be necessary,
# AND restricting the name in this fashion prevents embedding existing ome.zarr files in mobie projects
Expand Down

0 comments on commit 8b92a75

Please sign in to comment.