ee_extra.TimeSeries.core.getTimeSeriesByRegions#
- ee_extra.TimeSeries.core.getTimeSeriesByRegions(x, reducer, collection, bands=None, scale=None, crs=None, crsTransform=None, tileScale=1, dateColumn='date', dateFormat='ISO', naValue=-9999)[source]#
Gets the time series by regions for the given image collection and feature collection according to the specified reducer (or reducers).
- Parameters:
x (
ImageCollection
) – Image collection to get the time series from.reducer (
Any
) – Reducer or list of reducers to use for region reduction.collection (
FeatureCollection
) – Feature Collection to perform the reductions on. Image reductions are applied to each feature in the collection.bands (
Union
[str
,List
[str
],None
]) – Selection of bands to get the time series from. Defaults to all bands in the image collection.scale (
Union
[int
,float
,None
]) – Nomical scale in meters.crs (
Optional
[Any
]) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.crsTransform (
Optional
[Any
]) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.tileScale (
int
) – A scaling factor used to reduce aggregation tile size; using a larger tileScale (e.g. 2 or 4) may enable computations that run out of memory with the default.dateColumn (
str
) – Output name of the date column.dateFormat (
str
) – Output format of the date column. Defaults to ISO. Available options: ‘ms’ (for milliseconds), ‘ISO’ (for ISO Standard Format) or a custom format pattern.naValue (
Union
[int
,float
]) – Value to use as NA when the region reduction doesn’t retrieve a value due to masked pixels.
- Returns:
Time series by regions retrieved as a Feature Collection.
Examples
>>> import ee >>> from ee_extra.TimeSeries.core import getTimeSeriesByRegions >>> ee.Initialize() >>> f1 = ee.Feature(ee.Geometry.Point([3.984770,48.767221]).buffer(50),{'ID':'A'}) >>> f2 = ee.Feature(ee.Geometry.Point([4.101367,48.748076]).buffer(50),{'ID':'B'}) >>> fc = ee.FeatureCollection([f1,f2]) >>> S2 = (ee.ImageCollection('COPERNICUS/S2_SR') ... .filterBounds(fc) ... .filterDate('2020-01-01','2021-01-01')) >>> ts = getTimeSeriesByRegions(S2, ... reducer = [ee.Reducer.mean(),ee.Reducer.median()], ... collection = fc, ... bands = ['B3','B8'], ... scale = 10)