Welcome to metocean-stats’s documentation!

metocean-stats is a Python tool for comprehensive statistics and visualization of metocean data (wind, waves, ocean currents, tide levels, air and water temperature, sea ice, and more). The input data is conveniently provided within the tool as a Pandas DataFrame (time series of metocean variables) from a single position.

The tool is designed with cross-platform compatibility in mind. It can smoothly operate on various operating systems, including Linux, Windows, and MacOS. It is also compatible with WEkEO Jupyter Lab, allowing seamless integration and use. For instructions on how to install metocean-stats in WEkEO, please refer here

The tool contains functions that generate:
  • general (e.g., seasonal, annual) statistics,

  • extreme statistics,

  • marine operation statistics.

Installing metocean-stats

Alternative 1: Using Miniforge (alternative to Miniconda)

  1. Install miniforge (download)

  2. Set up a Python 3 environment for metocean-stats and install metocean-stats

$ mamba create -n metocean-stats python=3 metocean-stats
$ conda activate metocean-stats

Alternative 2: Using Miniforge (alternative to Miniconda) and Git

  1. Install miniforge (download)

  2. Clone metocean-stats:

$ git clone https://github.com/MET-OM/metocean-stats.git
$ cd metocean-stats/
  1. Create environment with the required dependencies and install metocean-stats

$ mamba env create -f environment.yml
$ conda activate metocean-stats
$ pip install --no-deps -e .

This installs the metocean-stats as an editable package. Therefore, you can directly change the repository or fetch the newest changes with git pull.

To update the local conda environment in case new dependencies are added to environment.yml:

$ mamba env update -f environment.yml

Metocean Statistics

Import plots and tables from metocean-stats:

from metocean_stats import plots, tables

Scatter Diagram

tables.scatter_diagram(
    df,
    var1='HS',
    step_var1=1,
    var2='TP',
    step_var2=1,
    output_file='Hs_Tp_scatter.csv'
)
Scatter diagram

HS/TP

2-3 | 0.00%

3-4 | 0.21%

4-5 | 1.96%

5-6 | 6.74%

6-7 | 12.62%

7-8 | 15.56%

8-9 | 16.86%

9-10 | 14.14%

10-11 | 12.11%

11-12 | 8.53%

12-13 | 5.42%

13-14 | 2.69%

14-15 | 1.52%

15-16 | 0.93%

16-17 | 0.39%

17-18 | 0.18%

18-19 | 0.12%

19-20 | 0.01%

20-21 | 0.01%

21-22 | 0.00%

22-23 | 0.00%

13.0-14.0 | 0.00%

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

12.0-13.0 | 0.01%

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

11.0-12.0 | 0.01%

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

10.0-11.0 | 0.04%

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.01

0.01

0.01

0.01

0.0

0.0

0.0

0.0

0.0

0.0

0.0

09.0-10.0 | 0.12%

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.01

0.03

0.04

0.02

0.01

0.01

0.0

0.0

0.0

0.0

0.0

0.0

08.0-09.0 | 0.28%

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.01

0.05

0.11

0.07

0.02

0.02

0.0

0.0

0.0

0.0

0.0

0.0

0.0

07.0-08.0 | 0.74%

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.07

0.23

0.26

0.11

0.04

0.02

0.0

0.0

0.0

0.0

0.0

0.0

0.0

06.0-07.0 | 1.78%

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.09

0.39

0.71

0.36

0.13

0.06

0.04

0.01

0.01

0.0

0.0

0.0

0.0

0.0

05.0-06.0 | 3.54%

0.0

0.0

0.0

0.0

0.0

0.0

0.11

0.59

1.27

0.9

0.33

0.15

0.09

0.06

0.02

0.01

0.01

0.0

0.0

0.0

0.0

04.0-05.0 | 7.40%

0.0

0.0

0.0

0.0

0.0

0.08

1.14

2.23

1.94

0.9

0.51

0.3

0.14

0.09

0.03

0.02

0.01

0.0

0.0

0.0

0.0

03.0-04.0 | 14.13%

0.0

0.0

0.0

0.0

0.26

1.65

3.97

3.08

1.87

1.3

1.02

0.46

0.23

0.14

0.07

0.04

0.02

0.0

0.0

0.0

0.0

02.0-03.0 | 24.66%

0.0

0.0

0.01

0.41

3.14

5.47

4.62

3.11

3.02

2.29

1.21

0.55

0.38

0.24

0.12

0.05

0.04

0.0

0.0

0.0

0.0

01.0-02.0 | 35.42%

0.0

0.03

0.92

4.09

6.78

6.61

5.8

4.11

2.76

1.56

1.19

0.73

0.41

0.25

0.09

0.04

0.02

0.0

0.0

0.0

0.0

00.0-01.0 | 11.87%

0.0

0.18

1.03

2.23

2.43

1.74

1.23

0.94

0.76

0.58

0.38

0.15

0.1

0.06

0.03

0.01

0.01

0.0

0.0

0.0

0.0

tables.scatter_diagram(
    df,
    var1='HS',
    step_var1=1,
    var2='TP',
    step_var2=1,
    output_file='Hs_Tp_scatter.png'
)
_images/Hs_Tp_scatter.png

Wind Profile Return Values Table

tables.table_profile_return_values(
    df,
    var=['W10', 'W50', 'W80', 'W100', 'W150'],
    z=[10, 50 , 80, 100, 150],
    periods=[1, 10, 100, 10000],
    output_file='RVE_wind_profile.csv'
)

z

Return period 1 [years]

Return period 10 [years]

Return period 100 [years]

Return period 10000 [years]

m

m/s

m/s

m/s

m/s

10

27.83

30.63

33.8

39.34

50

31.84

35.15

38.89

45.46

80

32.74

36.14

39.98

46.74

100

33.11

36.54

40.43

47.26

150

34.8

38.47

42.64

49.96

Wind Profile Return Values Plot

plots.plot_profile_return_values(
    df,
    var=['W10', 'W50', 'W80', 'W100', 'W150'],
    z=[10, 50, 80, 100, 150],
    periods=[1, 10, 100, 10000],
    reverse_yaxis=False,
    title='Return Periods over z',
    units='m/s',
    distribution='Weibull3P',
    method='default',
    threshold='default',
    output_file='RVE_wind_profile.png'
)
_images/RVE_wind_profile.png

Wind Profile Statistics Plot

plots.plot_profile_stats(
    df,
    var=['W10', 'W50', 'W80', 'W100', 'W150'],
    z=[10, 50, 80, 100, 150],
    reverse_yaxis=False,
    output_file='wind_stats_profile.png'
)
_images/wind_stats_profile.png

Directional Wind Return Periods (NORSOK Adjustment)

plots.plot_directional_return_periods(
    df,
    var='W10',
    var_dir='D10',
    periods=[1, 10, 100, 1000],
    distribution='Weibull3P_MOM',
    adjustment='NORSOK',
    units='m/s',
    output_file='Wind.dir_extremes_weibull_norsok.png'
)
_images/Wind.dir_extremes_weibull_norsok.png

Directional Wind Return Periods (No Adjustment)

plots.plot_directional_return_periods(
    df,
    var='W10',
    var_dir='D10',
    periods=[1, 10, 100, 1000],
    distribution='Weibull3P_MOM',
    adjustment=None,
    units='m/s',
    output_file='Wind.dir_extremes_weibull.png'
)
_images/Wind.dir_extremes_weibull.png

Monthly Non-Exceedance Table

tables.table_monthly_non_exceedance(
    df,
    var='HS',
    step_var=0.5,
    output_file='Hs_table_monthly_non_exceedance.csv'
)

HS-level

JAN

FEB

MAR

MAY

APR

JUN

JUL

AUG

SEP

OCT

NOV

DEC

Year

<0.5

0.16

0.27

0.55

1.24

2.55

3.37

4.5

4.17

1.32

0.52

0.35

0.28

1.61

<1.0

2.95

4.93

6.07

15.51

25.77

31.47

37.0

33.01

14.42

6.62

4.01

3.47

15.44

<1.5

10.18

16.18

18.05

37.1

52.27

60.63

66.85

61.75

36.99

20.61

13.32

12.16

33.84

<2.0

22.44

29.75

33.28

56.46

71.95

78.33

83.95

80.12

56.52

37.77

28.18

23.6

50.2

<2.5

35.63

43.85

49.52

70.79

83.89

88.6

92.28

90.3

70.65

54.52

44.09

37.49

63.47

<3.0

48.4

56.88

62.79

81.4

90.81

94.27

96.32

94.88

80.99

67.79

58.74

51.28

73.71

<3.5

59.88

67.65

73.53

88.1

95.14

97.12

98.38

97.46

88.38

77.55

69.9

62.9

81.33

<4.0

70.04

76.41

81.75

92.49

97.58

98.62

99.24

98.82

93.19

84.89

78.71

72.43

87.01

<4.5

78.06

82.99

87.7

95.56

98.7

99.31

99.65

99.45

96.03

90.38

85.15

80.0

91.08

<5.0

84.06

88.19

91.79

97.25

99.4

99.71

99.86

99.73

97.49

94.09

89.97

85.42

93.91

<5.5

88.58

92.04

94.53

98.24

99.67

99.84

99.94

99.84

98.37

96.32

93.36

89.86

95.88

<6.0

91.88

94.74

96.5

98.8

99.8

99.97

99.98

99.88

98.99

97.75

95.74

93.04

97.26

<6.5

94.4

96.7

97.86

99.26

99.86

99.98

100.0

99.92

99.4

98.68

97.42

95.5

98.25

<7.0

96.22

98.07

98.68

99.53

99.93

99.99

100.0

99.96

99.65

99.23

98.39

97.1

98.9

<7.5

97.44

98.82

99.27

99.69

99.98

99.99

100.0

99.97

99.78

99.54

99.12

98.16

99.31

<8.0

98.37

99.35

99.6

99.8

99.99

100.0

100.0

99.99

99.87

99.69

99.47

98.83

99.58

<8.5

98.93

99.58

99.8

99.88

100.0

100.0

100.0

99.99

99.91

99.76

99.74

99.26

99.74

<9.0

99.32

99.74

99.95

99.92

100.0

100.0

100.0

100.0

99.94

99.84

99.86

99.49

99.84

<9.5

99.6

99.84

100.0

99.96

100.0

100.0

100.0

100.0

99.96

99.88

99.94

99.64

99.9

<10.0

99.78

99.93

100.0

100.0

100.0

100.0

100.0

100.0

99.98

99.92

99.95

99.79

99.95

<10.5

99.87

99.98

100.0

100.0

100.0

100.0

100.0

100.0

99.98

99.96

99.97

99.88

99.97

<11.0

99.93

100.0

100.0

100.0

100.0

100.0

100.0

100.0

99.99

99.99

99.99

99.91

99.98

<11.5

99.96

100.0

100.0

100.0

100.0

100.0

100.0

100.0

99.99

99.99

99.99

99.94

99.99

<12.0

99.97

100.0

100.0

100.0

100.0

100.0

100.0

100.0

99.99

100.0

99.99

99.96

99.99

<12.5

99.99

100.0

100.0

100.0

100.0

100.0

100.0

100.0

99.99

100.0

100.0

99.97

100.0

<13.0

99.99

100.0

100.0

100.0

100.0

100.0

100.0

100.0

99.99

100.0

100.0

100.0

100.0

<13.5

99.99

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

<14.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

100.0

Minimum

0.3

0.3

0.3

0.3

0.2

0.2

0.2

0.2

0.2

0.3

0.3

0.3

0.2

Mean

3.42

3.07

2.85

2.15

1.71

1.54

1.41

1.5

2.14

2.67

3.03

3.3

2.4

P50

3.1

2.8

2.6

1.9

1.5

1.3

1.2

1.3

1.9

2.4

2.7

3.0

2.0

P75

4.3

4.0

3.6

2.7

2.1

1.9

1.8

1.9

2.7

3.4

3.8

4.2

3.1

P95

6.7

6.1

5.7

4.4

3.5

3.2

2.9

3.1

4.3

5.2

5.9

6.4

5.3

P99

8.6

7.7

7.3

6.2

4.7

4.3

3.8

4.1

6.1

6.8

7.4

8.28

7.2

Maximum

13.9

10.8

9.5

10.0

8.4

7.8

6.4

8.7

13.4

11.8

12.4

13.0

13.9

Monthly Statistics Plot

plots.plot_monthly_stats(
    df,
    var='HS',
    show=['Maximum','P99','Mean'],
    title='Hs[m]',
    output_file='Hs_monthly_stats.png'
)
_images/Hs_monthly_stats.png

Directional Non-Exceedance Table

tables.table_directional_non_exceedance(
    df,
    var='HS',
    step_var=0.5,
    var_dir='DIRM',
    output_file='table_directional_non_exceedance.csv'
)

HS-level

30°

60°

90°

120°

150°

180°

210°

240°

270°

300°

330°

Omni

<0.5

0.31

0.02

0.01

0.0

0.01

0.04

0.13

0.16

0.19

0.27

0.23

0.25

1.62

<1.0

3.58

0.29

0.09

0.07

0.11

0.49

1.29

1.37

1.42

1.98

2.06

2.74

15.5

<1.5

8.11

0.55

0.18

0.14

0.25

1.34

3.54

3.02

2.94

3.9

4.07

5.9

33.94

<2.0

11.99

0.68

0.24

0.2

0.36

2.26

5.97

4.59

4.43

5.56

5.61

8.43

50.3

<2.5

14.69

0.76

0.27

0.24

0.42

3.13

8.06

5.94

5.77

7.07

6.83

10.39

63.56

<3.0

16.5

0.79

0.28

0.25

0.45

3.89

9.81

7.03

6.92

8.25

7.75

11.87

73.78

<3.5

17.63

0.8

0.29

0.25

0.46

4.54

11.18

7.93

7.84

9.18

8.39

12.89

81.39

<4.0

18.37

0.8

0.29

0.26

0.48

5.11

12.22

8.66

8.56

9.88

8.84

13.59

87.05

<4.5

18.79

0.81

0.29

0.26

0.48

5.56

13.01

9.16

9.09

10.4

9.15

14.11

91.11

<5.0

19.04

0.81

0.29

0.26

0.48

5.92

13.64

9.49

9.43

10.73

9.38

14.46

93.93

<5.5

19.19

0.81

0.29

0.26

0.48

6.17

14.07

9.72

9.67

10.99

9.53

14.72

95.89

<6.0

19.29

0.81

0.29

0.26

0.48

6.37

14.34

9.9

9.83

11.15

9.63

14.91

97.26

<6.5

19.34

0.81

0.29

0.26

0.48

6.52

14.53

10.03

9.94

11.29

9.71

15.06

98.25

<7.0

19.38

0.81

0.29

0.26

0.48

6.62

14.63

10.11

10.0

11.39

9.76

15.16

98.9

<7.5

19.41

0.81

0.29

0.26

0.48

6.69

14.71

10.15

10.04

11.45

9.79

15.23

99.31

<8.0

19.42

0.81

0.29

0.26

0.48

6.74

14.75

10.17

10.07

11.49

9.82

15.28

99.58

<8.5

19.44

0.81

0.29

0.26

0.48

6.77

14.78

10.18

10.08

11.51

9.84

15.31

99.74

<9.0

19.44

0.81

0.29

0.26

0.48

6.79

14.8

10.18

10.1

11.52

9.85

15.32

99.84

<9.5

19.44

0.81

0.29

0.26

0.48

6.81

14.81

10.18

10.1

11.53

9.86

15.33

99.9

<10.0

19.45

0.81

0.29

0.26

0.48

6.82

14.81

10.18

10.11

11.54

9.86

15.35

99.95

<10.5

19.45

0.81

0.29

0.26

0.48

6.82

14.82

10.18

10.11

11.54

9.86

15.35

99.97

<11.0

19.45

0.81

0.29

0.26

0.48

6.82

14.82

10.18

10.11

11.54

9.86

15.35

99.98

<11.5

19.45

0.81

0.29

0.26

0.48

6.82

14.82

10.18

10.11

11.54

9.86

15.36

99.99

<12.0

19.45

0.81

0.29

0.26

0.48

6.82

14.82

10.18

10.11

11.54

9.86

15.36

99.99

<12.5

19.45

0.81

0.29

0.26

0.48

6.82

14.82

10.18

10.11

11.54

9.87

15.36

100.0

<13.0

19.45

0.81

0.29

0.26

0.48

6.82

14.82

10.18

10.11

11.55

9.87

15.36

100.0

<13.5

19.45

0.81

0.29

0.26

0.48

6.82

14.82

10.18

10.11

11.55

9.87

15.36

100.0

<14.0

19.45

0.81

0.29

0.26

0.48

6.82

14.82

10.18

10.11

11.55

9.87

15.36

100.0

Mean

2.0

1.38

1.48

1.57

1.69

3.08

2.7

2.54

2.56

2.46

2.2

2.28

2.4

P50

1.7

1.2

1.3

1.5

1.5

2.7

2.4

2.2

2.3

2.1

1.8

1.9

2.0

P75

2.5

1.7

1.8

2.0

2.1

4.1

3.5

3.4

3.4

3.3

2.8

2.9

3.1

P95

4.2

2.6

2.8

2.8

3.4

6.4

5.6

5.4

5.4

5.5

5.0

5.3

5.3

P99

5.9

3.4

3.8

3.9

4.2

8.2

7.3

6.8

7.1

7.4

7.2

7.4

7.2

Maximum

11.8

4.8

4.7

4.9

6.1

10.9

10.3

12.5

11.3

13.9

13.4

13.0

13.9

Directional Statistics Plot

plots.plot_directional_stats(
    df,
    var='HS',
    step_var=0.5,
    var_dir='DIRM',
    title='$H_s$[m]',
    output_file='directional_stats.png'
)
_images/directional_stats.png

Prob. of Non-Exceedance (fitted)

plots.plot_prob_non_exceedance_fitted_3p_weibull(df,
                                                 var='HS',
                                                 output_file='prob_non_exceedance_fitted_3p_weibull.png')
_images/prob_non_exceedance_fitted_3p_weibull.png

Joint Distribution Hs-Tp Plot

plots.plot_joint_distribution_Hs_Tp(
    df,
    var_hs='HS',
    var_tp='TP',
    periods=[1,10,100,1000],
    title='Hs-Tp joint distribution',
    output_file='Hs.Tp.joint.distribution.png',
    density_plot=True
)
_images/Hs.Tp.joint.distribution.png

Joint 2D distribution contours

plots.plot_joint_2D_contour(
    df,
    var1='HS',
    var2='TP',
    return_periods=[1,10,100,1000],
)
_images/contours.png

Joint 3D distribution contour

plots.plot_joint_3D_contour(
    df,
    var1 = 'W10',
    var2 = 'HS',
    var3 = 'TP',
    return_period=100
)
_images/3D_contour.png

Joint 3D distribution contour cross-sections

plots.plot_joint_3D_contour_slices(
   df,
   var1 = 'W10',
   var2 = 'HS',
   var3 = 'TP',
   slice_values = [5,10,15,20,25]
)
_images/3D_contour_slices.png

Monthly Joint Distribution Hs-Tp Parameter Table

tables.table_monthly_joint_distribution_Hs_Tp_param(
    df,
    var_hs='HS',
    var_tp='TP',
    periods=[1,10,100,10000],
    output_file='monthly_Hs_Tp_joint_param.csv'
)

Month

a1

a2

a3

b1

b2

b3

Jan

1.839

0.316

0.36

0.005

0.142

0.422

Feb

1.819

0.329

0.36

0.005

0.153

0.439

Mar

1.775

0.343

0.36

0.005

0.161

0.493

Apr

1.637

0.436

0.36

0.005

0.122

0.411

May

1.524

0.462

0.36

0.005

0.13

0.552

Jun

1.591

0.39

0.36

0.005

0.138

0.771

Jul

1.461

0.46

0.36

0.005

0.116

0.72

Aug

1.509

0.442

0.36

0.005

0.128

0.717

Sept

1.55

0.455

0.36

0.005

0.117

0.454

Oct

1.605

0.447

0.36

0.005

0.125

0.421

Nov

1.779

0.348

0.36

0.005

0.124

0.413

Dec

1.79

0.352

0.36

0.005

0.141

0.422

Year

1.526

0.48

0.36

0.005

0.122

0.401

Directional Joint Distribution Hs-Tp Parameter Table

tables.table_directional_joint_distribution_Hs_Tp_param(
    df,
    var_hs='HS',
    var_tp='TP',
    var_dir='DIRM',
    periods=[1,10,100],
    output_file='dir_Hs_Tp_joint_param.csv'
)

Direction

a1

a2

a3

b1

b2

b3

1.396

0.574

0.36

0.005

0.08

0.313

30°

1.133

0.84

0.36

0.005

0.056

0.265

60°

1.189

0.776

0.36

0.005

0.01

-0.713

90°

1.112

0.83

0.36

0.005

0.055

0.136

120°

1.363

0.607

0.36

0.005

0.058

0.065

150°

1.453

0.486

0.36

0.005

0.109

0.527

180°

1.332

0.537

0.36

0.005

0.118

0.603

210°

1.369

0.533

0.36

0.005

0.221

0.695

240°

1.625

0.413

0.36

0.005

0.258

0.641

270°

1.78

0.359

0.36

0.005

0.188

0.497

300°

1.742

0.407

0.36

0.005

0.11

0.393

330°

1.548

0.519

0.36

0.005

0.085

0.394

Omni

1.522

0.483

0.36

0.005

0.121

0.389

Joint Distribution Hs-Tp Multi Plot with binned Var3

plots.plots.plot_multi_joint_distribution_Hs_Tp_var3(
   df,
   var_hs='HS',
   var_tp='TP',
   var3='W10',
   var3_units='m/s',
   periods=[100],
   var3_bin=5,
   threshold_min=100,
   output_file='Hs.Tp.joint.distribution.multi.binned.var3.png'
   )
_images/Hs.Tp.joint.distribution.multi.binned.var3.png

Monthly Weather Window Multiple Variables Plot (Waiting time in Days)

plots.plot_monthly_weather_window(
    df,
    var=['W10','HS','TP'],
    threshold=[12.35,2,8],
    window_size=62,
    timestep=3,
    add_table=True,
    output_file='NORA10_monthly_weather_window_mv_plot.png'
)
_images/NORA10_monthly_weather_window_mv_plot.png

Number Of Hours Per Year Below A Threshold Plot

plots.plot_nb_hours_below_threshold(
    df,
    var='HS',
    thr_arr=(np.arange(0.05,20.05,0.05)).tolist(),
    output_file='number_hours_per_year.png'
)
_images/nb_hour_below_thr.png

Number Of Hours Per Year Below A Threshold Table

tables.table_nb_hours_below_threshold(
    df,
    var='HS',
    threshold=[1,2,3,4,5,6,7,8,9,10],
    output_file='number_hours_per_year.csv'
)

HS

Minimum

Mean

Maximum

<1

771

1227

1812

<2

3783

4454

5025

<3

6036

6582

7086

<4

7260

7717

8055

<5

7971

8279

8472

<6

8397

8538

8670

<7

8583

8676

8745

<8

8694

8734

8778

<9

8736

8756

8784

<10

8742

8763

8784

All-Year Round Weather Window For Hs Under A Threshold Table

tables.table_weather_window_thresholds(
    df,
    var='HS',
    threshold=[0.5,1,2],
    op_duration=[6,12,24,48],
    output_file='weather_window_thresholds.csv'
)

Operation duration [h]

HS<0.5m

HS<1m

HS<2m

6

130.66

16.63

2.2

12

185.78

20.07

3.26

24

433.91

31.09

5.73

48

702.67

68.74

11.06

Characteristic durations for custom sequence of operation limits

import pandas as pd
limits = pd.DataFrame({
    "HS":[2.5]*24+[3.0]*48,
    "TP":[20]*24+[25]*48
})
plots.plot_characteristic_durations(data,limits)
_images/figure_characteristic_durations_custom_limits.png

Empirical weather window probability in different time periods in the year

import pandas as pd
limits = pd.DataFrame({
    "HS":[2.5]*24+[3.0]*48,
    "TP":[20]*24+[25]*48
})
plots.plot_weather_window_probability(data,limits)
_images/figure_weather_window_probability.png

Monthly Return Periods Table

tables.table_monthly_return_periods(
    df,
    var='HS',
    periods=[1, 10, 100, 10000],
    distribution='Weibull3P_MOM',
    units='m',
    output_file='HS_monthly_extremes_Weibull.csv'
)

Month

Annual prob.

Shape

Scale

Location

Return period: 1 [years]

Return period: 10 [years]

Return period: 100 [years]

Return period: 10000 [years]

0

%

m

m

m

m

m

m

1

Jan

8.33

1.542

2.864

0.84

9.52

11.72

13.7

17.24

2

Feb

8.33

1.608

2.756

0.6

8.5

10.44

12.17

15.23

3

Mar

8.33

1.547

2.431

0.66

8.0

9.85

11.52

14.49

4

Apr

8.33

1.217

1.56

0.68

7.01

9.12

11.12

14.89

5

May

8.33

1.247

1.236

0.56

5.43

7.0

8.48

11.26

6

Jun

8.33

1.248

1.096

0.52

4.81

6.2

7.51

9.96

7

Jul

8.33

1.219

0.952

0.52

4.39

5.67

6.88

9.17

8

Aug

8.33

1.161

0.984

0.57

4.86

6.36

7.79

10.54

9

Sept

8.33

1.226

1.536

0.7

6.87

8.9

10.83

14.46

10

Oct

8.33

1.424

2.098

0.77

7.73

9.66

11.43

14.64

11

Nov

8.33

1.544

2.469

0.8

8.25

10.14

11.85

14.89

12

Dec

8.33

1.541

2.769

0.81

9.21

11.34

13.26

16.68

13

Year

100.0

1.293

2.037

0.51

10.66

12.86

14.95

18.88

Directional Return Periods Table

tables.table_directional_return_periods(
    df,
    var='HS',
    periods=[1, 10, 100, 10000],
    units='m',
    var_dir='DIRM',
    distribution='Weibull3P_MOM',
    adjustment='NORSOK',
    output_file='directional_extremes_weibull.csv'
)

Direction sector

Sector prob.

Shape

Scale

Location

Return period: 1 [years]

Return period: 10 [years]

Return period: 100 [years]

Return period: 10000 [years]

0

%

m

m

m

m

m

m

1

19.45

1.155

1.38

0.69

10.66

12.86

14.95

18.88

2

30°

0.81

1.362

0.954

0.51

6.76

7.56

8.32

9.78

3

60°

0.29

1.356

1.051

0.51

7.05

7.96

8.83

10.48

4

90°

0.26

1.481

1.151

0.53

6.63

7.41

8.15

9.53

5

120°

0.48

1.347

1.204

0.59

8.39

9.44

10.45

12.37

6

150°

6.82

1.589

2.976

0.41

10.66

12.86

14.95

18.88

7

180°

14.82

1.499

2.424

0.52

10.66

12.86

14.95

18.88

8

210°

10.18

1.552

2.466

0.32

10.66

12.86

14.95

18.88

9

240°

10.11

1.472

2.388

0.4

10.66

12.86

14.95

18.88

10

270°

11.55

1.319

2.206

0.43

10.66

12.86

14.95

18.88

11

300°

9.87

1.149

1.731

0.55

10.66

12.86

14.95

18.88

12

330°

15.36

1.149

1.782

0.59

10.66

12.86

14.95

18.88

13

Omni

100.0

1.293

2.037

0.51

10.66

12.86

14.95

18.88

Monthly Return Periods Plot

plots.plot_monthly_return_periods(
    df,
    var='HS',
    periods=[1, 10, 100],
    distribution='Weibull3P_MOM',
    units='m',
    output_file='HS_monthly_extremes.png'
)
_images/HS_monthly_extremes.png

Directional Return Periods Plot (GUM)

plots.plot_directional_return_periods(
    df,
    var='HS',
    var_dir='DIRM',
    periods=[1, 10, 100, 10000],
    distribution='GUM',
    units='m',
    output_file='dir_extremes_GUM.png'
)
_images/dir_extremes_GUM.png

Directional Return Periods Plot (Weibull)

plots.plot_directional_return_periods(
    df,
    var='HS',
    var_dir='DIRM',
    periods=[1, 10, 100, 10000],
    distribution='Weibull3P_MOM',
    units='m',
    adjustment='NORSOK',
    output_file='dir_extremes_Weibull_norsok.png'
)
_images/dir_extremes_Weibull_norsok.png

Monthly Joint Distribution Hs-Tp Return Values Table

tables.table_monthly_joint_distribution_Hs_Tp_return_values(
    df,
    var_hs='HS',
    var_tp='TP',
    periods=[1,10,100,10000],
    model='lonowe' # change to 'hs_tp' for DNV model
    output_file='monthly_Hs_Tp_joint_return_values.csv'
)

Month

Annual prob.[%]

H_s [1 years]

T_p [1 years]

H_s [10 years]

T_p [10 years]

H_s [100 years]

T_p [100 years]

H_s [10000 years]

T_p [10000 years]

Jan

8.33

9.97

13.11

11.69

13.69

13.67

14.31

17.22

15.37

Feb

8.33

8.89

12.89

10.41

13.47

12.15

14.09

15.22

15.11

Mar

8.33

8.37

12.49

9.83

13.07

11.49

13.69

14.47

14.71

Apr

8.33

7.43

12.77

9.09

13.67

11.09

14.71

14.87

16.53

May

8.33

5.73

11.11

6.97

11.85

8.45

12.69

11.23

14.15

Jun

8.33

5.07

9.97

6.17

10.47

7.49

11.05

9.93

12.03

Jul

8.33

4.63

9.75

5.65

10.35

6.85

11.01

9.15

12.19

Aug

8.33

5.15

10.17

6.33

10.81

7.77

11.55

10.51

12.83

Sept

8.33

7.27

12.03

8.89

12.91

10.81

13.87

14.43

15.61

Oct

8.33

8.11

12.93

9.65

13.73

11.41

14.61

14.61

16.13

Nov

8.33

8.63

12.71

10.11

13.29

11.83

13.91

14.87

14.97

Dec

8.33

9.63

13.39

11.31

14.05

13.23

14.77

16.66

15.97

Year

100.0

11.09

14.57

12.83

15.51

14.93

16.61

18.86

18.59

Directional Joint Distribution Hs-Tp Return Values Table

tables.table_directional_joint_distribution_Hs_Tp_return_values(
    df,
    var_hs='HS',
    var_tp='TP',
    var_dir='DIRM',
    periods=[1,10,100,1000],
    adjustment='NORSOK',
    model='lonowe' # change to 'hs_tp' for DNV model
    output_file='directional_Hs_Tp_joint_return_values.csv'
)

Direction

Sector prob.[%]

Hs[m] [1 years]

Tp[s] [1 years]

Hs[m] [10 years]

Tp[s] [10 years]

Hs[m] [100 years]

Tp[s] [100 years]

Hs[m] [1000 years]

Tp[s] [1000 years]

19.45

9.13

14.57

11.17

15.49

13.15

16.59

15.1

17.61

30°

0.81

3.57

11.87

4.57

13.43

5.49

14.81

6.35

16.09

60°

0.29

3.39

10.75

4.55

11.37

5.61

10.55

6.59

7.95

90°

0.26

3.35

11.11

4.43

12.79

5.37

14.19

6.23

15.43

120°

0.48

4.21

10.75

5.53

11.95

6.73

12.97

7.87

13.91

150°

6.82

10.59

13.41

12.57

14.43

14.37

15.31

16.04

16.13

180°

14.82

10.09

13.13

11.87

14.15

13.53

15.09

15.1

15.93

210°

10.18

9.31

13.13

11.01

14.15

12.59

15.07

14.05

15.93

240°

10.11

9.75

13.09

11.61

13.93

13.35

14.67

14.99

15.35

270°

11.55

10.69

13.87

12.83

14.75

14.93

15.53

16.94

16.23

300°

9.87

10.47

14.57

12.83

15.49

14.93

16.59

16.94

17.61

330°

15.36

11.09

14.57

12.83

15.49

14.93

16.59

16.94

17.61

Omni

100.0

11.09

14.57

12.83

15.49

14.93

16.59

16.94

17.61

Hs-Tp Return Values Table

tables.table_Hs_Tpl_Tph_return_values(
    df,
    var_hs='HS',
    var_tp='TP',
    periods=[1,10,100,10000],
    output_file='hs_tpl_tph_return_values.csv'
)

HS [1 years]

TpL [1 years]

TpH [1 years]

HS [10 years]

TpL [10 years]

TpH [10 years]

HS [100 years]

TpL [100 years]

TpH [100 years]

HS [10000 years]

TpL [10000 years]

TpH [10000 years]

11.1

14.1

14.6

12.8

14.8

15.7

14.9

15.9

16.8

18.9

18.0

18.6

10.1

12.1

15.7

11.8

13.0

16.6

13.9

14.0

17.8

17.9

15.9

19.9

9.1

10.9

16.0

10.8

11.8

16.9

12.9

12.9

18.1

16.9

14.8

20.3

8.1

9.8

16.3

9.8

10.8

17.1

11.9

11.9

18.2

15.9

13.8

20.4

7.1

8.7

16.6

8.8

9.8

17.3

10.9

11.0

18.3

14.9

13.0

20.5

6.1

7.6

17.0

7.8

8.8

17.6

9.9

10.1

18.4

13.9

12.2

20.5

5.1

6.5

17.3

6.8

7.8

17.9

8.9

9.2

18.6

12.9

11.4

20.5

4.1

5.5

17.9

5.8

6.7

18.4

7.9

8.3

18.9

11.9

10.6

20.5

3.1

4.4

18.8

4.8

5.7

19.0

6.9

7.3

19.4

10.9

9.9

20.5

2.1

3.3

19.9

3.8

4.7

19.9

5.9

6.3

20.0

9.9

9.1

20.6

Tp for Given Hs Plot

plots.plot_tp_for_given_hs(
    df,
    var_hs='HS',
    var_tp='TP',
    output_file='tp_for_given_hs.png'
)
_images/tp_for_given_hs.png

Tp for Given Hs Table

tables.table_tp_for_given_hs(
    df,
    var_hs='HS',
    var_tp='TP',
    max_hs=20,
    output_file='tp_for_given_hs.csv'
)

Hs[m]

Tp(P5-model) [s]

Tp(Mean-model) [s]

Tp(P95-model) [s]

1.0

3.91

7.77

11.62

2.0

5.06

8.8

12.53

3.0

6.1

9.61

13.12

4.0

7.07

10.32

13.58

5.0

7.96

10.98

14.0

6.0

8.8

11.6

14.4

7.0

9.58

12.19

14.8

8.0

10.31

12.76

15.22

9.0

11.0

13.32

15.64

10.0

11.64

13.86

16.09

11.0

12.24

14.39

16.55

12.0

12.81

14.92

17.02

13.0

13.35

15.43

17.51

14.0

13.87

15.94

18.01

15.0

14.36

16.44

18.52

16.0

14.84

16.94

19.03

17.0

15.3

17.43

19.55

18.0

15.76

17.91

20.07

19.0

16.2

18.4

20.59

20.0

16.64

18.87

21.11

Tp for RV Hs Table

tables.table_tp_for_rv_hs(
    df,
    var_hs='HS',
    var_tp='TP',
    periods=[1,10,100,10000],
    output_file='tp_for_rv_hs.csv'
)

Return period [years]

Hs[m]

Tp(P5-model) [s]

Tp(Mean-model) [s]

Tp(P95-model) [s]

1

11.09

12.27

14.47

16.66

10

12.83

13.25

15.37

17.49

100

14.93

14.33

16.44

18.54

10000

18.86

16.16

18.37

20.57

Wave-Induced Current (JONSWAP) Table

tables.table_wave_induced_current(
    df,
    var_hs='HS',
    var_tp='TP',
    depth=200,
    ref_depth=200,
    spectrum='JONSWAP',
    output_file='JONSWAP_wave_induced_current_depth200.csv'
)

Hs[m]

Tp(P5-model) [s]

Us(P5) [m/s]

Tu(P5-model) [s]

Tp(Mean-model) [s]

Us(Mean) [m/s]

Tu(Mean-model) [s]

Tp(P95-model) [s]

Us(P95) [m/s]

Tu(P95-model) [s]

1.0

3.91

0.0

7.3

7.76

0.0

11.51

11.6

0.0

14.55

2.0

5.03

0.0

8.62

8.8

0.0

12.48

12.58

0.01

15.11

3.0

6.04

0.0

9.74

9.62

0.0

13.27

13.21

0.02

15.59

4.0

6.98

0.0

10.72

10.35

0.01

13.93

13.72

0.03

15.82

5.0

7.86

0.0

11.6

11.01

0.01

14.53

14.16

0.05

16.06

6.0

8.69

0.0

12.37

11.63

0.02

15.03

14.58

0.07

16.77

7.0

9.47

0.0

13.04

12.23

0.04

15.46

14.99

0.1

17.56

8.0

10.21

0.01

13.59

12.81

0.05

15.88

15.41

0.12

18.02

9.0

10.9

0.02

14.08

13.37

0.07

16.28

15.84

0.15

18.38

10.0

11.56

0.03

14.54

13.92

0.1

16.65

16.28

0.19

18.71

11.0

12.17

0.05

14.86

14.45

0.13

17.05

16.73

0.23

19.04

12.0

12.76

0.07

15.31

14.98

0.16

17.45

17.2

0.27

19.39

13.0

13.32

0.1

15.7

15.5

0.2

17.78

17.68

0.32

19.76

14.0

13.85

0.13

15.95

16.01

0.25

18.05

18.17

0.37

20.16

15.0

14.37

0.16

16.32

16.52

0.3

18.34

18.67

0.43

20.54

16.0

14.86

0.2

16.82

17.02

0.35

18.73

19.18

0.49

20.9

17.0

15.34

0.25

17.25

17.52

0.4

19.21

19.69

0.56

21.24

18.0

15.81

0.31

17.5

18.01

0.46

19.71

20.21

0.63

21.56

19.0

16.26

0.37

17.66

18.5

0.54

20.15

20.73

0.7

21.88

20.0

16.71

0.43

17.9

18.98

0.63

20.49

21.26

0.77

22.23

Wave-Induced Current (TORSEHAUGEN) Table

tables.table_wave_induced_current(
    df,
    var_hs='HS',
    var_tp='TP',
    depth=200,
    ref_depth=200,
    spectrum='TORSEHAUGEN',
    output_file='TORSEHAUGEN_wave_induced_current_depth200.csv'
)

Hs[m]

Tp(P5-model) [s]

Us(P5) [m/s]

Tu(P5-model) [s]

Tp(Mean-model) [s]

Us(Mean) [m/s]

Tu(Mean-model) [s]

Tp(P95-model) [s]

Us(P95) [m/s]

Tu(P95-model) [s]

1.0

3.92

0.0

12.7

7.76

0.0

11.87

11.61

0.0

15.19

2.0

5.01

0.0

14.29

8.81

0.0

12.89

12.6

0.01

15.83

3.0

6.0

0.01

15.34

9.63

0.0

13.64

13.25

0.02

16.25

4.0

6.92

0.02

16.13

10.35

0.01

14.31

13.77

0.03

16.49

5.0

7.79

0.03

16.82

11.01

0.02

14.9

14.22

0.05

16.74

6.0

8.61

0.04

17.37

11.63

0.03

15.39

14.64

0.06

17.07

7.0

9.39

0.05

17.78

12.22

0.04

15.82

15.05

0.08

17.4

8.0

10.12

0.06

18.07

12.79

0.06

16.25

15.47

0.11

17.66

9.0

10.81

0.08

18.27

13.35

0.08

16.63

15.89

0.14

17.82

10.0

11.46

0.09

18.36

13.89

0.1

16.98

16.32

0.17

17.95

11.0

12.08

0.11

18.36

14.42

0.13

17.35

16.76

0.2

18.17

12.0

12.67

0.13

18.35

14.95

0.16

17.72

17.22

0.23

18.53

13.0

13.23

0.15

18.31

15.46

0.2

18.05

17.69

0.26

19.02

14.0

13.77

0.18

18.25

15.97

0.25

18.31

18.17

0.3

19.53

15.0

14.29

0.21

18.27

16.47

0.3

18.53

18.66

0.35

19.89

16.0

14.78

0.24

18.38

16.97

0.34

18.83

19.16

0.43

20.07

17.0

15.26

0.28

18.49

17.46

0.39

19.23

19.66

0.5

20.15

18.0

15.73

0.32

18.58

17.95

0.44

19.7

20.17

0.55

20.22

19.0

16.19

0.37

18.67

18.43

0.5

20.11

20.68

0.56

20.33

20.0

16.63

0.42

18.86

18.91

0.58

20.34

21.19

0.57

20.54

Hs for Given Wind Table

tables.table_hs_for_given_wind(
    df,
    var_hs='HS',
    var_wind='W10',
    bin_width=2,
    max_wind=42,
    output_file='table_perc_hs_for_wind.csv'
)

U[m/s]

Hs(P5-model) [m]

Hs(Mean-model) [m]

Hs(P95-model) [m]

1.0

0.1

1.14

2.18

3.0

0.17

1.23

2.29

5.0

0.33

1.43

2.54

7.0

0.58

1.75

2.93

9.0

0.92

2.19

3.46

11.0

1.36

2.74

4.12

13.0

1.88

3.39

4.89

15.0

2.49

4.13

5.76

17.0

3.18

4.96

6.73

19.0

3.95

5.86

7.77

21.0

4.77

6.82

8.88

23.0

5.66

7.84

10.03

25.0

6.59

8.91

11.23

27.0

7.57

10.01

12.45

29.0

8.58

11.13

13.69

31.0

9.61

12.28

14.94

33.0

10.67

13.43

16.19

35.0

11.74

14.58

17.42

37.0

12.82

15.73

18.64

39.0

13.89

16.86

19.84

41.0

14.96

17.98

21.0

Hs for Given Wind Plot

plots.plot_hs_for_given_wind(
    df,
    var_hs='HS',
    var_wind='W10',
    output_file='hs_for_given_wind.png'
)
_images/hs_for_given_wind.png

Hs for RV Wind Table

tables.table_hs_for_rv_wind(
    df,
    var_wind='W10',
    var_hs='HS',
    periods=[1,10,100,10000],
    output_file='hs_for_rv_wind.csv'
)

Return period [years]

U[m/s]

Hs(P5-model) [m]

Hs(Mean-model) [m]

Hs(P95-model) [m]

1

26.43

7.28

9.69

12.1

10

29.74

8.96

11.56

14.16

100

32.67

10.5

13.24

15.98

10000

37.75

13.22

16.16

19.09

Hmax Return Values Table

tables.table_Hmax_crest_return_periods(
    df,
    var_hs='HS',
    var_tp='TP',
    depth=200,
    periods=[1, 10, 100, 10000],
    sea_state='long-crested'
)

Directional Hmax Return Values Table

tables.table_directional_Hmax_return_periods(
    df,
    var_hs='HS',
    var_tp='TP',
    var_dir='DIRM',
    periods=[10, 100, 10000],
    adjustment='NORSOK',
    output_file='table_dir_Hmax_return_values.csv'
)

Direction

Hmax[m] [10 years]

Hmax[m] [100 years]

Hmax[m] [10000 years]

T_Hmax(P5-model) [s] [10 years]

T_Hmax(Mean-model) [s] [10 years]

T_Hmax(P95-model) [s] [10 years]

T_Hmax(P5-model) [s] [100 years]

T_Hmax(Mean-model) [s] [100 years]

T_Hmax(P95-model) [s] [100 years]

T_Hmax(P5-model) [s] [10000 years]

T_Hmax(Mean-model) [s] [10000 years]

T_Hmax(P95-model) [s] [10000 years]

21.51

25.21

32.31

10.81

13.02

15.22

11.84

13.92

16.01

13.6

15.62

17.64

30°

8.88

10.6

13.71

6.57

9.65

12.74

7.25

10.18

13.1

8.41

11.07

13.72

60°

8.92

11.03

15.36

6.55

9.64

12.73

7.34

10.24

13.15

8.64

11.24

13.85

90°

8.63

10.39

13.46

6.46

9.57

12.68

7.16

10.11

13.06

8.32

11.0

13.67

120°

10.84

13.12

17.27

7.28

10.2

13.12

8.12

10.84

13.56

9.53

11.95

14.37

150°

24.3

27.67

33.71

11.55

13.66

15.77

12.43

14.47

16.52

13.87

15.9

17.92

180°

22.98

26.08

31.73

11.19

13.34

15.49

12.02

14.1

16.17

13.42

15.44

17.47

210°

21.32

24.28

29.57

10.72

12.94

15.16

11.56

13.67

15.78

12.92

14.95

16.97

240°

22.5

25.78

31.76

11.05

13.22

15.39

11.94

14.01

16.09

13.41

15.43

17.45

270°

24.78

28.74

36.09

11.68

13.78

15.88

12.69

14.72

16.75

14.38

16.43

18.47

300°

24.71

28.62

35.89

11.68

13.78

15.88

12.69

14.72

16.75

14.38

16.43

18.47

330°

24.71

28.62

35.89

11.68

13.78

15.88

12.69

14.72

16.75

14.38

16.43

18.47

Omni

24.71

28.62

35.89

11.68

13.78

15.88

12.69

14.72

16.75

14.38

16.43

18.47

T2m Monthly Return Periods Plot (Negative)

plots.plot_monthly_return_periods(
    df,
    var='T2m',
    periods=[1, 10, 100],
    distribution='GUM_L',
    method='minimum',
    units='°C',
    output_file='T2m_monthly_extremes_neg.png'
)
_images/T2m_monthly_extremes_neg.png

T2m Monthly Return Periods Table (Negative)

tables.table_monthly_return_periods(
    df,
    var='T2m',
    periods=[1, 10, 100],
    distribution='GUM_L',
    method='minimum',
    units='°C',
    output_file='T2m_monthly_extremes_neg.csv'
)

Month

Annual prob.

Shape

Scale

Location

Return period: 1 [years]

Return period: 10 [years]

Return period: 100 [years]

0

%

°C

°C

°C

°C

°C

1

Jan

8.33

1.868

1.71

4.38

-2.53

-6.91

2

Feb

8.33

1.682

1.26

3.67

-2.55

-6.5

3

Mar

8.33

1.549

1.87

4.08

-1.64

-5.28

4

Apr

8.33

1.21

3.04

4.77

0.3

-2.55

5

May

8.33

1.05

5.32

6.82

2.94

0.47

6

Jun

8.33

0.984

8.37

9.78

6.14

3.83

7

Jul

8.33

0.775

10.67

11.77

8.91

7.09

8

Aug

8.33

1.036

11.63

13.12

9.29

6.85

9

Sept

8.33

1.33

9.64

11.54

6.63

3.5

10

Oct

8.33

1.379

6.78

8.75

3.66

0.42

11

Nov

8.33

1.473

4.2

6.3

0.86

-2.6

12

Dec

8.33

1.843

2.46

5.1

-1.72

-6.05

13

Year

100.0

1.775

-0.12

2.42

-4.14

-8.31

T2m Monthly Return Periods Plot (Positive)

plots.plot_monthly_return_periods(
    df,
    var='T2m',
    periods=[1, 10, 100],
    distribution='GUM',
    method='maximum',
    units='°C',
    output_file='T2m_monthly_extremes_pos.png'
)
_images/T2m_monthly_extremes_pos.png

T2m Monthly Return Periods Table (Positive)

tables.table_monthly_return_periods(
    df,
    var='T2m',
    periods=[1, 10, 100],
    distribution='GUM',
    method='maximum',
    units='°C',
    output_file='T2m_monthly_extremes_pos.csv'
)

Month

Annual prob.

Shape

Scale

Location

Return period: 1 [years]

Return period: 10 [years]

Return period: 100 [years]

0

%

°C

°C

°C

°C

°C

1

Jan

8.33

0.772

8.25

7.15

10.0

11.82

2

Feb

8.33

1.132

7.5

5.88

10.06

12.72

3

Mar

8.33

0.796

7.47

6.33

9.28

11.15

4

Apr

8.33

0.816

8.14

6.98

9.99

11.91

5

May

8.33

0.903

10.59

9.3

12.64

14.76

6

Jun

8.33

1.039

12.8

11.31

15.15

17.59

7

Jul

8.33

1.326

14.95

13.05

17.96

21.07

8

Aug

8.33

1.383

15.5

13.52

18.64

21.89

9

Sept

8.33

1.195

14.15

12.44

16.86

19.67

10

Oct

8.33

0.781

12.28

11.16

14.05

15.88

11

Nov

8.33

0.77

10.35

9.25

12.09

13.9

12

Dec

8.33

0.827

9.15

7.97

11.03

12.97

13

Year

100.0

1.44

15.78

13.72

19.05

22.43

T2m Monthly Statistics Plot

plots.plot_monthly_stats(
    df,
    var='T2m',
    show=['Minimum','Mean','Maximum'],
    title='T2m',
    output_file='T2m_monthly_stats.png'
)
_images/T2m_monthly_stats.png

T2m Monthly Non-Exceedance Table

tables.table_monthly_non_exceedance(
    df,
    var='T2m',
    step_var=0.5,
    output_file='T2m_table_monthly_non_exceedance.csv'
)

Current Speed Monthly Return Periods Plot

plots.plot_monthly_return_periods(
    df,
    var='current_speed_0m',
    periods=[1, 10, 100],
    distribution='Weibull3P_MOM',
    method='POT',
    threshold='P99',
    units='m/s',
    output_file='csp0m_monthly_extremes.png'
)
_images/csp0m_monthly_extremes.png

Current Speed Monthly Rose Plot

plots.var_rose(
    df,
    'current_direction_0m',
    'current_speed_0m',
    max_perc=30,
    decimal_places=2,
    units='m/s',
    method='monthly',
    output_file='monthly_rose.png'
)
_images/monthly_rose.png

Current Speed Overall Rose Plot

plots.var_rose(
    df,
    'current_direction_0m',
    'current_speed_0m',
    max_perc=30,
    decimal_places=2,
    units='m/s',
    method='overall',
    output_file='overall_rose.png'
)
_images/overall_rose.png

Current Speed Monthly Statistics Plot

plots.plot_monthly_stats(
    df,
    var='current_speed_0m',
    show=['Mean', 'P99', 'Maximum'],
    title='Current[m/s], depth:0m',
    output_file='current_0m_monthly_stats.png'
)
_images/current_0m_monthly_stats.png

Hs Monthly Statistics with shaded band

plots.plot_monthly_stats(
   ds,
   var="HS",
   show=["10%", "mean", "90%"],
   fill_between=["25%", "75%"],
   fill_color_like="mean",
   output_file="")
_images/monthly_stats_wave_height_fill.png

Hs Daily Statistics with shaded band

plots.plot_daily_stats(
   ds,
   var="HS",
   show=["5%", "mean", "95%"],
   fill_between=["25%", "75%"],
   fill_color_like="mean")
_images/plot_daily_stats_wave_height_fill.png

Hs Hourly Statistics with shaded band

plots.plot_hourly_stats(
   ds,
   var="HS",
   show=["5%", "mean", "95%"],
   fill_between=["25%", "75%"],
   fill_color_like="mean",
   title="HS[m]")
_images/plot_hourly_stats_wave_height_fill.png

Hs Daily percentile table

tables.table_daily_percentile(
   ds,
   var="HS",
   percentiles=["5%", "10%", "15%", "20%","mean", "99%", "max"],
   divide_months=True)

Current Speed Directional Monthly Statistics

tables.monthly_directional_percentiles(
     data=ds,
     var="W10",
     var_dir="D10",
     percentiles=["5%", "25%", "mean", "75%", "99%", "max"],
     nsectors=16,
     compass_point_names=True)

Current Speed Directional Statistics Plot

plots.plot_directional_stats(
    df,
    var='current_speed_0m',
    var_dir='current_direction_0m',
    step_var=0.05,
    show=['Mean', 'P99', 'Maximum'],
    title='Current[m/s], depth:0m',
    output_file='current_0m_dir_stats.png'
)
_images/current_0m_dir_stats.png

Current Speed Directional Return Periods Table

tables.table_directional_return_periods(
    df,
    var='current_speed_0m',
    periods=[1, 10, 100, 10000],
    units='m/s',
    var_dir='current_direction_0m',
    distribution='Weibull3P_MOM',
    adjustment='NORSOK',
    output_file='directional_extremes_weibull_current_0m.csv'
)

Direction sector

Sector prob.

Shape

Scale

Location

Return period: 1 [years]

Return period: 10 [years]

Return period: 100 [years]

Return period: 10000 [years]

0

%

m/s

m/s

m/s

m/s

m/s

m/s

1

19.33

2.103

0.235

-0.0

0.63

0.73

0.81

0.96

2

30°

9.99

1.958

0.176

0.01

0.63

0.73

0.81

0.93

3

60°

5.0

1.667

0.141

0.01

0.63

0.73

0.81

0.96

4

90°

3.29

1.268

0.121

0.02

0.63

0.73

0.81

0.96

5

120°

2.22

1.375

0.129

0.0

0.63

0.73

0.81

0.96

6

150°

2.21

1.37

0.112

0.01

0.63

0.73

0.81

0.96

7

180°

2.91

1.501

0.151

0.0

0.63

0.73

0.81

0.96

8

210°

4.69

1.376

0.164

0.01

0.63

0.73

0.81

0.96

9

240°

6.58

1.485

0.159

0.01

0.63

0.73

0.81

0.96

10

270°

9.44

1.632

0.145

0.03

0.63

0.73

0.81

0.96

11

300°

14.14

1.821

0.179

0.02

0.63

0.73

0.81

0.96

12

330°

20.2

2.073

0.224

0.0

0.63

0.73

0.81

0.96

13

Omni

100.0

1.775

0.189

0.01

0.63

0.73

0.81

0.96

Current Speed Monthly Return Periods Table

tables.table_monthly_return_periods(
    df,
    var='current_speed_0m',
    periods=[1, 10, 100, 10000],
    units='m/s',
    distribution='Weibull3P_MOM',
    method='POT',
    threshold='P99',
    output_file='monthly_extremes_weibull_current_0m.csv'
)

Month

Annual prob.

Shape

Scale

Location

Threshold

Events

Return period: 1 [years]

Return period: 10 [years]

Return period: 100 [years]

Return period: 10000 [years]

0

%

m/s

m/s

m/s

1/year

m/s

m/s

m/s

m/s

1

Jan

8.33

2.449

0.097

0.47

0.5

11.1

0.68

0.71

0.73

0.77

2

Feb

8.33

3.602

0.072

0.43

0.45

7.5

0.55

0.56

0.57

0.58

3

Mar

8.33

1.892

0.106

0.46

0.51

9.2

0.74

0.79

0.83

0.9

4

Apr

8.33

3.602

0.09

0.35

0.39

9.3

0.51

0.52

0.53

0.55

5

May

8.33

3.602

0.018

0.36

0.35

7.4

0.39

0.39

0.39

0.4

6

Jun

8.33

0.674

0.0

0.41

0.35

8.3

0.41

0.41

0.41

0.41

7

Jul

8.33

3.602

0.036

0.33

0.31

10.2

0.39

0.39

0.4

0.41

8

Aug

8.33

0.674

0.0

0.59

0.48

7.4

0.59

0.59

0.59

0.59

9

Sept

8.33

0.674

0.0

0.52

0.44

8.3

0.52

0.52

0.52

0.52

10

Oct

8.33

3.602

0.18

0.33

0.43

9.2

0.63

0.66

0.68

0.71

11

Nov

8.33

1.969

0.066

0.41

0.43

7.4

0.58

0.61

0.63

0.67

12

Dec

8.33

3.602

0.018

0.38

0.38

10.2

0.41

0.41

0.41

0.42

13

Year

100.0

1.751

0.087

0.45

0.45

45.7

0.74

0.79

0.83

0.9

Current Speed Profile Return Values Plot

