wxee.time_series.TimeSeries.fill_gaps

TimeSeries.fill_gaps(window: int, unit: str, align: str = 'center', reducer: Any | None = None, fill_value: float | None = None) TimeSeries[source]

Apply gap-filling using a moving window reducer through time. Each image is unmasked using its reduced temporal neighbors. If the window is not wide enough to include an unmasked value (e.g. if clouds occur in the same location in all images), masked values will remain unless a fill_value is specified.

Parameters:
  • window (int) – The number of time units to include in each rolling period.

  • unit (str) – The time frequency of the window. One of “hour”, “day”, “week”, “month”, “year”.

  • align (str, default "center") – The start location of the rolling window, relative to the primary image time. One of “left”, “center”, “right”. For example, a 3-day left-aligned window will include all images up to (but not including) 3 days prior to the primary image. Date ranges are exclusive in the alignment direction and inclusive in the opposite direction, so each primary image will be included in its own window.

  • reducer (Optional[ee.Reducer]) – The reducer to apply to each rolling window. If none is given, ee.Reducer.mean will be used.

  • fill_value (float) – The value to fill any masked values with after applying initial gap-filling. If none is given, masked values may remain if the window size is not large enough.

Returns:

The time series with each image unmasked using its reduced neighbors.

Return type:

wxee.time_series.TimeSeries

Example

>>> ts = wxee.TimeSeries("MODIS/006/MOD13A2)
>>> ts_filled = ts.fill_gaps(90, "day", "center", reducer=ee.Reducer.median())