datesByRegions#
- geetools.ee_image_collection.ImageCollectionAccessor.datesByRegions(band, regions, label='system:index', reducer='mean', dateProperty='system:time_start', scale=10000, crs=None, crsTransform=None, tileScale=1)#
Reduce the data for each image in the collection by regions for a single band.
This method is returning a dictionary with all the regions as keys and their reduced value for each date over the specified region for a specific band as value.
{ "region1": {"date1": value1, "date2": value2, ...}, "region2": {"date1": value1, "date2": value2, ...}, ... }
- Parameters:
band (str) – The band to reduce.
regions (ee.FeatureCollection) – The regions to reduce the data on.
label (str) – The property to use as label for each region. Default is “system:index”.
reducer (str | ee.Reducer) – The name of the reducer or a reducer object use. Default is “mean”.
dateProperty (str) – The property to use as date for each image. Default is “system:time_start”.
scale (int) – The scale in meters to use for the reduction. default is 10000m
crs (str | None) – 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 (list | None) – 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 (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
- Returns:
A dictionary with the reduced values for each region and each date.
- Return type:
See also
datesByBands: Reduce the data for each image in the collection by bands on a specific region.plot_doy_by_bands: Plot the reduced data for each image in the collection by bands on a specific region.plot_doy_by_regions: Plot the reduced data for each image in the collection by regions for a single band.
Examples
import ee, geetools
ee.Initialize()
- collection = (
ee.ImageCollection(“LANDSAT/LC08/C01/T1_TOA”) .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) .filterDate(“2014-01-01”, “2014-12-31”)
)
- regions = ee.FeatureCollection([
ee.Feature(ee.Geometry.Point(-122.262, 37.8719).buffer(10000), {“name”: “region1”}), ee.Feature(ee.Geometry.Point(-122.262, 37.8719).buffer(20000), {“name”: “region2”})
])
reduced = collection.geetools.datesByRegions(“B1”, regions, “name”, “mean”, 10000, “system:time_start”) print(reduced.getInfo())