environmentaltools.common.read_swan

environmentaltools.common.read_swan(file_name: str, grid: dict = None, variables: list = None)[source]

Read SWAN model output from MATLAB file format.

Loads wave field data from SWAN (Simulating WAves Nearshore) model output stored in MATLAB format and computes wave number from wavelength.

Parameters:
  • file_name (str) – Path to MATLAB (.mat) file containing SWAN output.

  • grid (dict, optional) – Existing grid dictionary to update. If None, creates new dictionary. Defaults to None.

  • variables (list, optional) – List of output variable names in order: [x, y, depth, Qb, L, Setup, Hs, DirM]. If None, uses default names. Defaults to None.

Returns:

Dictionary containing wave parameters on grid:
  • ’x’, ‘y’: Coordinates

  • ’depth’: Water depth (m)

  • ’Qb’: Wave breaking dissipation

  • ’L’: Wavelength (m)

  • ’Setup’: Wave setup (m)

  • ’Hs’: Significant wave height (m)

  • ’DirM’: Mean wave direction (degrees)

  • ’kp’: Wave number (2π/L) computed from wavelength

Return type:

dict