wxee.time_series.TimeSeries.aggregate_time
- TimeSeries.aggregate_time(frequency: str, reducer: Any | None = None, keep_bandnames: bool = True) TimeSeries [source]
Aggregate the collection over the time dimension to a specified frequency. This method can only be used to go from small time frequencies to larger time frequencies, such as hours to days, not vice-versa. If the resampling frequency is smaller than the time between images, un-aggregated images will be returned.
- Parameters:
frequency (str) – The time frequency to aggregate to. One of ‘year’, ‘month’ ‘week’, ‘day’, ‘hour’.
reducer (ee.Reducer, optional) – The reducer to apply when aggregating over time. If none is provided, ee.Reducer.mean() will be used.
keep_bandnames (bool, default True) – If true, the band names of the input images will be kept in the aggregated images. If false, the name of the reducer will be appended to the band names, e.g. SR_B4 will become SR_B4_mean.
- Returns:
The input image collection aggregated to the specified time frequency.
- Return type:
TimeSeries
- Raises:
ValueError – If an invalid frequency is passed.
Example
>>> ts_hourly = wxee.TimeSeries("NOAA/NWS/RTMA") >>> daily_max = ts_hourly.aggregate_time(frequency="day", reducer=ee.Reducer.max())