Hi, today the script return all data and the error was not there… in any case, this is the script:
evalscript =’’’
//VERSION=3
function setup() {
return {
input: [“B01”,“B02”,“B03”,“B04”,“B05”,“B06”,“B07”,“B10”,“BQA”,“dataMask”],
output: [
{id:“coastal_blue”,bands:1,sampleType:“UINT16”},
{id:“blue”,bands:1,sampleType:“UINT16”},
{id:“green”,bands:1,sampleType:“UINT16”},
{id:“red”,bands:1,sampleType:“UINT16”},
{id:“NIR”,bands:1,sampleType:“UINT16”},
{id:“SWIR1”,bands:1,sampleType:“UINT16”},
{id:“SWIR2”,bands:1,sampleType:“UINT16”},
{id:“TIR”,bands:1,sampleType:“UINT16”},
{id:“NDVI”,bands:1,sampleType:“UINT16”},
{id:“NDMI”,bands:1,sampleType:“UINT16”},
{id:“cloud_cover”,bands:1,sampleType: “UINT16”},
{id: “dataMask”,bands:1,sampleType:“UINT8”}
],
};
}
function evaluatePixel(sample) {
return {
coastal_blue: [10000sample.B01],
blue: [10000sample.B02],
green: [10000sample.B03],
red: [10000sample.B04],
NIR: [10000sample.B05],
SWIR1: [10000sample.B06],
SWIR2: [10000sample.B07],
TIR: [sample.B10],
NDVI: [10000index(sample.B05,sample.B04)],
NDMI: [10000*index(sample.B05,sample.B06)],
cloud_cover: [sample.BQA],
dataMask: [sample.dataMask]
}
}
‘’’
stats_request = {
“input”: {
“bounds”: {“geometry”: poly,“properties”: {“crs”: f"http://www.opengis.net/def/crs/EPSG/0/{EPSG_code}"}},
“data”: [{“type”: “landsat-ot-l2”,“dataFilter”: {“mosaickingOrder”: “leastRecent”}}]
},
“aggregation”:{
“timeRange”:{“from”: f"{sd}T00:00:00Z",“to”: f"{ed}T00:00:00Z"},“aggregationInterval”:{“of”: “P1D”},
“evalscript”: evalscript,“resx”: 30,“resy”: 30
}
}
headers = {‘Content-Type’: ‘application/json’,‘Accept’: ‘application/json’}
url = “https://services-uswest2.sentinel-hub.com/api/v1/statistics”
response = oauth.request(“POST”, url=url , headers=headers, json=stats_request)
poly = {‘type’: ‘Polygon’,
‘coordinates’: [[[543524.2066699625, 4913672.475454833],
[543301.7360189715, 4914182.25130983],
[543585.5990637002, 4914305.715457292],
[543636.2003406108, 4914324.679479339],
[543636.5445322505, 4914324.827200528],
[543662.5099398704, 4914337.441878019],
[543662.6089071627, 4914337.491664552],
[543676.3631063607, 4914344.651227288],
[543678.5419234377, 4914345.355938862],
[543902.1623488602, 4913826.227753871],
[543524.2066699625, 4913672.475454833]]]}