environmentaltools.download.download_sentinel2_images

environmentaltools.download.download_sentinel2_images(config: dict[str, Any]) dict[str, int][source]

Download time series of Sentinel-2 imagery with vegetation indices.

Main function that orchestrates the complete download workflow: initialization, collection creation, and batch downloading of images.

Parameters:

config (dict) – Configuration dictionary containing: - project_id (str): Google Earth Engine project ID - study_area_coords (list): Coordinates defining the study area polygon - output_directory (str or Path): Directory for output files - scale (int, optional): Spatial resolution in meters. Default: 10 - start_date (str, optional): Start date ‘YYYY-MM-DD’. Default: “2015-01-01” - end_date (str, optional): End date ‘YYYY-MM-DD’. Default: “2024-01-01” - cloud_percentage (float, optional): Max cloud cover %. Default: 15.0

Returns:

Summary statistics with keys:
  • successful (int): Number of successful downloads

  • failed (int): Number of failed downloads

  • total (int): Total number of images processed

Return type:

dict

Raises:
  • RuntimeError – If Earth Engine initialization fails.

  • ValueError – If no images match the filtering criteria.

Example

>>> config = {
...     'project_id': 'my-gee-project',
...     'study_area_coords': [[[-6.1, 36.8], [-6.0, 36.8], ...]],
...     'output_directory': './satellite_images',
...     'scale': 10,
...     'start_date': '2020-01-01',
...     'end_date': '2020-12-31',
...     'cloud_percentage': 10.0
... }
>>> results = download_sentinel2_images(config)
>>> print(f"Downloaded {results['successful']} images")