metobs_toolkit.analysis.Analysis.get_aggregated_cycle_statistics#
- Analysis.get_aggregated_cycle_statistics(obstype='temp', aggregation=['lcz', 'datetime'], aggregation_method='mean', horizontal_axis='hour', stations=None, startdt=None, enddt=None, plot=True, title=None, y_label=None, legend=True, errorbands=False, verbose=False, _obsdf=None, _show_zero_line=False)[source]#
Create an average cycle for an aggregated categorie.
A commen example is to aggregate to the LCZ’s, so to get the diurnal cycle per LCZ rather than per station.
(In the plot, each aggregated category different from datetime, is represed by a line.)
- Parameters:
obstype (str, optional) – Element of the metobs_toolkit.observation_types The default is ‘temp’.
aggregation (list, optional) – List of variables to aggregate to. These variables should either a categorical observation type, a categorical column in the metadf or a time aggregation. All possible time aggreagetions are: [‘minute’, ‘hour’, ‘month’, ‘year’, ‘day_of_year’, ‘week_of_year’, ‘season’]. The default is [‘lcz’, ‘datetime’].
aggregation_method (str, optional) – Which (numpy) function is used to aggregate the observations. The default is ‘mean’.
horizontal_axis (str, optional) – Which aggregated value will be represented on the horizontal axis of the plot. The default is ‘hour’.
stations (list, optional) – List of station names to use. If None, all present stations will be used. The default is None.
startdt (datetime.datetime, optional) – The start datetime of the observations to use. If None, all timestamps will be used. The default is None.
enddt (datetime.datetime, optional) – The end datetime of the observations to use. If None, all timestamps will be used. The default is None.
plot (bool, optional) – If True, a diurnal plot is made. The default is True.
title (string, optional) – Title of the figure, if None a default title is generated. The default is None.
y_label (string, optional) – y-axes label of the figure, if None a default label is generated. The default is None.
legend (bool, optional) – I True, a legend is added to the plot. The default is True.
errorbands (bool, optional) – If True, the std is representd in the plot by colored bands. The default is False.
verbose (True, optional) – If True, an additional dataframe with aggregation information is returned . The default is False.
- Returns:
df – The dataframe containing the aggregated values.
- Return type:
pandas.DataFrame()
Note
If a timezone unaware datetime is given as an argument, it is interpreted as if it has the same timezone as the observations.