diff --git a/src/scida/configfiles/units/gadget.yaml b/src/scida/configfiles/units/gadget.yaml index 418419de..d3e551b1 100644 --- a/src/scida/configfiles/units/gadget.yaml +++ b/src/scida/configfiles/units/gadget.yaml @@ -22,6 +22,8 @@ fields: SubfindVelDisp: km / s Velocities: km * a^(1/2) / s TimeStep: + GroupFirstSub: none + LocalSubhaloID: none Offsets: "no_units" # "no_units" indicates that no field has units in this group # only do this for fields that have wrong or no metadata PartType0: diff --git a/src/scida/customs/arepo/dataset.py b/src/scida/customs/arepo/dataset.py index f0d7bd9b..162dffa6 100644 --- a/src/scida/customs/arepo/dataset.py +++ b/src/scida/customs/arepo/dataset.py @@ -423,7 +423,7 @@ def add_catalogIDs(self) -> None: # calculate first subhalo of each halo that a particle belongs to self.add_groupquantity_to_particles("GroupFirstSub", parttype=key) pdata["SubhaloID"] = pdata["GroupFirstSub"] + pdata["LocalSubhaloID"] - pdata["SubHaloID"] = da.where( + pdata["SubhaloID"] = da.where( pdata["SubhaloID"] == index_unbound, index_unbound, pdata["SubhaloID"] ) diff --git a/tests/customs/test_arepo.py b/tests/customs/test_arepo.py index 6ef8ebaf..076338ac 100644 --- a/tests/customs/test_arepo.py +++ b/tests/customs/test_arepo.py @@ -319,3 +319,12 @@ def test_default_recipes(testdatapath): obj2 = load(testdatapath, units=False) v2 = obj2.data["PartType0"]["Temperature"][0].compute() assert np.allclose(v1, v2) + + +@require_testdata_path("interface", only=["TNG50-4_snapshot"]) +def test_allunitsdiscovered(testdatapath, caplog): + load(testdatapath) + caplog.set_level(logging.DEBUG) + assert ( + "Cannot determine units from neither unit file nor metadata" not in caplog.text + )