diff --git a/swiftsimio/masks.py b/swiftsimio/masks.py index f988ee1b..bc7ad2fa 100644 --- a/swiftsimio/masks.py +++ b/swiftsimio/masks.py @@ -10,6 +10,8 @@ from swiftsimio import metadata, SWIFTMetadata, SWIFTUnits +from swiftsimio.objects import InvalidSnapshot + from swiftsimio.accelerated import ranges_from_array from typing import Dict @@ -46,6 +48,12 @@ def __init__(self, metadata: SWIFTMetadata, spatial_only=True): self.units = metadata.units self.spatial_only = spatial_only + if self.metadata.partial_snapshot: + raise InvalidSnapshot( + "You cannot use masks on partial snapshots. Please use the virtual " + "file generated by SWIFT (use snapshot.hdf5, not snapshot.0.hdf5)." + ) + self._unpack_cell_metadata() if not spatial_only: