metobs_toolkit.analysis.Analysis.plot_diurnal_cycle_with_reference_station#
- Analysis.plot_diurnal_cycle_with_reference_station(ref_station: str, obstype: str = 'temp', colorby: str = 'name', title: str | None = None, ax: Axes | None = None, colordict: dict | None = None, legend: bool = True, return_data: bool = False, figkwargs: dict = {}) Axes | Tuple[Axes, DataFrame][source]#
Plot the diurnal cycle of differences between observations and a reference station.
- Parameters:
ref_station (str) – The name of the reference station to compare against.
obstype (str, optional) – The observation type to analyze (e.g., “temp”). Default is “temp”.
colorby (str, optional) – The column name to group data by for coloring the plot. Default is “name”.
title (str or None, optional) – The title of the plot. If None, a default title is generated. Default is None.
ax (matplotlib.axes.Axes or None, optional) – The axes object to plot on. If None, a new figure and axes are created. Default is None.
colordict (dict or None, optional) – A dictionary mapping group names (from colorby) to colors. Default is None.
legend (bool, optional) – Whether to include a legend in the plot. Default is True.
return_data (bool, optional) – If True, returns the aggregated data used for plotting along with the axes. Default is False.
figkwargs (dict, optional) – Additional keyword arguments for figure creation. Default is an empty dictionary.
- Returns:
Union[ – matplotlib.axes.Axes, Tuple[matplotlib.axes.Axes, pandas.DataFrame]
] – The axes object with the plot. If return_data is True, also returns the aggregated DataFrame.
Notes
The method computes the differences between the target observation type (obstype) and the reference station’s values, then aggregates the data by the specified grouping (colorby) and time components (hour, minute, second). The resulting diurnal cycle is plotted, with options for customization.