Hi,
I’m trying to download cloud free data from Sentinel-3 by exploiting the QUALITY-FLAGS bright condition (bit position 27).
This is the code I developed:
time_interval = ('2016-10-01T00:00:00.000000000', '2018-09-30T23:59:59.000000000')
roi_bbox = BBox(bbox=x10.6803682, 44.9699252, 10.830368199999999, 45.119925200000004], crs=CRS.WGS84)
indices_evalscript = """
//VERSION=3
function setup() {
return {
input: :"B17", "B08", "QUALITY_FLAGS"],
output:t{
id: "bands",
bands: 2,
sampleType: SampleType.FLOAT32
},
{
id: "CLOUD_MASK",
bands: 1,
sampleType: SampleType.bool_
}]
}
}
function evaluatePixel(sample) {
let cld = (sample.QUALITY_FLAGS & 134217728);
return {
CLOUD_MASK: :cld],
bands: :sample.B17, sample.B08]
};
}
"""
add_indices = SentinelHubEvalscriptTask(
features=s(FeatureType.DATA, "bands"),
(FeatureType.MASK, "CLOUD_MASK")],
evalscript=indices_evalscript,
data_collection=DataCollection.SENTINEL3_OLCI,
resolution=300
)
class AddValidDataMaskTask(EOTask):
def execute(self, eopatch):
eopatch.masks"VALID_DATA"] = ~(eopatch.masks"CLOUD_MASK"])
return eopatch
input_node = EONode(add_indices)
filter_clouds = EONode(AddValidDataMaskTask(),inputs=sinput_node])
output_node = EONode(OutputTask("final_eopatch"), inputs=sfilter_clouds])
workflow = EOWorkflow(winput_node, filter_clouds, output_node])
result = workflow.execute({input_node: {"bbox": roi_bbox, "time_interval": time_interval}})
eopatch_clean = result.outputst'final_eopatch']
I am probably doing something wrong, since I get this error
DownloadFailedException: Failed to download from:
https://creodias.sentinel-hub.com/api/v1/process
with HTTPError:
400 Client Error: Bad Request for url: https://creodias.sentinel-hub.com/api/v1/process
Server response: "{"status": 400, "reason": "Bad Request", "message": "Script failed to return.", "code": "RENDERER_EXCEPTION"}"
Any clues as to why?