shnitsel.core.xrhelpers.sel_trajs

sel_trajs(frames, trajids_or_mask, invert=False)

Select trajectories using a list of trajectories IDs or a boolean mask

Parameters:
  • frames (Dataset | DataArray) – The xr.Dataset from which a selection is to be drawn

  • trajids_or_mask (Sequence[int] | Sequence[bool]) –

    Either
    • A sequences of integers representing trajectory IDs to be included, in which case the trajectories may not be returned in the order specified.

    • Or a sequence of booleans, each indicating whether the trajectory with an ID in the corresponding entry in the Dataset’s trajid_ coordinate should be included

  • invert – Whether to invert the selection, i.e. return those trajectories not specified, by default False

  • optional – Whether to invert the selection, i.e. return those trajectories not specified, by default False

Return type:

A new xr.Dataset containing only the specified trajectories

Raises:
  • NotImplementedError – when an attempt is made to index an xr.Datset without a trajid_ dimension/coordinate using a boolean mask

  • TypeError – If trajids_or_mask has a dtype other than integer or boolean