Export
- class RadGEEToolbox.Export.ExportToDrive(input_data, description='export', folder=None, fileNamePrefix=None, scale=30, region=None, crs=None, maxPixels=10000000000000.0, fileFormat='GeoTIFF', name_pattern='{date}', date_pattern='YYYY-MM-dd', **kwargs)
Bases:
objectA class to handle exporting Earth Engine images and image collections to Google Drive.
This class supports exporting both native Earth Engine objects (ee.Image, ee.ImageCollection) and RadGEEToolbox objects (e.g., LandsatCollection, Sentinel2Collection).
It is designed to intelligently handle RadGEEToolbox collections by utilizing their cached .dates property for naming files, ensuring readable filenames (e.g., ‘MyExport_2023-06-01’) instead of long system IDs.
IMPORTANT: After creating an instance of this class, you must call the export() method to initiate the export process.
For example, to export a RadGEEToolbox collection: ```python
collection = LandsatCollection(…) # Assume this is a RadGEEToolbox object exporter = ExportToDrive(
input_data=collection, description=”Landsat_Export”, folder=”GEE_Exports”, scale=30, name_pattern=”{date}”,
) exporter.export()
- Parameters:
input_data (ee.Image, ee.ImageCollection, or RadGEEToolbox object) – The data to export. Can be a single image, a collection, or a RadGEEToolbox wrapper object.
description (str) – A description of the export task. This serves as the task name in the GEE code editor and the default prefix for filenames. Defaults to ‘export’.
folder (str, optional) – The name of the destination folder in Google Drive. Defaults to None (root).
fileNamePrefix (str, optional) – The filename prefix. For collections, this is prepended to the generated unique name. If None, it defaults to the description.
scale (int) – The resolution in meters per pixel. Defaults to 30.
region (ee.Geometry, optional) – The region/geometry to export. Defaults to None (uses image footprint).
crs (str, optional) – The coordinate reference system (e.g., ‘EPSG:4326’). Defaults to None (uses image CRS).
maxPixels (int, optional) – The maximum number of pixels allowed in the export. Defaults to 1e13.
fileFormat (str, optional) – The output file format (e.g., ‘GeoTIFF’, ‘TFRecord’). Defaults to ‘GeoTIFF’.
name_pattern (str, optional) –
A string pattern for naming files when exporting a collection. Supported placeholders:
- {date}: The date of the image. Prioritizes the RadGEEToolbox cached ‘.dates’ list,
then ‘Date_Filter’ property, then formatted ‘system:time_start’.
{id}: The system:index of the image.
Defaults to ‘{date}’. The final filename will generally be “{fileNamePrefix}_{name_pattern}”.
date_pattern (str, optional) – The date format string to use if falling back to ‘system:time_start’ (e.g., ‘YYYY-MM-dd’). Defaults to ‘YYYY-MM-dd’.
**kwargs – Additional keyword arguments passed directly to ee.batch.Export.image.toDrive (e.g., ‘formatOptions’, ‘shardSize’).
- Raises:
ValueError – If the input data type is not supported or if required arguments (like scale) are missing/invalid.
- export()
Initiates the export process. Detects whether to run a single task or iterate through a collection.