dfsu.DfsuSpectral
self, filename) dfsu.DfsuSpectral(
Attributes
Name | Description |
---|---|
deletevalue | File delete value. |
directions | Directional axis. |
end_time | File end time. |
frequencies | Frequency axis. |
geometry | Geometry. |
items | List of items. |
n_directions | Number of directions. |
n_frequencies | Number of frequencies. |
n_items | Number of items. |
n_timesteps | Number of time steps. |
start_time | File start time. |
timestep | Time step size in seconds. |
Methods
Name | Description |
---|---|
calc_Hm0_from_spectrum | Calculate significant wave height (Hm0) from spectrum. |
read | Read data from a spectral dfsu file. |
calc_Hm0_from_spectrum
=True) dfsu.DfsuSpectral.calc_Hm0_from_spectrum(spectrum, tail
Calculate significant wave height (Hm0) from spectrum.
Parameters
Name | Type | Description | Default |
---|---|---|---|
spectrum | (np.ndarray, DataArray) | frequency or direction-frequency spectrum | required |
tail | bool | Should a parametric spectral tail be added in the computations? by default True | True |
Returns
Name | Type | Description |
---|---|---|
np.ndarray | significant wave height values |
read
dfsu.DfsuSpectral.read(=None,
items=None,
time=None,
elements=None,
nodes=None,
area=None,
x=None,
y=False,
keepdims=np.float32,
dtype )
Read data from a spectral dfsu file.
Parameters
Name | Type | Description | Default |
---|---|---|---|
items | str | int | Sequence[str | int] | None | Read only selected items, by number (0-based), or by name | None |
time | int | str | slice | None | Read only selected time steps, by default None (=all) | None |
keepdims | bool | When reading a single time step only, should the time-dimension be kept in the returned Dataset? by default: False | False |
area | tuple[float, float, float, float] | None | Read only data inside (horizontal) area (spectral area files only) given as a bounding box (tuple with left, lower, right, upper) or as list of coordinates for a polygon, by default None | None |
x | float | None | Read only data for elements containing the (x,y) points(s), by default None | None |
y | float | None | Read only data for elements containing the (x,y) points(s), by default None | None |
elements | Sequence[int] | np.ndarray | None | Read only selected element ids (spectral area files only) | None |
nodes | Sequence[int] | np.ndarray | None | Read only selected node ids (spectral line files only) | None |
dtype | Any | Data type to read. Default is np.float32 | np.float32 |
Returns
Name | Type | Description |
---|---|---|
Dataset | A Dataset with dimensions [t,elements/nodes,frequencies,directions] |
Examples
>>> mikeio.read("tests/testdata/spectra/line_spectra.dfsu")
<mikeio.Dataset>
4, node:10, direction:16, frequency:25)
dims: (time:2017-10-27 00:00:00 - 2017-10-27 05:00:00 (4 records)
time: 9 elements, 10 nodes)
geometry: DfsuSpectral1D (
items:0: Energy density <Wave energy density> (meter pow 2 sec per deg)
>>> mikeio.read("tests/testdata/spectra/area_spectra.dfsu", time=-1)
<mikeio.Dataset>
40, direction:16, frequency:25)
dims: (element:2017-10-27 05:00:00 (time-invariant)
time: 40 elements, 33 nodes)
geometry: DfsuSpectral2D (
items:0: Energy density <Wave energy density> (meter pow 2 sec per deg)