Last active
October 7, 2019 02:28
-
-
Save ckunte/66e3ee632912c0517f7f53fba319165a to your computer and use it in GitHub Desktop.
Obtaining Hs and Tp values for a 5-year return period from an array of return period parameters furnished
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
""" | |
Obtaining Hs and Tp values for a 5-year return period from an | |
array of available return period parameters. | |
2019 ckunte | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def main(): | |
# Return period (years) | |
rp = [1, 10, 50, 100, 1000, 10000] | |
# Significant wave height (m) | |
Hs = [2.9, 6.9, 9.1, 9.9, 12.2, 14.5] | |
# Spectral peak wave period -- Central (s) | |
Tp = [9.6, 11.0, 11.7, 12.0, 12.8, 13.7] | |
plt.plot(rp, Hs, linewidth=2, label="Hs v. Return period") | |
plt.plot(rp, Tp, linewidth=2, label="Tp v. Return period") | |
plt.axvline(x=5, color='r', linestyle=":") | |
plt.xscale('log') | |
plt.xlabel('Return period (years)') | |
plt.ylabel('Hs (m) or Tp(s)') | |
plt.grid(True) | |
plt.legend(loc=0) | |
plt.savefig('plot_hstp-v-rp.png') | |
pass | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture}[style={font=\small}] | |
\begin{axis}[ | |
xmode=log, | |
xlabel=Return period (years), | |
ylabel=Hs (m) or Tp (s), | |
legend pos=south east | |
] | |
\addplot +[mark=none,thick,red] table { | |
1 2.9 | |
10 6.9 | |
50 9.1 | |
100 9.9 | |
1000 12.2 | |
10000 14.5 | |
}; | |
\addplot +[mark=none,thick,blue] table { | |
1 9.6 | |
10 11.0 | |
50 11.7 | |
100 12.0 | |
1000 12.8 | |
10000 13.7 | |
}; | |
\addplot +[mark=none,dotted,black] table { | |
5 2.9 | |
5 14.5 | |
}; | |
\addlegendentry{Hs v/s return period} | |
\addlegendentry{Tp v/s return period} | |
\addlegendentry{5 year return period} | |
\end{axis} | |
\end{tikzpicture} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment