|
1 | 1 | from os.path import abspath, dirname, join, isfile, normpath, relpath |
2 | | -import unittest |
3 | | -import pickle |
4 | | -import json |
5 | | -import os |
6 | | - |
| 2 | +from pandas.testing import assert_frame_equal |
7 | 3 | from numpy.testing import assert_allclose |
| 4 | +from scipy.interpolate import interp1d |
| 5 | +from random import seed, randint |
8 | 6 | import matplotlib.pylab as plt |
| 7 | +from datetime import datetime |
| 8 | +import xarray.testing as xrt |
| 9 | +import mhkit.wave as wave |
| 10 | +from io import StringIO |
9 | 11 | import pandas as pd |
10 | 12 | import numpy as np |
11 | | - |
12 | | -import mhkit.wave as wave |
| 13 | +import contextlib |
| 14 | +import unittest |
| 15 | +import netCDF4 |
| 16 | +import inspect |
| 17 | +import pickle |
| 18 | +import time |
| 19 | +import json |
| 20 | +import sys |
| 21 | +import os |
13 | 22 |
|
14 | 23 |
|
15 | 24 | testdir = dirname(abspath(__file__)) |
@@ -45,10 +54,6 @@ def setUpClass(self): |
45 | 54 | self.wdrt_dt = 3600 |
46 | 55 | self.wdrt_period = 50 |
47 | 56 |
|
48 | | - # `samples_contour`Example data |
49 | | - self.hs_contour = np.array([8.56637939, 9.27612515, 8.70427774]) |
50 | | - self.te_contour = np.array([10, 15, 20]) |
51 | | - |
52 | 57 | @classmethod |
53 | 58 | def tearDownClass(self): |
54 | 59 | pass |
@@ -235,28 +240,7 @@ def test_kde_copulas(self): |
235 | 240 | self.wdrt_copulas['bivariate_KDE_log_x2'])] |
236 | 241 | self.assertTrue(all(close)) |
237 | 242 |
|
238 | | - def test_samples_contours_type_validation(self): |
239 | | - with self.assertRaises(TypeError): |
240 | | - wave.contours.samples_contour( |
241 | | - 'not an array', self.te_contour, self.hs_contour) |
242 | | - with self.assertRaises(TypeError): |
243 | | - wave.contours.samples_contour( |
244 | | - self.te_contour, 'not an array', self.hs_contour) |
245 | | - with self.assertRaises(TypeError): |
246 | | - wave.contours.samples_contour( |
247 | | - self.te_contour, self.hs_contour, 'not an array') |
248 | | - |
249 | | - def test_samples_contours_length_mismatch(self): |
250 | | - with self.assertRaises(ValueError): |
251 | | - wave.contours.samples_contour( |
252 | | - self.te_contour, self.hs_contour, np.array([1, 2])) |
253 | | - |
254 | | - def test_samples_contours_range_validation(self): |
255 | | - with self.assertRaises(ValueError): |
256 | | - wave.contours.samples_contour( |
257 | | - np.array([5, 25]), self.te_contour, self.hs_contour) |
258 | | - |
259 | | - def test_samples_contours_correct_interpolation(self): |
| 243 | + def test_samples_contours(self): |
260 | 244 | te_samples = np.array([10, 15, 20]) |
261 | 245 | hs_samples_0 = np.array([8.56637939, 9.27612515, 8.70427774]) |
262 | 246 | hs_contour = np.array(self.wdrt_copulas["gaussian_x1"]) |
|
0 commit comments