Wavespectra takes advantage of xarray’s labelled coordinates to abstract n-dimensional wave spectra datasets and calculate integrated spectral parameters. This requires some conventions around special coordinates and variables. This naming convention is inspired on netcdf files from WAVEWATCH III wave model.


Wave frequency#

Wave frequency coordinate named as freq, defined in \(Hz\) (required).

Wave direction#

Wave direction coordinate in coming-from convention, named as dir, defined in \(degree\) (required for 2D spectra and directional methods).


Time coordinate named as time (required by some methods).

Data variables#

Wave energy density#

Wave energy density array named as efth, defined in:

  • 2D spectra \(E(\sigma,\theta)\): \(m^{2}{degree^{-1}}{s}\).

  • 1D spectra \(E(\sigma)\): \(m^{2}{s}\).

Wind speed#

Wind speed array named as wspd, defined in \(ms^{-1}\) (required for watershed partitioning).

Wind direction#

Wind direction array named as wdir, defined in \(degree\) (required for watershed partitioning).

Water depth#

Water depth array named as dpt, defined in \(m\) (required for watershed partitioning and wavenumber-based methods).


Pre-defined names and units for these and other coordintes and variables are available from module wavespectra.core.attributes. This module defines variable names and some CF attributes by loading information from attributes.yml file. The attributes can be accessed for example as:

In [1]: from wavespectra.core.attributes import attrs

In [2]: attrs.SPECNAME
Out[2]: 'efth'

In [3]: attrs.ATTRS.hs
{'standard_name': 'sea_surface_wave_significant_height',
 'units': 'm',
 '_ipython_canary_method_should_not_exist_': {}}

The module also provides a function to standarise coordinate and variable attributes in a Dataset object using the information defined in attributes.yml:


Standarise CF attributes in specarray variables