wavespectra.partition.tracking.wave_systems#
- wavespectra.partition.tracking.wave_systems(dspart, min_duration=1)[source]#
Remap tracked partitions onto a wave_system dimension.
Reorganise a dataset of tracked partitions, as returned by the track partitioning method, so that each tracked wave system occupies its own index along a new wave_system dimension in place of part. Each system carries values along the entire time axis, taken from whichever partition holds the system at each time step and null elsewhere, so the time series of any wave system can be extracted with a plain selection, e.g. dsout.isel(wave_system=5).
- Parameters:
dspart (xr.Dataset) – Tracked partitioned dataset with the efth and track_id variables, as returned by the track partitioning method.
min_duration (int) – Minimum number of time steps a wave system must span to be included in the output. The default of 1 keeps all tracked systems.
- Returns:
dsout – Dataset with the spectra of each tracked wave system along the wave_system dimension, null where the system does not exist, and the variable track_id mapping each wave system back to its id in the input dataset.
- Return type:
xr.Dataset
Notes
Systems are ordered chronologically by their first appearance.
Wave systems are tracked independently at each site so the same wave_system index at different sites corresponds to different, physically unrelated systems. The size of the wave_system dimension accommodates the site with the most systems and the extra entries at the other sites are null, with track_id set to -999.
The spectra remapping is lazy on dask datasets but the track ids must be computed upfront to define the size of the output.