-
Notifications
You must be signed in to change notification settings - Fork 183
Add test of nans in inputs to wind data objects #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 2 commits
f47b22d
1330a83
1acda7c
0579bb6
00507c6
ba72caf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1109,3 +1109,69 @@ def test_read_csv_long_ti(): | |
|
|
||
| expected_result = np.array([0.06, 0.07]) | ||
| np.testing.assert_allclose(wind_ti_rose.turbulence_intensities, expected_result) | ||
|
|
||
|
|
||
| def test_wind_rose_nan_values(): | ||
|
||
| wind_directions = np.array([0.0, 90.0, 180.0, 270.0]) | ||
| wind_speeds = np.array([5.0, 10.0, 15.0]) | ||
|
|
||
| WindRose(wind_directions, wind_speeds, ti_table=0.06) | ||
|
|
||
| # Introduce NaN values | ||
| wind_directions[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| WindRose(wind_directions, wind_speeds, ti_table=0.06) | ||
|
|
||
| wind_directions[1] = 90 # Reset | ||
| wind_speeds[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| WindRose(wind_directions, wind_speeds, ti_table=0.06) | ||
|
|
||
|
|
||
| def test_wind_ti_rose_nan_values(): | ||
| wind_directions = np.array([0.0, 90.0, 180.0, 270.0]) | ||
| wind_speeds = np.array([5.0, 10.0, 15.0]) | ||
| turbulence_intensities = np.array([0.1, 0.2, 0.3]) | ||
|
|
||
| WindTIRose(wind_directions, wind_speeds, turbulence_intensities) | ||
|
|
||
| # Introduce NaN values | ||
| wind_directions[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| WindTIRose(wind_directions, wind_speeds, turbulence_intensities) | ||
|
|
||
| wind_directions[1] = 90 # Reset | ||
| wind_speeds[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| WindTIRose(wind_directions, wind_speeds, turbulence_intensities) | ||
|
|
||
| wind_speeds[1] = 10 # Reset | ||
| turbulence_intensities[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| WindTIRose(wind_directions, wind_speeds, turbulence_intensities) | ||
|
|
||
|
|
||
| def test_time_series_nan_values(): | ||
| wind_directions = np.array([0.0, 90.0, 180.0, 270.0]) | ||
| wind_speeds = np.array([5.0, 10.0, 15.0]) | ||
| turbulence_intensities = np.array([0.1, 0.2, 0.3, 0.4]) | ||
| values = np.array([1.0, 2.0, 3.0, 4.0]) | ||
|
|
||
| # Introduce NaN values | ||
| wind_directions[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| TimeSeries(wind_directions, wind_speeds, turbulence_intensities, values) | ||
|
|
||
| wind_directions[1] = 90 # Reset | ||
| wind_speeds[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| TimeSeries(wind_directions, wind_speeds, turbulence_intensities, values) | ||
|
|
||
| wind_speeds[1] = 10 # Reset | ||
| turbulence_intensities[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| TimeSeries(wind_directions, wind_speeds, turbulence_intensities, values) | ||
|
|
||
| values[1] = np.nan | ||
| with pytest.raises(ValueError): | ||
| TimeSeries(wind_directions, wind_speeds, turbulence_intensities, values) | ||
Uh oh!
There was an error while loading. Please reload this page.