Skip to content

Commit

Permalink
detect tng-api zoomins (#191)
Browse files Browse the repository at this point in the history
* detect tng-api zoomins
  • Loading branch information
cbyrohl authored Jan 20, 2025
1 parent 3e7e3ed commit a2eb331
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/scida/customs/gadgetstyle/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@ def validate_path(
metadata_raw = load_metadata(path, **kwargs)
# need some silly combination of attributes to be sure
if all([k in metadata_raw for k in ["/Header"]]):
# tng-project.org api snapshots do not have "NumPart_Total" in header
is_zoom = "CutoutID" in metadata_raw["/Header"]
headerattrs = ["NumPart_ThisFile"]
if not is_zoom:
headerattrs.append("NumPart_Total")

# identifying snapshot or group catalog
is_snap = all(
[
k in metadata_raw["/Header"]
for k in ["NumPart_ThisFile", "NumPart_Total"]
]
)
is_snap = all([k in metadata_raw["/Header"] for k in headerattrs])
is_grp = all(
[
k in metadata_raw["/Header"]
Expand Down
12 changes: 12 additions & 0 deletions tests/testdata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,18 @@ testdata:
- areposnapshot_withcatalog|F|1|2
fn: minimal_TNG50-1_group_z3.hdf5

TNG100-3_api_cutout_z0:
types:
- interface
- areposnapshot
fn: tngapi_tng100-3_snap99_cutout_sid42.hdf5

TNG100-1_api_cutout_z0:
types:
- interface
- areposnapshot
fn: tngapi_tng100-1_snap99_cutout_hid97993.hdf5

TNG50-1_group_z0_minimal:
types:
- interface
Expand Down

0 comments on commit a2eb331

Please sign in to comment.