API Reference#


Data Shifts#

Functions for identifying shifts in data values in time series and for identifying periods with data shifts. For functions that identify shifts in time, see quality.time


Detect data shifts in a time series of daily values.


Return the start and end dates of the longest serially complete time series segment.


The check_*_limits_qcrad functions use the QCRad algorithm 1 to identify irradiance measurements that are beyond physical limits.


Test for physical limits on GHI using the QCRad criteria.


Test for physical limits on DHI using the QCRad criteria.


Test for physical limits on DNI using the QCRad criteria.

All three checks can be combined into a single function call.


Test for physical limits on GHI, DHI or DNI using the QCRad criteria.

Irradiance measurements can also be checked for consistency.


Check consistency of GHI, DHI and DNI using QCRad criteria.

GHI and POA irradiance can be validated against clearsky values to eliminate data that is unrealistically high.

quality.irradiance.clearsky_limits(measured, ...)

Identify irradiance values which do not exceed clearsky values.

You may want to identify entire days that have unrealistically high or low insolation. The following function examines daily insolation, validating that it is within a reasonable range of the expected clearsky insolation for the same day.


Check that daily insolation lies between minimum and maximum values.

There is function for calculating the component sum for GHI, DHI, and DNI, and correcting for nighttime periods. Using this function, we can estimate one irradiance field using the two other irradiance fields. This can be useful for comparison, as well as to calculate missing data fields.


Use the component sum equations to calculate the missing series, using the other available time series.


Identify gaps in the data.

quality.gaps.interpolation_diff(x[, window, ...])

Identify sequences which appear to be linear.

Data sometimes contains sequences of values that are “stale” or “stuck.” These are contiguous spans of data where the value does not change within the precision given. The functions below can be used to detect stale values.


If the data has been altered in some way (i.e. temperature that has been rounded to an integer value) before being passed to these functions you may see unexpectedly large amounts of stale data.

quality.gaps.stale_values_diff(x[, window, ...])

Identify stale values in the data.

quality.gaps.stale_values_round(x[, window, ...])

Identify stale values by rounding.

The following functions identify days with incomplete data.

quality.gaps.completeness_score(series[, ...])

Calculate a data completeness score for each day.

quality.gaps.complete(series[, ...])

Select data points that are part of days with complete data.

Many data sets may have leading and trailing periods of days with sporadic or no data. The following functions can be used to remove those periods.

quality.gaps.start_stop_dates(series[, days])

Get the start and end of data excluding leading and trailing gaps.

quality.gaps.trim(series[, days])

Mask the beginning and end of the data if not all True.

quality.gaps.trim_incomplete(series[, ...])

Trim the series based on the completeness score.


Functions for detecting outliers.

quality.outliers.tukey(data[, k])

Identify outliers based on the interquartile range.

quality.outliers.zscore(data[, zmax, nan_policy])

Identify outliers using the z-score.

quality.outliers.hampel(data[, window, ...])

Identify outliers by the Hampel identifier.


Quality control related to time. This includes things like time-stamp spacing, time-shifts, and time zone validation.

quality.time.spacing(times, freq)

Check that the spacing between times conforms to freq.

Timestamp shifts, such as daylight savings, can be identified with the following functions.

quality.time.shifts_ruptures(event_times, ...)

Identify time shifts using the ruptures library.

quality.time.has_dst(events, tz[, window, ...])

Return True if events appears to have daylight savings shifts at the dates on which tz transitions to or from daylight savings time.


The quality.util module contains general-purpose/utility functions for building your own quality checks.

quality.util.check_limits(val[, ...])

Check whether a value falls withing the given limits.

quality.util.daily_min(series, minimum[, ...])

Return True for data on days when the day's minimum exceeds minimum.


Quality checks for weather data.


Identify relative humidity values that are within limits.

quality.weather.temperature_limits(...[, limits])

Identify temperature values that are within limits.

quality.weather.wind_limits(wind_speed[, limits])

Identify wind speed values that are within limits.

In addition to validating temperature by comparing with limits, module temperature should be positively correlated with irradiance. Poor correlation could indicate that the sensor has become detached from the module, for example. Unlike other functions in the quality module which return Boolean masks over the input series, this function returns a single Boolean value indicating whether the entire series has passed (True) or failed (False) the quality check.


Test whether the module temperature is correlated with irradiance.



C. N. Long and Y. Shi, An Automated Quality Assessment and Control Algorithm for Surface Radiation Measurements, The Open Atmospheric Science Journal 2, pp. 23-37, 2008.


Functions for detecting features in the data.


Functions for identifying inverter clipping

features.clipping.levels(ac_power[, window, ...])

Label clipping in AC power data based on levels in the data.

features.clipping.threshold(ac_power[, ...])

Detect clipping based on a maximum power threshold.

features.clipping.geometric(ac_power[, ...])

Identify clipping based on a the shape of the ac_power curve on each day.


features.clearsky.reno(ghi, ghi_clearsky)

Identify times when GHI is consistent with clearsky conditions.


System orientation refers to mounting type (fixed or tracker) and the azimuth and tilt of the mounting. A system’s orientation can be determined by examining power or POA irradiance on days that are relatively sunny.

This module provides functions that operate on power or POA irradiance to identify system orientation on a daily basis. These functions can tell you whether a day’s profile matches that of a fixed system or system with a single-axis tracker.

Care should be taken when interpreting function output since other factors such as malfunctioning trackers can interfere with identification.

features.orientation.fixed_nrel(...[, ...])

Flag days that match the profile of a fixed PV system on a sunny day.

features.orientation.tracking_nrel(...[, ...])

Flag days that match the profile of a single-axis tracking PV system on a sunny day.


Functions that relate to determining day/night periods in a time series, and getting sunrise and sunset times based on the day-night mask outputs.


Return True for values that are during the day.

features.daytime.get_sunrise(daytime_mask[, ...])

Using the outputs of power_or_irradiance(), derive sunrise values for each day in the associated time series.

features.daytime.get_sunset(daytime_mask[, ...])

Using the outputs of power_or_irradiance(), derive sunset values for each day in the associated time series.


Functions for labeling shadows.

features.shading.fixed(ghi, daytime, clearsky)

Detects shadows from fixed structures such as wires and poles.


This module contains functions and classes relating to PV system parameters such as nameplate power, tilt, azimuth, or whether the system is equipped with tracker.



Enum describing the orientation of a PV System.

system.is_tracking_envelope(series, daytime, ...)

Infer whether the system is equipped with a tracker.


The following function can be used to infer system orientation from power or plane of array irradiance measurements.


Determine system azimuth and tilt from power or POA using solar azimuth at the daily peak.

system.infer_orientation_fit_pvwatts(...[, ...])

Get the tilt and azimuth that give PVWatts v5 output that most closely fits the data in power_ac.


Performance Ratio#

The following functions can be used to calculate system performance metrics.

metrics.performance_ratio_nrel(poa_global, ...)

Calculate NREL Performance Ratio.


Functions to calculate variability statistics.

metrics.variability_index(measured, clearsky)

Calculate the variability index.