Skip to content

Commit 1107f04

Browse files
DOC: Add references
1 parent a3396c3 commit 1107f04

4 files changed

Lines changed: 101 additions & 7 deletions

File tree

docs/user_guide/standardized_spectra.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ where,
129129
The index, :math:`j = 1, 2`, represents the lower frequency component (i.e., swell)
130130
and higher frequency component (i.e., wind) respectively.
131131

132+
.. note::
133+
134+
The Ochi-Hubble spectrum is implemented according to the `orinal paper <https://icce-ojs-tamu.tdl.org/icce/article/view/3066/2731>`_
135+
by M. K. Ochi and E. N. Hubble published in 1976. Refer to this paper for full implementation
136+
details.
137+
132138
The :class:`~waveresponse.OchiHubble` class provides functionality for generating a 1-D
133139
Ochi-Hubble spectrum component given three parameters (i.e., :math:`H_s`, :math:`T_p`
134140
and :math:`q`). The total spectrum is obtained by adding together the two wave components.

src/waveresponse/_core.py

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def complex_to_polar(complex_vals, phase_degrees=False):
3737
Amplitudes.
3838
phase : array
3939
Phase angles.
40+
4041
"""
4142
complex_vals = np.asarray_chkfinite(complex_vals)
4243
amp = np.abs(complex_vals)
@@ -1428,6 +1429,17 @@ def moment(self, n, freq_hz=None):
14281429
-------
14291430
float :
14301431
Spectral moment.
1432+
1433+
Notes
1434+
-----
1435+
The spectral moment is calculated according to Equation (8.31) and (8.32)
1436+
in reference [1].
1437+
1438+
References
1439+
----------
1440+
[1] A. Naess and T. Moan, (2013), "Stochastic dynamics of marine structures",
1441+
Cambridge University Press.
1442+
14311443
"""
14321444
f, spectrum = self.spectrum1d(axis=1, freq_hz=freq_hz)
14331445
m_n = trapz((f**n) * spectrum, f)
@@ -1440,9 +1452,20 @@ def tz(self):
14401452
14411453
Calculated from the zeroth- and second-order spectral moments according to:
14421454
1443-
``tz = sqrt(m0 / m2)``
1455+
``tz = sqrt(m0 / m2)``
14441456
14451457
where the spectral moments are calculated by integrating over frequency in Hz.
1458+
1459+
Notes
1460+
-----
1461+
The mean zero-crossing period is calculated according to Equation (8.33)
1462+
in reference [1].
1463+
1464+
References
1465+
----------
1466+
[1] A. Naess and T. Moan, (2013), "Stochastic dynamics of marine structures",
1467+
Cambridge University Press.
1468+
14461469
"""
14471470
m0 = self.moment(0, freq_hz=True)
14481471
m2 = self.moment(2, freq_hz=True)
@@ -1479,6 +1502,15 @@ def extreme(self, t, q=0.37):
14791502
the process amplitudes will be below the returned value with a given
14801503
probability.
14811504
1505+
Notes
1506+
-----
1507+
The extreme values are calculated according to Equation (1.46) in reference [1]_.
1508+
1509+
References
1510+
----------
1511+
.. [1] A. Naess and T. Moan, (2013), "Stochastic dynamics of marine structures",
1512+
Cambridge University Press.
1513+
14821514
"""
14831515
q = np.asarray_chkfinite(q)
14841516
return self.std() * np.sqrt(2.0 * np.log((t / self.tz) / np.log(1.0 / q)))
@@ -1495,7 +1527,17 @@ def hs(self):
14951527
14961528
Calculated from the zeroth-order spectral moment according to:
14971529
1498-
``hs = 4.0 * sqrt(m0)``
1530+
``hs = 4.0 * sqrt(m0)``
1531+
1532+
Notes
1533+
-----
1534+
The significant wave height is calculated according to equation (2.26) in
1535+
reference [1].
1536+
1537+
References
1538+
----------
1539+
[1] 0. M. Faltinsen, (1990), "Sea loads on ships and offshore structures",
1540+
Cambridge University Press.
14991541
"""
15001542
m0 = self.moment(0)
15011543
return 4.0 * np.sqrt(m0)
@@ -1731,6 +1773,17 @@ class CosineHalfSpreading(BaseSpreading):
17311773
degrees : bool
17321774
If directions passed to the spreading function will be given in 'degrees'.
17331775
If ``False``, 'radians' is assumed.
1776+
1777+
Notes
1778+
-----
1779+
The spreading function is implemented according to reference [1]_.
1780+
1781+
References
1782+
----------
1783+
.. [1] U. S. Army Engineer Waterways Experiment Station, Coastal Engineering Research
1784+
Center. (1985, June). "Directional wave spectra using cosine-squared and cosine 2s
1785+
spreading functions". Retrieved January 31, 2023, from
1786+
https://apps.dtic.mil/sti/pdfs/ADA591687.pdf.
17341787
"""
17351788

