Downloading image Pleiades from third party with size 145 bytes

Hello, good morning. I put this post in the forum because recently when downloading an image using python request it does not download well even if the query is well created.

This is the query

{‘input’: {‘bounds’: {‘properties’: {‘crs’: ‘http://www.opengis.net/def/crs/EPSG/0/4326’},
‘bbox’: [35.93360430260824, 35.250857571893675, 35.941400182082255, 35.25644736415403]},
‘data’: [{‘type’: ‘byoc-b0eaa136-0648---************’,
‘dataFilter’: {‘timeRange’: {
‘from’: ‘2021-05-20T00:00:00.000000Z’, ‘to’: ‘2021-05-22T00:00:00.000000Z’}}}]},
‘output’: {‘width’: 2048, ‘height’: 1798,
‘responses’: [{‘identifier’: ‘default’, ‘format’: {‘type’: ‘image/tiff’, ‘quality’: 100}}]},
‘evalscript’: ‘\n //VERSION=3\n function setup() {\n return {\n input: [“B0”, “B1”, “B2”, “B3”, “PAN”],\n output: { bands: 4 }\n };\n }\n let minVal = 0.0;\n let maxVal = 3000;\n let viz = new DefaultVisualizer(minVal, maxVal);\n function evaluatePixel(samples) {\n let sudoPanW = (samples.B1 + samples.B2 + samples.B0) / 3;\n let ratioW = samples.PAN / sudoPanW;\n let ndwi = (samples.B1 - samples.B3) / (samples.B1 + samples.B3);\n let val = [samples.B2 * ratioW, samples.B1 * ratioW, samples.B0 * ratioW, ndwi];\n return viz.processList(val);\n }’}

There are times when the image can not be opened because it has a weight of 145 bytes (when it should weigh more). In this case it has happened to me in 2 different ways, the first one that only happens from time to time if I try to make the download recurrently but the other way of the error is to make the download repeatedly but in all the weight of the image is 145 bytes.

And I wanted to ask: Has anyone else had this happen to you / Is it a known error?

Just in case I put the code of how the request is being done:

    url = "https://services.sentinel-hub.com/api/v1/process"
    headers = {'content-type': 'application/json', 'Authorization': 'Bearer ' + token}
    response = requests.post(url, data=json.dumps(query), headers=headers)

Hi @seda.defensa ,

The error comes from the quotation marks used in the evalscript for input bands. I’ve edited your request with the right quotation marks so you can copy it and make your request.

{
  "input": {
    "bounds": {
      "bbox": [
        35.93360430260824,
        35.250857571893675,
        35.941400182082255,
        35.25644736415403
      ]
    },
    "data": [
      {
        "dataFilter": {
          "timeRange": {
            "from": "2021-05-20T00:00:00.000000Z",
            "to": "2021-05-22T00:00:00.000000Z"
          }
        },
        "type": "byoc-b0eaa136-0648-4d63-9601-************"
      }
    ]
  },
  "output": {
    "width": 512,
    "height": 343.697,
    "responses": [
      {
        "identifier": "default",
        "format": {
          "type": "image/jpeg"
        }
      }
    ]
  },
  "evalscript": "//VERSION=3\n function setup() {\n return {\n input: [\"B0\", \"B1\", \"B2\", \"B3\", \"PAN\"],\n output: { bands: 4 }\n };\n }\n let minVal = 0.0;\n let maxVal = 3000;\n let viz = new DefaultVisualizer(minVal, maxVal);\n function evaluatePixel(samples) {\n let sudoPanW = (samples.B1 + samples.B2 + samples.B0) / 3;\n let ratioW = samples.PAN / sudoPanW;\n let ndwi = (samples.B1 - samples.B3) / (samples.B1 + samples.B3);\n let val = [samples.B2 * ratioW, samples.B1 * ratioW, samples.B0 * ratioW, ndwi];\n return viz.processList(val);}\n"
}

We also hide your byoc collection id so others cannot access the data you purchased. Please be careful when sharing codes since it may contain your sensitive information.

Hi, thanks for the quick reply. I mean the problem is that sometimes it downloads well and sometimes badly with the same code. Is this only due to the inverted commas ?

Thank you, seda.defensa