metobs_toolkit.dataset.Dataset.get_qc_stats#

Dataset.get_qc_stats(obstype: str = 'temp', make_plot: bool = True) dict[str, pd.Series] | Figure[source]#

Summarize QC label frequencies across all stations for a given observation type.

This aggregates three series over every station that has the requested obstype:

  • final label counts from each SensorData.df['label'].value_counts();

  • outlier-only label counts from SensorData.outliersdf['label'].value_counts();

  • per-check outcome counts from SensorData.get_qc_freq_statistics() (MultiIndex ['checkname', 'flag']).

When make_plot is True, the aggregated counts are visualized with plotting.qc_overview_pies. When False, the aggregated series are returned for programmatic use.

Parameters:
  • obstype (str, optional) – Observation type to evaluate, by default “temp”.

  • make_plot (bool, optional) – If True, return a figure with pie charts; if False, return the aggregated counts. Default is True.

Returns:

  • matplotlib.figure.Figure or dict[str, pandas.Series] – Figure with QC overview pies when make_plot is True; otherwise a dictionary with keys all_labels, outlier_labels, and per_check_labels. Returns None when no stations provide the requested obstype.

  • .. versionchanged:: 1.1.0 – When make_plot=False, the return type changed from pandas.DataFrame to dict[str, pandas.Series] with keys all_labels, outlier_labels, and per_check_labels. Update any code that previously unpacked or indexed the returned DataFrame.