Filters

The captest.filters module holds all the filters. Each filter is a first-class object: a BaseSummaryStep subclass that declares its configuration as typed param parameters and implements _execute. The filter methods on CapData are thin wrappers that build the matching step and run() it. Steps may also be constructed and run directly:

from captest.filters import Irradiance, RepCond

Irradiance(low=200, high=800, custom_name="Irradiance bounds").run(cd)
RepCond(percent_filter=20).run(cd)

Base Classes

BaseSummaryStep is the common ancestor for everything that appears in the summary table; it owns the run() lifecycle and the custom_name label. BaseFilter adds the contract that _execute returns the pandas Index of rows to keep.

filters.BaseSummaryStep(*, custom_name, name)

Common ancestor for steps that appear in the filtering summary.

filters.BaseFilter(*, custom_name, name)

A pure row-filtering step.

Filter Steps

Each step removes rows from CapData.data_filtered. The corresponding CapData.filter_* wrapper builds and runs the step.

filters.Irradiance(*, col_name, high, low, ...)

Filter rows by an irradiance column to a low/high band.

filters.Pvsyst(*, custom_name, name)

Remove PVsyst intervals operating off the maximum power point.

filters.Shade(*, fshdbm, query_str, ...)

Remove intervals of array shading.

filters.Time(*, days, drop, end, start, ...)

Filter rows to a time window described by start/end/days/test_date.

filters.Days(*, days, drop, custom_name, name)

Keep (or drop) the timestamps belonging to a list of days.

filters.Outliers(*, envelope_kwargs, ...)

Remove statistical outliers in the (poa, power) plane via sklearn EllipticEnvelope.

filters.PowerFactor(*, pf, custom_name, name)

Remove intervals with a power factor below a threshold.

filters.Power(*, columns, percent, power, ...)

Remove intervals at or above a power threshold.

filters.Custom(func, *args[, custom_name])

Apply an arbitrary callable to capdata.data_filtered as a row filter.

filters.Sensors(*, method, thresholds, ...)

Drop rows where redundant sensors in a group disagree beyond a threshold.

filters.Clearsky(*, detect_kwargs, ghi_col, ...)

Remove intervals where measured GHI doesn't match modeled clear-sky GHI.

filters.Backtracking(*, axis_azimuth, ...)

Remove intervals where single-axis-tracker backtracking is active.

filters.Missing(*, columns, custom_name, name)

Remove rows with missing data (NaN) in the regression columns.

filters.RollingStd(*, column, threshold, ...)

Remove intervals where a column's rolling-window standard deviation is at or above threshold (unstable / variable irradiance).

filters.AbsDiffPrev(*, column, threshold, ...)

Remove intervals with a large fractional change from the previous interval (a step-change / stability filter).

filters.BooleanFlag(*, column, invert, ...)

Remove intervals where a boolean/flag column is truthy.

filters.Regression(*, n_std, custom_name, name)

Remove intervals whose regression residuals are statistical outliers.

Reporting Conditions

RepCond is a zero-removal step: it computes CapData.rc and returns the unchanged index, so it appears in the summary at its position in the filter chain without removing any data.

filters.RepCond(*, front_poa, func, irr_bal, ...)

Reporting-conditions calculation as a zero-removal summary step.

Row-filter Helpers

Standalone row-filtering functions that the step classes (and a few non-filter CapData methods) build on. These moved here from capdata.py during the filter-class refactor.

filters.filter_irr(df, irr_col, low, high[, ...])

Top level filter on irradiance values.

filters.sensor_filter(df, threshold[, ...])

Check dataframe for rows with inconsistent values.

filters.check_all_perc_diff_comb(series, ...)

Check series for pairs of values with percent difference above perc_diff.

filters.perc_difference(x, y)

Calculate percent difference of two values.

filters.abs_diff_from_average(series, threshold)

Check each value in series <= average of other values.

filters.backtracking_active(apparent_zenith, ...)

Return a boolean Series marking single-axis-tracker backtracking.