bsrn.utils.quality.get_daily_stats#

bsrn.utils.quality.get_daily_stats(df, lat, lon, elev, station_code=None)[source]#

Calculate daily QC statistics and sunshine duration.

Parameters:
  • df (pd.DataFrame) – BSRN data archive.

  • lat (float) – Latitude. [degrees]

  • lon (float) – Longitude. [degrees]

  • elev (float) – Elevation. [m]

  • station_code (str, optional) – BSRN station abbreviation. If ghi_clear / bni_clear are not on df, used with add_clearsky_columns() so the tracker row matches run_qc() (Ineichen references).

Returns:

daily_df – Daily counts of flags and sunshine duration metrics.

Return type:

pd.DataFrame

Notes

Minutes with BSRN missing codes (-999, -99.9, -99.99) or NaN in the relevant input column do not add to per-test failure sums. is_sunshine only counts minutes with a valid (non-missing) BNI value above the threshold.

TRACKER uses Ineichen ghi_clear / bni_clear like run_qc (not the GHIE-only fallback). Pass station_code so Linke turbidity matches the registry; if only lat / lon / elev are available, clear-sky is still computed but turbidity defaults may differ from run_qc with a named station.