AWS S3 ====== This example demonstrates how to use the Earth Data Kit to stitch together a collection of S3 files. .. code-block:: python import earth_data_kit as edk import geopandas as gpd import datetime # Initialize the Dataset using the S3 engine. dataset_id = "example_s3_dataset" # Replace the bucket name and path with your actual S3 location. source = "s3://your-bucket-name/path/to/data" engine = "s3" ds = edk.stitching.Dataset(dataset_id, source, engine) # Set the temporal bounds for the dataset (e.g., using January 2017 as an example) start_date = datetime.datetime(2017, 1, 1) end_date = datetime.datetime(2017, 1, 31) ds.set_timebounds(start_date, end_date) # Define the spatial bounding box (min_lon, min_lat, max_lon, max_lat) bbox = (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822) # Specify the grid file that maps the dataset's grid system (e.g., a KML file) grid_file = "path/to/grid/file.kml" grid_df = gpd.read_file(grid_file) ds.set_spacebounds(bbox, grid_df) # Discover the available scene files within the defined spatial and temporal bounds. ds.discover() # Retrieve and display the list of available bands from the dataset. available_bands = ds.get_bands() print("Discovered bands:", available_bands) # Optionally, configure GDAL options (e.g., setting the target spatial reference). ds.set_target_options({ "-t_srs": "EPSG:3857", }) # Define the ordered list of band descriptions you wish to stitch together. bands = ["red", "green", "blue"] # Create the stitched VRTs from the provided S3 data. ds.mosaic(bands) # This returns a dataarray with the stitched bands da = ds.to_dataarray()