wavespectra.input.swan.read_swans#

wavespectra.input.swan.read_swans(fileglob, ndays=None, int_freq=True, int_dir=False, dirorder=True, ntimes=None)[source]#

Read multiple SWAN ASCII files into single Dataset.

Args:
  • fileglob (str, list): glob pattern specifying files to read.

  • ndays (float): number of days to keep from each file, choose None to keep entire period.

  • int_freq (ndarray, bool): frequency array for interpolating onto:
    • ndarray: 1d array specifying frequencies to interpolate onto.

    • True: logarithm array is constructed such that fmin=0.0418 Hz, fmax=0.71856 Hz, df=0.1f.

    • False: No interpolation performed in frequency space.

  • int_dir (ndarray, bool): direction array for interpolating onto:
    • ndarray: 1d array specifying directions to interpolate onto.

    • True: circular array is constructed such that dd=10 degrees.

    • False: No interpolation performed in direction space.

  • dirorder (bool): if True ensures directions are sorted.

  • ntimes (int): use it to read only specific number of times, useful for checking headers only.

Returns:
  • dset (SpecDataset): spectra dataset object read from file with different sites and cycles concatenated along the ‘site’ and ‘time’ dimensions.

Note:
  • If multiple cycles are provided, ‘time’ coordinate is replaced by ‘cycletime’ multi-index coordinate.

  • If more than one cycle is prescribed from fileglob, each cycle must have same number of sites.

  • Either all or none of the spectra in fileglob must have tabfile associated to provide wind/depth data.

  • Concatenation is done with numpy arrays for efficiency.