plots.plot_profile_return_values(
    df,
    var=['current_speed_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    periods=[1, 10, 100, 10000],
    reverse_yaxis=True,
    output_file='RVE_current_profile.png'
)
_images/RVE_current_profile.png

Current Speed for Given Wind Table

tables.table_current_for_given_wind(
    ds_all,
    var_curr='current_speed_0m',
    var_wind='W10',
    bin_width=2,
    max_wind=42,
    output_file='table_perc_current_for_wind.csv'
)

U[m/s]

Uc(P5-model) [m/s]

Uc(Mean-model) [m/s]

Uc(P95-model) [m/s]

1.0

0.02

0.06

0.1

3.0

0.11

0.15

0.2

5.0

0.2

0.25

0.3

7.0

0.3

0.35

0.39

9.0

0.4

0.45

0.49

11.0

0.5

0.54

0.59

13.0

0.6

0.64

0.69

15.0

0.7

0.74

0.79

17.0

0.8

0.84

0.89

19.0

0.89

0.94

0.99

21.0

0.99

1.04

1.09

23.0

1.09

1.14

1.19

25.0

1.19

1.24

1.28

27.0

1.29

1.33

1.38

29.0

1.38

1.43

1.48

31.0

1.48

1.53

1.57

33.0

1.57

1.62

1.67

35.0

1.67

1.72

1.76

37.0

1.76

1.81

1.86

39.0

1.86

1.9

1.95

41.0

1.95

2.0

2.04

Current Speed for Given Wind Plot

plots.plot_current_for_given_wind(
    ds_all,
    var_curr='current_speed_0m',
    var_wind='W10',
    output_file='curr_for_given_wind.png'
)
_images/curr_for_given_wind.png

Current Speed for Given Hs Table

tables.table_current_for_given_hs(
    ds_all,
    var_curr='current_speed_0m',
    var_hs='HS',
    bin_width=2,
    max_hs=20,
    output_file='table_perc_current_for_Hs.csv'
)

Hs[m]

Uc(P5-model) [m/s]

Uc(Mean-model) [m/s]

Uc(P95-model) [m/s]

1.0

0.02

0.27

0.52

3.0

0.31

0.53

0.76

5.0

0.51

0.73

0.94

7.0

0.68

0.89

1.1

9.0

0.82

1.03

1.24

11.0

0.95

1.16

1.36

13.0

1.08

1.28

1.48

15.0

1.19

1.39

1.59

17.0

1.3

1.49

1.69

19.0

1.4

1.59

1.79

Current Speed for Given Wind Table

tables.table_current_for_given_wind(
    df,
    var_curr='current_speed_0m',
    var_wind='W10',
    bin_width=2,
    max_wind=42,
    output_file='table_perc_current_for_wind.csv'
)

U[m/s]

Uc(P5-model) [m/s]

Uc(Mean-model) [m/s]

Uc(P95-model) [m/s]

1.0

0.02

0.06

0.1

3.0

0.11

0.15

0.2

5.0

0.2

0.25

0.3

7.0

0.3

0.35

0.39

9.0

0.4

0.45

0.49

11.0

0.5

0.54

0.59

13.0

0.6

0.64

0.69

15.0

0.7

0.74

0.79

17.0

0.8

0.84

0.89

19.0

0.89

0.94

0.99

21.0

0.99

1.04

1.09

23.0

1.09

1.14

1.19

25.0

1.19

1.24

1.28

27.0

1.29

1.33

1.38

29.0

1.38

1.43

1.48

31.0

1.48

1.53

1.57

33.0

1.57

1.62

1.67

35.0

1.67

1.72

1.76

37.0

1.76

1.81

1.86

39.0

1.86

1.9

1.95

41.0

1.95

2.0

2.04

Current Speed for Given Hs Table

tables.table_current_for_given_hs(
    df,
    var_curr='current_speed_0m',
    var_hs='HS',
    bin_width=2,
    max_hs=20,
    output_file='table_perc_current_for_Hs.csv'
)

Hs[m]

Uc(P5-model) [m/s]

Uc(Mean-model) [m/s]

Uc(P95-model) [m/s]

1.0

0.02

0.27

0.52

3.0

0.31

0.53

0.76

5.0

0.51

0.73

0.94

7.0

0.68

0.89

1.1

9.0

0.82

1.03

1.24

11.0

0.95

1.16

1.36

13.0

1.08

1.28

1.48

15.0

1.19

1.39

1.59

17.0

1.3

1.49

1.69

19.0

1.4

1.59

1.79

Current Speed for Given Hs Plot

plots.plot_current_for_given_hs(
    ds_all,
    var_curr='current_speed_0m',
    var_hs='HS',
    max_hs=20,
    output_file='curr_for_given_hs.png'
)
_images/curr_for_given_hs.png

Extreme Current Profile Return Values Table

tables.table_extreme_current_profile_rv(
    df,
    var=['current_speed_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    periods=[1, 100, 1000],
    percentile=95,
    output_file='table_extreme_current_profile_rv.png'
)
_images/table_extreme_current_profile_rvperiod_1.png _images/table_extreme_current_profile_rvperiod_100.png _images/table_extreme_current_profile_rvperiod_1000.png

Profile Statistics Table

tables.table_profile_stats(
    df,
    var=['current_speed_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    var_dir=['current_direction_' + d for d in depth],
    output_file='table_profile_stats.csv'
)

z

Mean

Std.dev

P5

P10

P50

P90

P95

P99

Max

Dir. Max Event

Time Max Event

[m]

[m/s]

[m/s]

[m/s]

[m/s]

[m/s]

[m/s]

[m/s]

[m/s]

[m/s]

[°]

YYYY-MM-DD hh:mm:ss

0.0

0.17

0.1

0.04

0.06

0.16

0.31

0.36

0.45

0.63

328.43

2018-03-24 12:00:00

1.0

0.17

0.1

0.04

0.06

0.16

0.31

0.36

0.45

0.63

328.43

2018-03-24 12:00:00

2.5

0.17

0.1

0.04

0.06

0.16

0.31

0.36

0.45

0.63

328.58

2018-03-24 12:00:00

5.0

0.17

0.1

0.04

0.06

0.16

0.31

0.36

0.45

0.62

329.07

2018-03-24 12:00:00

10.0

0.17

0.1

0.04

0.06

0.16

0.3

0.35

0.44

0.62

329.71

2018-03-24 12:00:00

15.0

0.17

0.09

0.04

0.06

0.15

0.3

0.35

0.44

0.61

330.17

2018-03-24 12:00:00

20.0

0.17

0.09

0.04

0.06

0.15

0.3

0.35

0.44

0.61

330.65

2018-03-24 12:00:00

25.0

0.17

0.09

0.04

0.06

0.15

0.29

0.34

0.43

0.6

331.02

2018-03-24 12:00:00

30.0

0.16

0.09

0.04

0.06

0.15

0.29

0.34

0.43

0.6

331.48

2018-03-24 12:00:00

40.0

0.16

0.09

0.04

0.05

0.14

0.28

0.33

0.43

0.58

332.67

2018-03-24 12:00:00

50.0

0.15

0.09

0.04

0.05

0.14

0.27

0.32

0.41

0.55

333.73

2018-03-24 12:00:00

75.0

0.14

0.08

0.03

0.05

0.12

0.25

0.3

0.39

0.53

14.3

2017-08-12 08:00:00

100.0

0.13

0.08

0.03

0.04

0.11

0.24

0.29

0.37

0.53

13.79

2017-08-12 08:00:00

150.0

0.13

0.08

0.03

0.04

0.11

0.23

0.28

0.35

0.5

13.88

2017-08-12 08:00:00

200.0

0.12

0.07

0.03

0.04

0.11

0.22

0.26

0.33

0.46

13.45

2017-08-12 08:00:00

Profile Statistics Plot

plots.plot_profile_stats(
    df,
    var=['current_speed_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    reverse_yaxis=True,
    output_file='stats_current_profile.png'
)
_images/stats_current_profile.png

Current Speed for RV Wind Table

tables.table_current_for_rv_wind(
    ds_all,
    var_curr='current_speed_0m',
    var_wind='W10',
    periods=[1, 10, 100, 10000],
    output_file='Uc_for_rv_wind.csv'
)

Return period [years]

U[m/s]

Uc(P5-model) [m/s]

Uc(Mean-model) [m/s]

Uc(P95-model) [m/s]

1

27.55

0.0

0.27

0.62

10

31.23

0.0

0.32

1.0

100

34.51

0.0

0.39

1.85

10000

40.27

0.0

0.57

7.56

Current Speed for RV Hs Table

tables.table_current_for_rv_hs(
    ds_all,
    var_curr='current_speed_0m',
    var_hs='HS',
    periods=[1, 10, 100, 10000],
    output_file='Uc_for_rv_hs.csv'
)

Return period [years]

Hs[m]

Uc(P5-model) [m/s]

Uc(Mean-model) [m/s]

Uc(P95-model) [m/s]

1

11.55

0.02

0.23

0.45

10

14.19

0.02

0.25

0.48

100

16.75

0.01

0.26

0.51

10000

21.68

0.0

0.28

0.56

Sea Temperature Profile Monthly Stats Table (Mean)

tables.table_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='mean',
    output_file='table_mean_temp_profile_monthly_stats.png'
)
_images/table_mean_temp_profile_monthly_stats.png

Sea Temperature Profile Monthly Stats Table (Standard Deviation)

tables.table_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='std.dev',
    output_file='table_std_temp_profile_monthly_stats.png'
)
_images/table_std_temp_profile_monthly_stats.png

Sea Temperature Profile Monthly Stats Table (Minimum)

tables.table_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='minimum',
    output_file='table_min_temp_profile_monthly_stats.png'
)
_images/table_min_temp_profile_monthly_stats.png

Sea Temperature Profile Monthly Stats Table (Maximum)

tables.table_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='maximum',
    output_file='table_max_temp_profile_monthly_stats.png'
)
_images/table_max_temp_profile_monthly_stats.png

Mean Sea Temperature Profile Monthly Stats Plot

plots.plot_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='mean',
    title='Mean Sea Temperature [°C]',
    output_file='plot_mean_temp_profile_monthly_stats.png'
)
_images/plot_mean_temp_profile_monthly_stats.png

Sea Temperature Profile Monthly Stats Plot (Minimum)

plots.plot_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='minimum',
    title='Min. Sea Temperature [°C]',
    output_file='plot_min_temp_profile_monthly_stats.png'
)
_images/plot_min_temp_profile_monthly_stats.png

Sea Temperature Profile Monthly Stats Plot (Maximum)

plots.plot_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='maximum',
    title='Max. Sea Temperature [°C]',
    output_file='plot_max_temp_profile_monthly_stats.png'
)
_images/plot_max_temp_profile_monthly_stats.png

Mean Sea Temperature Profile Monthly Stats Plot

plots.plot_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='mean',
    title='Mean Sea Temperature [°C]',
    output_file='plot_mean_temp_profile_monthly_stats.png'
)
_images/plot_mean_temp_profile_monthly_stats.png

Min. Sea Temperature Profile Monthly Stats Plot

plots.plot_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='minimum',
    title='Min. Sea Temperature [°C]',
    output_file='plot_min_temp_profile_monthly_stats.png'
)
_images/plot_min_temp_profile_monthly_stats.png

Max. Sea Temperature Profile Monthly Stats Plot

