Skip to content

Commit abaf3b8

Browse files
committed
Raise a warning if there are nan values in the weather data set
1 parent 7a79912 commit abaf3b8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

windpowerlib/modelchain.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
SPDX-License-Identifier: MIT
88
"""
99
import logging
10+
import warnings
1011
import pandas as pd
1112
from windpowerlib import (wind_speed, density, temperature, power_output,
1213
tools)
@@ -516,6 +517,13 @@ def run_model(self, weather_df):
516517
weather_df.columns.get_level_values(0),
517518
pd.to_numeric(weather_df.columns.get_level_values(1))])
518519

520+
if weather_df.isnull().any().any():
521+
nan_columns = list(weather_df.columns[weather_df.isnull().any()])
522+
msg = ("The following columns of the weather data contain invalid "
523+
"values like 'nan': {0}")
524+
warnings.warn(msg.format(nan_columns),
525+
tools.WindpowerlibUserWarning)
526+
519527
wind_speed_hub = self.wind_speed_hub(weather_df)
520528
density_hub = (
521529
None

0 commit comments

Comments
 (0)