Preprocessing

postprocessinglib.utilities._helper_functions Module

The helper module contains all of the functions used alongside the metrics to filter, limit, validate the data before it gets evaluated and present the data properly.

It uses check_valid_dataframe to check if a dataframe just contains invalid values such as Nan or negative values. It contains functions like filer_valid_data which help in filtering out rows contain Nan, negative or zero values. It also contains functions like validate_data which help in making sure that the dataframes are valid and have the same shape and size. Functions like sig_figs and leap_year which help in rounding numbers to a certain number of significant figures and determining if a year is a leap year respectively

Functions

MultiIndex_to_datetime(index)

Convert the MultiIndex value to a datetime value for use in the dataframe

check_valid_dataframe(observed, simulated)

Check if all observations or simulations are invalid and raise an exception/error if this is the case.

columns_to_MultiIndex(cols)

Converts flat columns to MultiIndex by detecting new stations based on 'QOMEAS' patterns.

datetime_to_index(datetime)

Convert the datetime value to index value for use in the dataframe

filter_valid_data(df[, station_num, station])

Removes the invalid values from a dataframe

is_leap_year(year)

Determines if a year is a leap year

sig_figs(x, precision)

Rounds a number to number of significant figures as specified by the precision

validate_data(observed, simulated)

Ensures that a set of observed and simulated dataframes are valid