File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1111
1212import windpowerlib .wind_turbine as wt
1313import windpowerlib .modelchain as mc
14+ from windpowerlib .tools import WindpowerlibUserWarning
1415
1516
1617class TestModelChain :
@@ -454,3 +455,20 @@ def test_heigths_as_string(self):
454455 test_mc = mc .ModelChain (wt .WindTurbine (** test_turbine ),
455456 ** test_modelchain )
456457 test_mc .run_model (string_weather )
458+
459+ def test_weather_with_nan_values (self , recwarn ):
460+ """Test warning if weather data contain nan values."""
461+ test_turbine = {'hub_height' : 100 ,
462+ 'rotor_diameter' : 80 ,
463+ 'turbine_type' : 'E-126/4200' }
464+ nan_weather = self .weather_df .copy ()
465+ nan_weather .loc [1 , ("temperature" , 10 )] = np .nan
466+ test_modelchain = {'power_output_model' : 'power_curve' ,
467+ 'density_corr' : True }
468+ test_mc = mc .ModelChain (wt .WindTurbine (** test_turbine ),
469+ ** test_modelchain )
470+ msg = "'temperature', 10"
471+ with pytest .warns (WindpowerlibUserWarning , match = msg ):
472+ test_mc .run_model (nan_weather )
473+ test_mc .run_model (self .weather_df )
474+ assert len (recwarn ) == 0
You can’t perform that action at this time.
0 commit comments