Batch Processing in Python

I am using code that i mentioned below for batch processing in python. I want to export tiles to folder path in bucket in this code but it does not work in any way. I tried default_tile_path, tile_path, bucket_folder etc. How can i insert folder path into batch request?

BUCKET_NAME = "bucket"
BUCKET_FOLDER = "2023/03-1/"
sentinelhub_request = SentinelHubRequest(
    evalscript=evalscript,
    input_data=[
        SentinelHubRequest.input_data(
            data_collection=DataCollection.SENTINEL2_L2A,
            time_interval=time_interval,
        )
    ],
    responses=[
        SentinelHubRequest.output_response("default", MimeType.TIFF),
    ],
    geometry=full_geometry,
    config=config,
)

batch_request = batch.create(
    sentinelhub_request,
    tiling_grid=SentinelHubBatch.tiling_grid(grid_id=GRID_ID, resolution=10),
    bucket_name=BUCKET_NAME,
    tile_path=BUCKET_FOLDER, (does not work)
    description=""
)
batch_request

Hello Hakan Zeybel,

For the batch request, one of the two parameters should be given: bucket_name or output. tile_path is not one of the accepted parameters.

To export all your tiles in a folder in your bucket, you can remove the bucket_name parameter and use output instead.

batch_request = batch.create(
    sentinelhub_request,
    tiling_grid=SentinelHubBatch.tiling_grid(grid_id=GRID_ID, resolution=10),
    output = SentinelHubBatch.output(default_tile_path = "s3://<BUCKET_NAME>/<FOLDER_NAME>/<tileName>.tif")
    description=""

The BUCKET_NAME and FOLDER_NAME must be replaced by the name of your S3 bucket and the folder you wish to create in the bucket, but the <tileName> should be left as is so that it can be replaced by the actual tile name while downloading the data. You can find naming convention and other parameters to be set here.

Hope this answers your question. Do let me know if you need further help.

Cheers,
Megha

1 Like

i thought i tried it before but i used bucket_name also in this code. It worked now, thanks for your help

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.