brightwind.load.load.apply_cleaning_windographer

brightwind.load.load.apply_cleaning_windographer(data, windog_cleaning_file, inplace=False, flags_to_exclude=['Synthesized'], replacement_text='NaN')

Apply cleaning to a DataFrame using the Windographer flagging log file after Windographer was used to clean and filter the data. The flagged data will be replaced with NaN values which then do not appear in any plots or effect calculations.

Parameters
  • data (pandas.DataFrame) – Data to be cleaned.

  • windog_cleaning_file (str) – File path of the Windographer flagging log file which contains the list of sensor names along with the start and end timestamps of the periods that are flagged.

  • inplace (Boolean) – If ‘inplace’ is True, the original data, ‘data’, will be modified and and replaced with the cleaned data. If ‘inplace’ is False, the original data will not be touched and instead a new object containing the cleaned data is created. To store this cleaned data, please ensure it is assigned to a new variable.

  • flags_to_exclude (List[str], default ['Synthesized']) – List of flags you do not want to use to clean the data e.g. Synthesized.

  • replacement_text (str, default 'NaN') – Text used to replace the flagged data.

Returns

DataFrame with the flagged data removed.

Return type

pandas.DataFrame

Example usage

import brightwind as bw
Load data:

data = bw.load_csv(r’C:UsersStephenDocumentsAnalysisdemo_data’) windog_cleaning_file = r’C:somefolderwindog_cleaning_file.txt’

To apply cleaning to ‘data’ and store the cleaned data in ‘data_cleaned’:

data_cleaned = bw.apply_cleaning_windographer(data, windog_cleaning_file) print(data_cleaned)

To modify ‘data’ and replace it with the cleaned data:

bw.apply_cleaning_windographer(data, windog_cleaning_file, inplace=True) print(data)

Apply cleaning where you do not want the flag ‘Tower shading’ to be used:

cleaning_file = r'C:\some\folder\cleaning_file.csv'
data = bw.apply_cleaning_windographer(data, windog_cleaning_file,
                                      flags_to_exclude=['Synthesized', 'Tower shading'],)
print(data)