plots.plot_profile_monthly_stats(
    df,
    var=['temp_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='maximum',
    title='Max. Sea Temperature [°C]',
    output_file='plot_max_temp_profile_monthly_stats.png'
)
_images/plot_max_temp_profile_monthly_stats.png

Mean Salinity Profile Monthly Stats Table

tables.table_profile_monthly_stats(
    df,
    var=['salt_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='mean',
    output_file='table_mean_sal_profile_monthly_stats.png'
)
_images/table_mean_sal_profile_monthly_stats.png

Standard Deviation Salinity Profile Monthly Stats Table

tables.table_profile_monthly_stats(
    df,
    var=['salt_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='std.dev',
    output_file='table_std_sal_profile_monthly_stats.png'
)
_images/table_std_sal_profile_monthly_stats.png

Min. Salinity Profile Monthly Stats Table

tables.table_profile_monthly_stats(
    df,
    var=['salt_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='minimum',
    output_file='table_min_sal_profile_monthly_stats.png'
)
_images/table_min_sal_profile_monthly_stats.png

Max. Salinity Profile Monthly Stats Table

tables.table_profile_monthly_stats(
    df,
    var=['salt_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='maximum',
    output_file='table_max_sal_profile_monthly_stats.png'
)
_images/table_max_sal_profile_monthly_stats.png

Mean Salinity Profile Monthly Stats Plot

plots.plot_profile_monthly_stats(
    df,
    var=['salt_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='mean',
    title='Mean Salinity [PSU]',
    output_file='plot_mean_sal_profile_monthly_stats.png'
)
_images/plot_mean_sal_profile_monthly_stats.png

Standard Deviation Salinity Profile Monthly Stats Plot

plots.plot_profile_monthly_stats(
    df,
    var=['salt_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='std.dev',
    title='St.Dev Salinity [PSU]',
    output_file='plot_std_sal_profile_monthly_stats.png'
)
_images/plot_std_sal_profile_monthly_stats.png

Min. Salinity Profile Monthly Stats Plot

plots.plot_profile_monthly_stats(
    df,
    var=['salt_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='minimum',
    title='Min. Salinity [PSU]',
    output_file='plot_min_sal_profile_monthly_stats.png'
)
_images/plot_min_sal_profile_monthly_stats.png

Max. Salinity Profile Monthly Stats Plot

plots.plot_profile_monthly_stats(
    df,
    var=['salt_' + d for d in depth],
    z=[float(d[:-1]) for d in depth],
    method='maximum',
    title='Max. Salinity [PSU]',
    output_file='plot_max_sal_profile_monthly_stats.png'
)
_images/plot_max_sal_profile_monthly_stats.png

CCA profiles Plot

plots.plot_cca_profiles(
    df,
    var='current_speed_',
    month=None,
    return_period=10,
    output_file='plot_cca_profiles.png'
)
_images/plot_cca_profiles.png

CCA profiles Table

tables.table_cca_profiles(
    df,
    var='current_speed_',
    month=None,
    return_period=10,
    output_file='table_cca_profiles.csv'
)

Depth [m]

0.0

1.0

2.5

5.0

10.0

15.0

20.0

25.0

30.0

40.0

50.0

75.0

100.0

150.0

200.0

250.0

300.0

350.0

400.0

450.0

500.0

750.0

1000.0

1250.0

1500.0

Worst case

0.0

0.96

0.96

0.96

0.96

0.95

0.94

0.94

0.93

0.91

0.88

0.83

0.7

0.65

0.62

0.6

0.58

0.55

0.51

0.47

0.43

0.37

0.24

0.22

0.22

0.21

0.96

1.0

0.96

0.96

0.96

0.96

0.95

0.94

0.94

0.93

0.91

0.88

0.83

0.7

0.65

0.62

0.6

0.58

0.55

0.51

0.47

0.43

0.37

0.24

0.22

0.22

0.21

0.96

2.5

0.96

0.96

0.96

0.96

0.95

0.94

0.94

0.93

0.91

0.88

0.83

0.7

0.65

0.62

0.6

0.58

0.55

0.51

0.47

0.42

0.37

0.24

0.22

0.22

0.21

0.96

5.0

0.95

0.95

0.95

0.95

0.94

0.94

0.93

0.92

0.91

0.88

0.83

0.7

0.65

0.62

0.6

0.58

0.55

0.51

0.47

0.42

0.36

0.24

0.22

0.22

0.21

0.95

10.0

0.93

0.93

0.93

0.93

0.93

0.93

0.93

0.92

0.91

0.88

0.83

0.7

0.65

0.62

0.6

0.58

0.55

0.51

0.47

0.42

0.36

0.24

0.22

0.21

0.21

0.93

15.0

0.91

0.91

0.92

0.92

0.92

0.92

0.92

0.92

0.91

0.88

0.83

0.7

0.65

0.62

0.6

0.57

0.55

0.51

0.47

0.42

0.36

0.24

0.22

0.21

0.21

0.92

20.0

0.9

0.9

0.9

0.91

0.91

0.91

0.92

0.91

0.9

0.87

0.83

0.7

0.65

0.61

0.59

0.57

0.55

0.51

0.47

0.42

0.36

0.24

0.22

0.21

0.21

0.92

25.0

0.88

0.88

0.89

0.89

0.9

0.9

0.91

0.91

0.9

0.87

0.83

0.7

0.65

0.61

0.59

0.57

0.55

0.51

0.47

0.42

0.36

0.23

0.21

0.21

0.2

0.91

30.0

0.87

0.87

0.87

0.88

0.89

0.89

0.89

0.9

0.9

0.88

0.83

0.71

0.65

0.62

0.6

0.58

0.55

0.51

0.47

0.43

0.36

0.23

0.21

0.21

0.2

0.9

40.0

0.82

0.82

0.82

0.83

0.84

0.84

0.85

0.85

0.86

0.88

0.85

0.72

0.66

0.63

0.61

0.58

0.56

0.52

0.48

0.43

0.37

0.23

0.21

0.2

0.2

0.88

50.0

0.76

0.76

0.76

0.77

0.78

0.78

0.79

0.79

0.8

0.83

0.85

0.74

0.68

0.64

0.62

0.6

0.57

0.53

0.49

0.44

0.38

0.23

0.21

0.21

0.2

0.85

75.0

0.61

0.61

0.61

0.62

0.63

0.63

0.64

0.64

0.65

0.67

0.7

0.77

0.73

0.69

0.67

0.65

0.61

0.57

0.52

0.46

0.39

0.25

0.23

0.23

0.23

0.77

100.0

0.54

0.54

0.54

0.55

0.56

0.56

0.56

0.57

0.58

0.6

0.62

0.7

0.73

0.71

0.69

0.67

0.63

0.58

0.52

0.46

0.37

0.23

0.22

0.22

0.22

0.73

150.0

0.48

0.48

0.49

0.49

0.5

0.5

0.5

0.51

0.51

0.53

0.56

0.63

0.67

0.72

0.71

0.69

0.65

0.59

0.53

0.45

0.37

0.22

0.22

0.22

0.22

0.72

200.0

0.44

0.44

0.45

0.45

0.45

0.46

0.46

0.46

0.47

0.48

0.51

0.57

0.61

0.67

0.69

0.68

0.64

0.58

0.52

0.45

0.36

0.21

0.21

0.21

0.21

0.69

250.0

0.4

0.4

0.4

0.41

0.41

0.41

0.42

0.42

0.42

0.44

0.46

0.52

0.56

0.61

0.64

0.67

0.64

0.58

0.51

0.44

0.36

0.21

0.2

0.2

0.2

0.67

300.0

0.36

0.36

0.36

0.36

0.36

0.37

0.37

0.37

0.37

0.39

0.41

0.46

0.49

0.53

0.56

0.59

0.62

0.58

0.52

0.44

0.36

0.2

0.19

0.19

0.19

0.62

350.0

0.31

0.31

0.31

0.31

0.31

0.31

0.32

0.32

0.32

0.33

0.35

0.39

0.41

0.45

0.47

0.5

0.54

0.57

0.54

0.46

0.37

0.2

0.19

0.19

0.18

0.57

400.0

0.26

0.26

0.26

0.26

0.26

0.26

0.26

0.27

0.27

0.28

0.29

0.32

0.34

0.36

0.38

0.4

0.43

0.48

0.52

0.48

0.4

0.22

0.19

0.18

0.18

0.52

450.0

0.21

0.21

0.21

0.21

0.22

0.22

0.22

0.22

0.22

0.23

0.24

0.27

0.27

0.29

0.3

0.31

0.34

0.38

0.44

0.48

0.44

0.24

0.2

0.19

0.18

0.48

500.0

0.18

0.18

0.18

0.18

0.18

0.18

0.18

0.18

0.19

0.19

0.2

0.22

0.22

0.23

0.24

0.25

0.27

0.3

0.35

0.43

0.45

0.27

0.21

0.2

0.19

0.45

750.0

0.1

0.1

0.1

0.1

0.1

0.1

0.1

0.1

0.1

0.1

0.1

0.12

0.11

0.11

0.11

0.12

0.12

0.13

0.16

0.19

0.22

0.37

0.32

0.3

0.29

0.37

1000.0

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.1

0.11

0.12

0.12

0.12

0.12

0.12

0.13

0.14

0.16

0.18

0.34

0.39

0.38

0.37

0.39

1250.0

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.1

0.12

0.12

0.13

0.12

0.13

0.13

0.13

0.15

0.16

0.18

0.33

0.4

0.41

0.4

0.41

1500.0

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.09

0.1

0.12

0.12

0.13

0.13

0.13

0.13

0.14

0.15

0.16

0.18

0.33

0.4

0.41

0.42

0.42

Wave Spectrum Plots

In all the spectra functions, the data can be filtered using the selected start_time and end_time. If start_time and end_time is set to None the full dataset will be used.

Monthly Mean 1D Wave Spectrum

plots.plot_spectra_1d(
   data,
   var = 'SPEC',
   period = None,
   month = None,
   method = 'mean',
   output_file  = 'wave_spectrum_1d_months.png'
)
_images/wave_spectrum_1d_months.png

1D Spectrum Mean for a Specific Month Across Several Years

plots.plot_spectra_1d(
   data,
   var = 'SPEC',
   period = None,
   month = 1,
   method = 'mean',
   output_file  = 'wave_spectrum_1d_month.png'
)
_images/wave_spectrum_1d_month.png

2D Wave Spectrum at Time of Maximum Hm0 in Selected Period

plots.plot_spectrum_2d(
   data,
   var = 'SPEC',
   period = ['2021-01-01T00','2024-12-31T23'],
   month = None,
   method = 'hm0_max',
   plot_type = 'pcolormesh',
   output_file  = 'wave_spectrum_2d.png'
)
_images/wave_spectrum_2d.png

Diana Wave Spectrum with Swell and Windsea Partitions, Averaged Over Times with Hm0 ≥ 99th Percentile

The function takes an xarray Dataset as input. If the wind data are provided in a CSV file, they must first be converted to an xarray Dataset. This can be done as follows:

df = pd.read_csv('NORA3_wind_wave.csv', comment="#", index_col=0, parse_dates=True)
df1=df[['wind_speed_10m','wind_direction_10m']]
df1.columns=['wind_speed','wind_direction']
NORA3_wind_sub=df1.to_xarray()

Partitioning requires that the wave spectra data (NORA3_wave_spec) are merged with the wind data (NORA3_wind_sub) beforehand, using:

spec_funcs.merge_spec_wind(NORA3_wave_spec, NORA3_wind_sub)

The plotting function can also be used without combining with wind data. However, in that case, partitioning will not be available. Once the datasets are combined, the following code can be used to generate the plot:

plots.plot_diana_spectrum(
   data,
   var = 'SPEC',
   period = ['2022-01-01T00', '2022-07-31T23'],
   month = 1,
   method = 'top_1_percent_mean',
   partition = True,
   plot_type = 'pcolormesh',
   freq_mask = True,
   bar = 'hm0',
   arrow_dir = 'pdir',
   output_file  = 'wave_spectrum_diana.png'
)
_images/wave_spectrum_diana.png

Wind Sea and Swell Wave Peak Direction-Frequency Occurrences

This function requires the wave spectra data (NORA3_wave_spec) to be merged with the wind data (NORA3_wind_sub) beforehand. Refer to the Diana section for instructions.

plots.plot_partition_peak_dir_freq_2d(
   data,
   var = 'SPEC',
   period = time,
   month=month,
   hm0_threshold = 1,
   windsea_freq_mask_percentile=None,
   swell_freq_mask_percentile=99,
   output_file = 'wave_partition_peak_dir_freq_2d.png'
)
_images/wave_partition_peak_dir_freq_2d.png

2D Monthly Mean Wave Spectra

plots.plot_spectra_2d(
   data,
   var = 'SPEC',
   method = 'mean',
   plot_type = 'contour',
   cbar = 'multiple',
   output_file  = 'wave_spectra_2d_monthly_mean.png'
)
_images/wave_spectra_2d_monthly_mean.png

Directional Wave Spectra Averaged by Peak Wave Direction in 30° Sectors

plots.plot_spectra_2d(
   data,
   var = 'SPEC',
   method = 'direction'
   plot_type = 'contour',
   cbar = 'single',
   output_file  = 'wave_spectra_2d_direction.png'
)
_images/wave_spectra_2d_direction.png

Tidal Levels Table

tables.table_tidal_levels(
    ds_tide,
    var='tide',
    output_file='tidal_levels.csv'
)

Tidal Level

[m]

HAT

0.29

MSL

-0.0

LAT

-0.24

Tidal Levels Plot

plots.plot_tidal_levels(
    ds_all,
    var='tide',
    start_time='1980-01-01',
    end_time='2014-12-31',
    output_file='tidal_levels.png'
)
_images/tidal_levels.png

Tidal Type

stats.tidal_type(
    df,
    var='tide'
)

‘Tidal type = semi-diurnal’

Storm Surge for Given Hs Table

tables.table_storm_surge_for_given_hs(
    ds_all,
    var_surge='zeta_0m',
    var_hs='HS',
    bin_width=1,
    max_hs=20,
    output_file='table_perc_surge_for_Hs.csv'
)

Hs[m]

S(P5-model) [m]

S(Mean-model) [m]

S(P95-model) [m]

0.5

-0.97

-0.32

0.32

1.5

-0.99

-0.32

0.35

2.5

-0.97

-0.29

0.39

3.5

-0.94

-0.25

0.44

4.5

-0.9

-0.21

0.48

5.5

-0.86

-0.16

0.53

6.5

-0.82

-0.12

0.58

7.5

-0.78

-0.07

0.63

8.5

-0.73

-0.03

0.68

9.5

-0.68

0.02

0.72

10.5

-0.64

0.07

0.77

11.5

-0.59

0.12

0.82

12.5

-0.54

0.17

0.87

13.5

-0.49

0.21

0.92

14.5

-0.45

0.26

0.97

15.5

-0.4

0.31

1.02

16.5

-0.35

0.36

1.07

17.5

-0.3

0.41

1.12

18.5

-0.25

0.46

1.17

19.5

-0.2

0.51

1.22

Storm Surge for Given Hs Plot

plots.plot_storm_surge_for_given_hs(
    ds_all,
    var_surge='zeta_0m',
    var_hs='HS',
    max_hs=20,
    output_file='surge_for_given_hs.png'
)
_images/surge_for_given_hs.png

Extreme Total Water Level Table

tables.table_extreme_total_water_level(
    ds_all,
    var_hs='HS',
    var_tp='TP',
    var_surge='zeta_0m',
    var_tide='tide',
    periods=[100,10000],
    output_file='table_extreme_total_water_level.csv'
)

Return period [years]

Storm surge[m]

Tidal level(HAT)[m]

Crest heigh[m]

Total water level[m]

100

0.91

0.27

16.08

17.26

10000

0.93

0.27

20.22

21.42

Storm Surge for Return Values Hs Table

tables.table_storm_surge_for_rv_hs(
    ds_all,
    var_hs='HS',
    var_tp='TP',
    var_surge='zeta_0m',
    var_tide='tide',
    periods=[1,10,100,10000],
    depth=200,
    output_file='table_storm_surge_for_rv_hs.csv'
)

Return period [years]

Hs[m]

Crest heigh[m]

Tidal level(HAT)[m]

S(P5-model) [m]

S(Mean-model) [m]

S(P95-model) [m]

Total water level[m]

1

10.31

11.99

0.27

-0.65

0.06

0.76

13.03

10

11.97

13.86

0.27

-0.57

0.14

0.85

14.97

100

13.97

16.07

0.27

-0.47

0.24

0.95

17.28

10000

17.76

20.2

0.27

-0.28

0.42

1.13

21.6

Map Statistics

from metocean_stats import maps

Plot map with points of interest:

maps.plot_points_on_map(lon=[3.35,3.10],
                   lat=[60.40,60.90],
                   label=['NORA3','NORKYST800'],
                   bathymetry='NORA3')
_images/map.png

Hexbin plot of extreme significant wave height based on NORA3 data:

maps.plot_extreme_wave_map(return_period=100,
                       product='NORA3',
                       title='100-Year Return Values of Significant Wave Height (NORA3)',
                       set_extent = [0,30,52,73],
                       output_file='wave_100yrs_hexbin.png',
                       method='hexbin'
                       )
_images/wave_100yrs_hexbin.png

Contour plot of extreme significant wave height based on NORA3 data:

maps.plot_extreme_wave_map(return_period=100,
                       product='NORA3',
                       title='100-Year Return Values of Significant Wave Height (NORA3)',
                       set_extent = [0,30,52,73],
                       output_file='wave_100yrs_contour.png',
                       method='contour',
                       percentile_contour=45
                       )
_images/wave_100yrs_contour.png

Hexbin plot of extreme wind at 100m height based on NORA3 data:

plot_extreme_wind_map(return_period=100,
                      z=100,
                      product='NORA3',
                      title='100-yr return values Wind at 100 m (NORA3)',
                      set_extent = [0,30,52,73],
                      land_mask = True
                      method = 'hexbin'
                      )
_images/wind_100yrs_100m_hexbin.png

Contour plot of extreme wind at 100m height based on NORA3 data:

plot_extreme_wind_map(return_period=100,
                      z=100,
                      product='NORA3',
                      title='100-yr return values Wind at 100 m (NORA3)',
                      set_extent = [0,30,52,73],
                      land_mask = False
                      method = 'contour',
                      percentile_contour = 50
                      )
_images/wind_100yrs_100m_contour.png

Hexbin plot of extreme surface current speed based on NORA3 (Norkyst2400) data:

plot_extreme_current_map(return_period=100,
                      z='surface',
                      distribution='gumbel',
                      product='NORA3',
                      title='100-yr return values Current at surface (NORA3)',
                      set_extent = [0,30,52,73],
                      output_file='current_100yrs_surface_contour.png',
                      method='hexbin'
                      )
_images/current_100yrs_surface_hexbin.png

Contour plot of extreme surface current speed based on NORA3 (Norkyst2400) data:

plot_extreme_current_map(return_period=100,
                      z='surface',
                      distribution='gumbel',
                      product='NORA3',
                      title='100-yr return values Current at surface (NORA3)',
                      set_extent = [0,30,52,73],
                      output_file='current_100yrs_surface_contour.png',
                      method='contour',
                      percentile_contour=60
                      )
_images/current_100yrs_surface_contour.png

Plot mean 2-m air temperature based on NORA3 data:

plot_mean_air_temperature_map(product='NORA3',
                              title='Mean 2-m air temperature 1991-2020 (NORA3)',
                              set_extent=[-25,-10,60.5,68],
                              unit='degC')
_images/mean_air_temperature_map.png

Plot bathymetry based on NORKYST800 url:

plot_bathymetry_cross_section(product = "NORKYST800",
                              lon=4,
                              lat=60.5)
_images/Bathymetry_cross_section.png

Plot bathymetry with a variable (magnitude.v,u,temperature or salinity) based on NORKYST800 url and csv file:

plot_bathymetry_cross_section_with_variable_from_NORKYST800_overall(product='https://thredds.met.no/thredds/dodsC/fou-hi/norkyst800m-1h/NorKyst-800m_ZDEPTHS_his.an.2025020700.nc',
                                                                    df='NORKYST800_test.csv',
                                                                    lon=4,
                                                                    lat=60.5,
                                                                    var="salinity")
_images/Bathymetry_cross_section_with_variable%3Dsalinity.png

Verification Functions

from plots import verification
from tables import verification

Scatter Plot

plots.plot_scatter(
   df,
   var1='W10',
   var2='W100',
   var1_units='m/s',
   var2_units='m/s',
   title='Scatter',
   regression_line='effective-variance',
   qqplot=False,
   density=True,
   output_file='scatter_plot.png')
_images/scatter_plot.png

Taylor diagram

plots.taylor_diagram(
   df,
   var_ref=['HS'],
   var_comp= ['HS.1','HS.2'],
   norm_std=True,
   output_file='Taylor_diagram.png')
_images/Taylor_diagram.png

Comparison tables between variables

For the comparison between two variables

tables.table_error_metric(
   df,
   var_ref='HS',var_comp='HS.1',
   error_metric=['bias','mae','rmse','scatter_index','corr'],
   output_file='table_error_metric.csv')

bias

mae

rmse

corr

scatter_index

-0.862

0.862

1.094

0.895

0.481

For the comparison between three variables or more

tables.table_error_metric_multiple(
   df,
   var_ref='TP',var_comp=['TP.1','TP.2'],
   error_metric=['scatter_index','rmse','bias','mae','corr'],
   output_file='table_error_metric_multiple.csv')

TP

bias

mae

rmse

corr

scatter_index

TP.1

-3.712

3.766

5.182

0.15

0.586

TP.2

0.757

0.909

1.647

0.833

0.186

Comparison table between 2 variables as a function of another variable

tables.table_binned_error_metric(
   df,
   var_bin='TP',var_bin_size=0.5,var_ref='HS',var_comp='HS.1',
   threshold_min=0,
   error_metric=['bias','scatter_index'],
   output_file='table_binned_error_metric.csv')

TP_bin

bias

scatter_index

nb_val

0.25

0

0.75

0

1.25

0

1.75

0

2.25

0

2.75

-0.167

0.306

3

3.25

-0.175

0.286

44

3.75

-0.206

0.288

156

4.25

-0.264

0.332

661

4.75

-0.307

0.338

1179

5.25

-0.376

0.372

2104

5.75

-0.42

0.376

2984

6.25

-0.482

0.383

4009

6.75

-0.552

0.385

5043

7.25

-0.635

0.397

5091

7.75

-0.688

0.404

4832

8.25

-0.802

0.426

5412

8.75

-0.873

0.434

5496

9.25

-0.931

0.437

4941

9.75

-1.049

0.444

3597

10.25

-1.073

0.438

3902

10.75

-1.19

0.464

3203

11.25

-1.222

0.464

2808

11.75

-1.301

0.491

2153

12.25

-1.376

0.508

1705

12.75

-1.419

0.541

1514

13.25

-1.517

0.593

876

13.75

-1.528

0.573

782

14.25

-1.525

0.595

473

14.75

-1.555

0.612

363

15.25

-1.496

0.637

368

15.75

-1.46

0.687

172

16.25

-1.744

0.709

112

16.75

-1.472

0.659

103

17.25

-1.738

0.747

87

17.75

-1.471

0.751

34

18.25

-1.388

0.519

33

18.75

-1.467

0.582

21

19.25

-2.14

0.764

5

19.75

-0.8

0.295

2

20.25

-0.5

0.446

5

20.75

-0.775

0.581

4

21.25

-0.65

0.58

2

21.75

-0.8

0.889

1

Comparison plots between variables as a function of another variable

For the comparison between two variables

plots.plot_binned_error_metric(
   df,
   var_bin='W10',var_bin_size=0.5,var_bin_unit='m/s',
   var_ref='HS',var_comp=['HS.1'],var_comp_unit='m',
   threshold_min=100,
   error_metric='bias',
   output_file='plot_binned_error_metric_2var.png')
_images/plot_binned_error_metric_2var.png

For the comparison between three variables

plots.plot_binned_error_metric(
   df,
   var_bin='TP',var_bin_size=0.5,var_bin_unit='s',
   var_ref='HS',var_comp=['HS.1','HS.2'],var_comp_unit='m',
   threshold_min=100,
   error_metric='corr',
   output_file='plot_binned_error_metric_3var.png')
_images/plot_binned_error_metric_3var.png

Auxiliary Functions

from metocean_stats.stats.aux_funcs import *

Convert lat/lon coordinates from degrees/minutes/seconds to decimals:

lat = degminsec_to_decimals(60,30,00)

returns lat = 60.5

Estimate total depth of wave influence in meters:

depth = depth_of_wave_influence(Hs=12, Tp=15, ref_depth=1000,spectrum='JONSWAP', theshold=0.01)

returns depth = 692.5

Estimate wind speed at a different height and time period:

wind_speed2 = estimate_wind_speed(height1=10, wind_speed1=10, time1=600, height2=10, time2=60)

returns wind_speed2 = 11.08 m/s