Hi,
I have requested several products with the TPDI API and I am now deriving NDVI using the Process API with the following code:
response = oauth.post('https://services.sentinel-hub.com/api/v1/process',
json={
"input": {
"bounds": {
"bbox": geom
},
"data": [{
"type": collection,
"dataFilter": {
"timeRange": {dates
}
}
}]
},
# Set size of image resx and resy parameters can be used too
"output": {
"width": 512,
"height": 512
},
"evalscript": """
//VERSION=3
function setup() {
return {
input: ["Red", "NIR", "dataMask"],
output: {
bands: 4
}
};
}
function evaluatePixel(sample) {
var NDVI = index(sample.NIR , sample.Red)
return valueInterpolate(NDVI,
[0.0, 0.3, 1.0],
[
[1, 0, 0, sample.dataMask],
[1, 1, 0, sample.dataMask],
[0.1, 0.3, 0, sample.dataMask],
])
}
"""
})
I get a 200 resopnse code and when exploring the response.content I get a very long string.
Using the code bellow, I can plot the content:image = Image.open(BytesIO(response.content))
but I only get one NDVI visualized. My request for NDVI was for several images, so my doubt is how should I proceed with the response from the Process API in order to access all the outputs. I have tried looking for some kind of separator in the response but nothing clear so far
Thks!!
