wavespectra.partition.partition.Partition.track#
- Partition.track(wspd=None, wdir=None, dpt=None, method='ptm1', ddpm_sea_max=30, ddpm_swell_max=20, dfp_sea_scaling=1, dfp_swell_source_distance=1000000.0, systems=False, min_duration=1, **kwargs)[source]#
Partition the spectra and track the wave systems over time.
Partition spectra using any of the watershed partitioning methods and track the partitions using the evolution of peak frequency and peak direction. Partitions are matched with the closest partition in the frequency-direction space of the previous time step for which the difference in direction is less than ddpm_max and the difference in peak frequency is less than dfp_max. ddpm_max differs for sea and swell partitions and is set manually. dfp_max also differs for sea and swell partitions. In the case of sea partitions it is a function of wind speed and is set to the rate of change of the wind-sea peak wave frequency estimated from fetch-limited relationships (Ewans & Kibblewhite, 1986). In the case of swell partitions it is set to the rate of change of the swell peak wave frequency based on the swell dispersion relationship derived by Snodgrass et al (1966) assuming the distance to the source is 1e6 m.
- Parameters:
wspd (-) – Wind speed DataArray, required by the ptm1 and ptm2 methods and optional for hp01. Taken from the wspd variable in the underlying dataset if not provided.
wdir (-) – Wind direction DataArray, as above.
dpt (-) – Depth DataArray, as above.
method (-) – Partitioning method to track partitions from, one of “ptm1”, “ptm2”, “ptm3” or “hp01”. The ptm4, ptm5 and bbox methods define partitions as fixed spectral regions whose identity is already continuous in time, so there is nothing to track.
ddpm_sea_max (-) – Maximum peak direction difference for wind sea partitions. Default is 30 degrees.
ddpm_swell_max (-) – Maximum peak direction difference for swell partitions. Default is 20 degrees.
dfp_sea_scaling (-) – Scaling factor for maximum peak frequency difference for wind sea partitions. Default is 1.
dfp_swell_source_distance (-) – Distance to source for swell peak frequency difference. Default is 1e6 m.
systems (-) – If True, remap the output onto a wave_system dimension in place of part so that each tracked wave system occupies its own index and carries values along the entire time axis, null where the system does not exist. If False (default), return the partitioned spectra with the track_id variable identifying the wave system of each partition at each time step.
min_duration (-) – Minimum number of time steps a wave system must span to be included in the systems=True output. The default of 1 keeps all tracked systems.
kwargs (-) – Further arguments passed to the partitioning method, e.g. swells, agefac, wscut, smooth or the hp01 combining parameters.
- Returns:
- Partitioned spectra with extra part dimension
ordered according to the partitioning method, plus the variable track_id identifying the wave system each partition belongs to at each time step and the variable ntracks with the number of wave systems tracked. If systems is True the spectra are instead organised along a wave_system dimension replacing part, with the track_id variable mapping each wave system back to its id in the systems=False output.
- Return type:
dspart (xr.DataArray, xr.Dataset)
Note
Wind sea partitions (partition 0 in ptm1 and hp01, partitions 0 and 1 in ptm2) are matched with wind-sea thresholds and the remaining partitions with swell thresholds. The ptm3 partitions are not classified and are all matched with swell thresholds, which makes wind inputs optional for that method.
The time step is evaluated for each pair of consecutive spectra so records with gaps or irregular sampling use matching thresholds consistent with the actual time elapsed.
Wave systems are tracked independently at each site so with systems=True the same wave_system index at different sites corresponds to different, physically unrelated systems, and the wave_system dimension is sized by the site with the most systems with null padding entries at the other sites.
The spectra remapping with systems=True is lazy on dask datasets but the track ids must be computed upfront to define the size of the output.