Download Failed Exception

Hello, I’m having this recurring problem with downloads from images of some cities in brazil. Some of them works but some other showing me this error:

DownloadFailedException: Failed to download from: https://services.sentinel-hub.com/api/v1/process with ReadTimeout: HTTPSConnectionPool(host=‘services.sentinel-hub.com’, port=443): Read timed out. (read timeout=360) There might be a problem in connection or the server failed to process your request. Please try again.

Hi @ti.desenv.integrada ,

Could you please provide the request that has the error repeatedly?

Thank you!

Hello, @chung.horng.
Our request is:
def faz_download(self,path):
trueColorReturn = self.requestImage.get_data(save_data=True)
self.all_responses = [path+d for d in os.listdir(path) if os.path.isdir(os.path.join(path, d)) if d!=“pycache”]

with these example coordinates:

"city: Maracaí":{
"upper latitude":-22.8053252314144
"lower latitude":-22.509617464422895
"upper longitude":-50.98212973762929
"lower longitude":-50.51383424687549
.
I’m trying to get images fortnightly in a year and sometimes it gives an error at the beginning, sometimes at the end.

Hi @ti.desenv.integrada ,

It would be better to share the request body and the evalscript which has the error. The easiest way is to make a request using Requests Builder can copy the curl command of problematic requests generated by the Requests Builder from the Request Preview window (see Fig 1) to me.


Fig 1

We’re currently using the python API to make the requests.
The script is shown below

    evalscript_true_color = """
    //VERSION=3
    function setup() {
        return {
            input: [{
                bands: ["B02", "B03", "B04", "B05", "B06", "B07", "B08", "CLM", "SCL"]
            }],
            output: {
                bands: 9
            }
        };
    }

    function evaluatePixel(sample) {
        return [sample.B04, sample.B03, sample.B02, sample.B08, sample.B05, sample.B06, sample.B07, sample.CLM, sample.SCL];
    }
    """

    self.json_request = {
        "input": {
            "bounds": {
            "bbox": self.coords_limit
            },
            "data": [
            {
                "dataFilter": {
                "timeRange": {
                    "from": self.startDate+"T00:00:00Z",
                    "to": self.endDate+"T23:59:59Z"
                },
                'mosaickingOrder': 'leastCC',
                },
                "type": "sentinel-2-l2a"
            }
            ]
        },
         "output": {
            'width': self.regionToDownloadSize[0],
            'height': self.regionToDownloadSize[1],
            "responses": [
            {
                "identifier": "default",
                "format": {
                "type": "image/tiff"
                }
            }
            ]
        },
        "evalscript": evalscript_true_color
        }
    
    self.requestImage = SentinelHubRequest(
        data_folder = path,
        evalscript = evalscript_true_color,
        input_data = [
            SentinelHubRequest.input_data(
                data_collection = DataCollection.SENTINEL2_L2A,
                time_interval = (self.startDate, self.endDate),
                mosaicking_order = 'leastCC'
            )
        ],
        responses = [
        SentinelHubRequest.output_response('default', MimeType.TIFF)
        ],
        bbox = self.BBoxToDownload,
        size = self.regionToDownloadSize,
        config = config
    )

after the request is made, we’re applying the function self.requestImage.get_data(save_data=True).
the issue is that we keep getting a timeout error, but this error appear in different times, even with the same entry parameters like the bounding box coordinates and time interval,
and there is plenty of available processing units in our account.

For example, using the bounding box coordinates like -50.8138002863102,-23.375325558502,-50.46507130589259,-23.014571727683297, and time interval from 01-01-2021 to 15-01-2021 (just an example, the dates are in valid formats), when executed, the error can still appear.

Hi @ti.desenv.integrada ,

Could you please provide all entry parameters of your request that led to timeout constantly? This could let us reproduce the error and help us investigate what’s happening.

Thank you.

the only missing entry parameter was self.regionToDownloadSize = bbox_to_dimensions(self.BBoxToDownload, resolution=resToDownload)
that we got using the bbox mentioned above, all the other entry parameters were cited on my last reply.

resToDownload is set to be the minimum resolution available using
self.BBoxToDownload = BBox(bbox=coordToDownload, crs=CRS.WGS84)
for resToDownload in range(10,150):

        self.regionToDownloadSize = bbox_to_dimensions(self.BBoxToDownload, resolution=resToDownload)
        
        if self.regionToDownloadSize[0] <= 2500 and self.regionToDownloadSize[1] <= 2500:
            break

Hi @ti.desenv.integrada ,

I tried to reproduce your request with the following code:

evalscript = """
//VERSION=3
    function setup() {
        return {
            input: [{
                bands: ["B02", "B03", "B04", "B05", "B06", "B07", "B08", "CLM", "SCL"]
            }],
            output: {
                bands: 9,
                sampleType: SampleType.FLOAT32
            }
        };
    }

    function evaluatePixel(sample) {
        return [sample.B04, sample.B03, sample.B02, sample.B08, sample.B05, sample.B06, sample.B07, sample.CLM, sample.SCL];
    }
"""
bbox = BBox(bbox=[-50.8138002863102, -23.375325558502, -50.46507130589259, -23.014571727683297], crs=CRS.WGS84)

request = SentinelHubRequest(
    evalscript=evalscript,
    input_data=[
        SentinelHubRequest.input_data(
            data_collection=DataCollection.SENTINEL2_L2A,          
            time_interval=('2020-01-01', '2020-01-15'),          
            other_args={"dataFilter": {"mosaickingOrder": "leastCC"}}
        ),
    ],
    responses=[
        SentinelHubRequest.output_response('default', MimeType.TIFF),
    ],
    bbox=bbox,
    size=[2101.7904259241554, 2362.2901616741383],
    config=config
)

response = request.get_data()

The request always works and never ends up a timeout exception. I would suggest making sure the internet connection stable when making requests. If you still keep getting timeout exceptions, please provide the exact request that repeatedly leads to a timeout exception.

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