17361789
def __init__(self, s=1, degrees=False):
@@ -1775,6 +1828,17 @@ class CosineFullSpreading(BaseSpreading):
17751828
degrees : bool
17761829
If directions passed to the spreading function will be given in 'degrees'.
17771830
If ``False``, 'radians' is assumed.
1831+
1832+
Notes
1833+
-----
1834+
The spreading function is implemented according to reference [1]_.
1835+
1836+
References
1837+
----------
1838+
.. [1] U. S. Army Engineer Waterways Experiment Station, Coastal Engineering Research
1839+
Center. (1985, June). "Directional wave spectra using cosine-squared and cosine 2s
1840+
spreading functions". Retrieved January 31, 2023, from
1841+
https://apps.dtic.mil/sti/pdfs/ADA591687.pdf.
17781842
"""
17791843

17801844
def __init__(self, s=1, degrees=False):

src/waveresponse/_standardized1d.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ class BasePMSpectrum(BaseSpectrum1d):
9292
ModifiedPiersonMoskowitz : Modified Pierson-Moskowitz wave spectrum.
9393
JONSWAP : JONSWAP wave spectrum.
9494
OchiHubble : Ochi-Hubble (three-parameter) wave spectrum.
95+
96+
Notes
97+
-----
98+
Pierson-Moskowitz type of spectra are implemented according to Equation (8.14)
99+
in reference [1]_.
100+
101+
References
102+
----------
103+
.. [1] A. Naess and T. Moan, (2013), "Stochastic dynamics of marine structures",
104+
Cambridge University Press.
105+
95106
"""
96107

97108
def __call__(self, A, B, freq_hz=None):
@@ -157,6 +168,17 @@ class ModifiedPiersonMoskowitz(BasePMSpectrum):
157168
--------
158169
JONSWAP : JONSWAP wave spectrum.
159170
OchiHubble : Ochi-Hubble (three-parameter) wave spectrum.
171+
172+
Notes
173+
-----
174+
The modified Pierson-Moskowitz spectrum is implemented according to Section 8.2.2
175+
in reference [1]_.
176+
177+
References
178+
----------
179+
.. [1] A. Naess and T. Moan, (2013), "Stochastic dynamics of marine structures",
180+
Cambridge University Press.
181+
160182
"""
161183

162184
def __call__(self, hs, tp, freq_hz=None):
@@ -332,6 +354,13 @@ class OchiHubble(BaseSpectrum1d):
332354
-----
333355
The special case ``q=1`` corresponds to the modified Pierson-Moskowitz spectrum.
334356
357+
The Ochi-Hubble spectrum is implemented as described in reference [1]_.
358+
359+
References
360+
----------
361+
.. [1] Ochi M K and Hubble E N, 1976. "Six-parameter wave spectra", Proc 15th
362+
Coastal Engineering Conference, 301-328.
363+
335364
See Also
336365
--------
337366
ModifiedPiersonMoskowitz : Modified Pierson-Moskowitz wave spectrum.

tests/test_core.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def rao(freq_dirs):
7373

7474
@pytest.fixture
7575
def rao_for_mirroring():
76-
7776
freq = np.linspace(0, 1.0, 3)
7877
dirs = np.linspace(0, 180, 3, endpoint=True)
7978
vals = np.array(
@@ -141,7 +140,6 @@ def test_sort():
141140

142141

143142
class Test__robust_modulus:
144-
145143
params_robust_modulus = [
146144
(2.5, 2.0, 0.5),
147145
(2.0, 2.0, 0.0),
@@ -656,7 +654,6 @@ def test_mirror_twise(self, mask_bounds, sym_plane_order, dof):
656654

657655

658656
class Test__check_foldable:
659-
660657
check_foldable_valid = [
661658
(
662659
np.linspace(
@@ -1408,7 +1405,6 @@ def test_interpolate_single_coordinate(self):
14081405
np.testing.assert_array_almost_equal(vals_out, vals_expect)
14091406

14101407
def test_interpolate_fill_value(self):
1411-
14121408
freq = np.array([0, 1, 2])
14131409
dirs = np.array([0, 90, 180, 270])
14141410
vals = np.array(
@@ -1433,7 +1429,6 @@ def test_interpolate_fill_value(self):
14331429
np.testing.assert_array_almost_equal(vals_out, vals_expect)
14341430

14351431
def test_interpolate_fill_value_None(self):
1436-
14371432
freq = np.array([0, 1, 2])
14381433
dirs = np.array([0, 90, 180, 270])
14391434
vals = np.array(

0 commit comments

Comments
 (0)