Hi,
I’m trying following process api request:
from sentinelhub import (SentinelHubRequest,DataCollection,
MimeType, CRS, BBox, SHConfig,
MosaickingOrder,bbox_to_dimensions)
config = SHConfig()
bbox=BBox([451140,4931410,701140,5181410],crs="EPSG:32632")
resolution=100
size= bbox_to_dimensions(bbox, resolution=resolution) #2500x2500
time_interval=("2022-10-01","2022-10-15")
evalscript = """//VERSION=3
function setup() {
return {
input: [{bands: ["B02","B03","B04","B08","B8A","B11","CLM","dataMask"]}],
output: [{id: "ndmi",bands: 1,sampleType: SampleType.UINT8,noDataValue: 0},
{id: "ndsi",bands: 1,sampleType: SampleType.UINT8,noDataValue: 0},
{id: "ndvi",bands: 1,sampleType: SampleType.UINT8,noDataValue: 0},
{id: "rgb",bands: 3,sampleType: SampleType.UINT8,noDataValue: 0},
{id: "date",bands:1,sampleType:SampleType.UINT8,noDataValue: 0 }
],
mosaicking: Mosaicking.TILE
};
}
function evaluatePixel(samples, scenes, inputMetadata, customData, outputMetadata) {
// Your javascript code here
let b02=0, b03=0,b04=0, b08=0,b8a=0, b11=0, day=0;
for (let i=0;i<samples.length;i++){
if(samples[i].CLM!=1 && samples[i].dataMask!=0){
b02=samples[i].B02;
b03=samples[i].B03;
b04=samples[i].B04;
b08=samples[i].B08;
b8a=samples[i].B8A;
b11=samples[i].B11;
day=i+1
break;
}
}
outputMetadata.userData = { "metadata": scenes.tiles }
return {ndmi: [index(b8a,b11)*127+128],
ndsi: [index(b03,b11)*127+128],
ndvi: [index(b08,b04)*127+128],
rgb: [2.5*b04*255,2.5*b03*255,2.5*b02*255],
date:[day]
};
}"""
request = SentinelHubRequest(evalscript=evalscript,
input_data=[SentinelHubRequest.input_data(
data_collection=DataCollection.SENTINEL2_L1C,
time_interval=time_interval,
mosaicking_order=MosaickingOrder.MOST_RECENT,
)
],
responses=[SentinelHubRequest.output_response('ndmi', MimeType.TIFF),
SentinelHubRequest.output_response('ndsi', MimeType.TIFF),
SentinelHubRequest.output_response('ndvi', MimeType.TIFF),
SentinelHubRequest.output_response('rgb', MimeType.TIFF),
SentinelHubRequest.output_response('date', MimeType.TIFF),
SentinelHubRequest.output_response('userdata', MimeType.JSON)],
bbox=bbox,
size=size,
config=config,
)
data=request.get_data()
The first try failed with “Download rate hit” exception (I couldn’t find any spec on download rate limit)
The following tries keep failing with the following:
DownloadFailedException: Failed to download from:
https://services.sentinel-hub.com/api/v1/process
with HTTPError:
502 Server Error: Bad Gateway for url: https://services.sentinel-hub.com/api/v1/process
Server response: "502 Bad Gateway"
Could someone help me to understand why it keep failing?
Is it really a matter of download rate limit? If so what is this limit?
Any suggestion on preventing this throttling?
Thanks
Best regards