CapData

The CapData class is the core interface for capacity testing. It holds raw and filtered data, column group mappings, filter history, and regression results.

capdata.CapData(name)

Class to store capacity test data and column grouping.

Setup

Methods that must be called after loading data and before filtering or fitting a regression. Use set_regression_cols() to map regression terms to column names or column group ids, then call process_regression_columns() to validate and prepare those mappings. custom_param() adds a column of derived values (e.g. temperature-corrected power or spectral corrections) directly to the CapData instance; see Calculation Parameters for the available calculation functions.

capdata.CapData.set_regression_cols([power, ...])

Create a dictionary linking the regression variables to data.

capdata.CapData.process_regression_columns([...])

Walk the regression column dictionary and calculate parameters.

capdata.CapData.custom_param(func, *args, ...)

Applies the function func with kwargs and adds result as new column to data.

Data Management

Methods for inspecting, renaming, copying, and exporting data.

capdata.CapData.get_reg_cols([reg_vars, ...])

Get regression columns renamed with keys from regression_cols.

capdata.CapData.review_column_groups()

Print column_groups with nice formatting.

capdata.CapData.copy()

Create and returns a copy of self.

capdata.CapData.empty()

Return a boolean indicating if the CapData object contains data.

capdata.CapData.drop_cols(columns)

Drop columns from CapData data, data_filtered, and column_groups.

capdata.CapData.rename_cols(column_map)

Rename columns in data, data_filtered, and column_groups.

Aggregation

Methods for aggregating sensor readings into single representative columns.

capdata.CapData.agg_sensors([agg_map, verbose])

Aggregate measurments of the same variable from different sensors.

capdata.CapData.agg_group(group_id, agg_func)

Aggregate columns in a group.

capdata.CapData.expand_agg_map(agg_map)

Traverses, expands, and sorts the agg_map.

capdata.CapData.reset_agg()

Remove aggregation columns from data and data_filtered attributes.

Filtering

Methods that apply filters to data_filtered. Each method records the rows kept and removed in the filter history.

capdata.CapData.filter_irr(low, high[, ...])

Filter on irradiance values.

capdata.CapData.filter_pvsyst([inplace])

Filter pvsyst data for off max power point tracking operation.

capdata.CapData.filter_shade([fshdbm, ...])

Remove data during periods of array shading.

capdata.CapData.filter_time([start, end, ...])

Select data for a specified time period.

capdata.CapData.filter_days(days[, drop, ...])

Select or drop timestamps for days passed.

capdata.CapData.filter_outliers([inplace])

Apply eliptic envelope from scikit-learn to remove outliers.

capdata.CapData.filter_pf(pf[, inplace])

Filter data on the power factor.

capdata.CapData.filter_power(power[, ...])

Remove data above the specified power threshold.

capdata.CapData.filter_custom(func, *args, ...)

Apply update_summary decorator to passed function.

capdata.CapData.filter_sensors([perc_diff, ...])

Drop suspicious measurments by comparing values from different sensors.

capdata.CapData.filter_clearsky([ghi_col, ...])

Use pvlib detect_clearsky to remove periods with unstable irradiance.

capdata.CapData.filter_missing([columns])

Removes any rows where the regression columns contain missing data (NaNs).

capdata.CapData.filter_op_state(op_state[, ...])

NOT CURRENTLY IMPLEMENTED - Filter on inverter operation state.

capdata.CapData.reset_filter()

Set data_filtered to data and reset filtering summary.

Reporting Conditions

Methods for computing ASTM E2848 reporting conditions.

capdata.CapData.rep_cond([irr_bal, ...])

Calculate reporting conditions for the current regression formula.

capdata.CapData.rep_cond_freq([irr_bal, ...])

Calculate frequency-grouped reporting conditions.

Regression

Methods for fitting the ASTM E2848 regression and predicting capacities.

capdata.CapData.fit_regression([filter, ...])

Perform a regression with statsmodels on filtered data.

capdata.CapData.predict_capacities([...])

Calculate expected capacities.

Results and Uncertainty

Methods for quantifying test results, uncertainty, and completeness.

capdata.CapData.uncertainty()

Calculate random standard uncertainty of the regression.

capdata.CapData.spatial_uncert(column_groups)

Spatial uncertainties of the independent regression variables.

capdata.CapData.expanded_uncert(grp_to_term)

Calculate expanded uncertainty of the predicted power.

capdata.CapData.get_filtering_table()

Returns DataFrame showing which filter removed each filtered time interval.

capdata.CapData.get_summary()

Print a summary of filtering applied to the data_filtered attribute.

capdata.CapData.print_points_summary([hrs_req])

print summary data on the number of points collected.

capdata.CapData.get_length_test_period()

Get length of test period.

capdata.CapData.get_pts_required([hrs_req])

Set number of data points required for complete test attribute.

capdata.CapData.set_test_complete(pts_required)

Sets test_complete attribute.

Visualization

Methods for scatter plots, filter inspection, and interactive dashboards.

capdata.CapData.scatter([filtered])

Create a matplotlib scatter plot of regression lhs vs.

capdata.CapData.scatter_hv([timeseries, ...])

Create a holoviews scatter plot of regression lhs vs.

capdata.CapData.plot([combine, ...])

Create a dashboard to explore timeseries plots of the data.

capdata.CapData.reg_scatter_matrix()

Create pandas scatter matrix of regression variables.

capdata.CapData.scatter_filters()

Returns an overlay of scatter plots of intervals removed for each filter.

capdata.CapData.timeseries_filters()

Returns an overlay of scatter plots of intervals removed for each filter.

Export

Methods for writing data and column groups to Excel.

capdata.CapData.data_columns_to_excel([...])

Write the columns of data to an excel file as a template for a column grouping.

capdata.CapData.column_groups_to_excel([save_to])

Export the column groups attribute to an excel file.