Floating algae monitoring with S-2 and S-3

Hello,
for a school project on Guadeloupe we process images to MCI (max.chloroph. index) and FAI (floating algae index) to b/w and color images.
Question: how to get the histogram and the color points. At the moment I export the file (32bit) to read in SNAP and do the job there, using the result in a simple script in EO-Browser
We also need a cloud detector. I applied sucessfully the Braaten-Cohen-Yang cloud detector (found in your excellent forum and I replaced the return to get the Indexes directly. However I would like to understand the script language. Is there any manual or book about (for rather beginners)?
Many thanks

I suggest you start with this tutorial:
https://www.sentinel-hub.com/explore/education/custom-scripts-tutorial
and this

For histogram you will have to use our Statistical info service:
https://www.sentinel-hub.com/develop/documentation/api/fis-request

Dear gmilcinski,
many thanks for all that wealth of information. I have now quite a lot to study. All useful stuff, well done.
Concerning the cloud-detection. What I am looking for is a cloud-mask. The Braaten-Cohen-Yang cloud detector worked well for Sentinel-2. Fine. But I would like one for Sentinel-3. I replaced all bands of S-2 with the corresponding S-3 spectral bands, (B08,B06,B04), but B11 by B17 (which might be critical) , but after “Refresh” there was no response (see below) from the processor. Remark: In some other cases of using script the one-band image appears totally white or totally black. In the first case there should be a kind of an error-message and in the other two other cases the processor seems not able to be able to scale the image (for one band only). Is there any room for improvements? Do you have a suggestion for a S-3 cloud detector or a hint to find one?
Thanks again.

S-2 cloud detector adapted for S-3
(not working – using corresp. bands but B11 replaced by B17!!)

function index(x, y) {

return (x - y) / (x + y);

}

function clip(a) {

return Math.max(0, Math.min(1, a));

}

let bRatio = (B06 - 0.175) / (0.39 - 0.175);

let NDGR = index(B06, B08);

let gain = 2.5;

if (B17>0.1 && bRatio > 1) { //cloud

var v = 0.5*(bRatio - 1);

return [0.5*clip(B08), 0.5*clip(B06), 0.5*clip(B04) + v];

}

if (B17 > 0.1 && bRatio > 0 && NDGR>0) { //cloud

var v = 5 * Math.sqrt(bRatio * NDGR);

return [0.5 * clip(B8) + v, 0.5 * clip(B06), 0.5 * clip(B04)];

}

return [B08, B06, B04].map(a => gain * a);





ORIGINAL S-2 detector:

function index(x, y) {

return (x - y) / (x + y);

}

function clip(a) {

return Math.max(0, Math.min(1, a));

}

let bRatio = (B03 - 0.175) / (0.39 - 0.175);

let NDGR = index(B03, B04);

let gain = 2.5;

if (B11>0.1 && bRatio > 1) { //cloud

var v = 0.5*(bRatio - 1);

return [0.5*clip(B04), 0.5*clip(B03), 0.5*clip(B02) + v];

}

if (B11 > 0.1 && bRatio > 0 && NDGR>0) { //cloud

var v = 5 * Math.sqrt(bRatio * NDGR);

return [0.5 * clip(B04) + v, 0.5 * clip(B03), 0.5 * clip(B02)];

}

return [B04, B03, B02].map(a => gain * a);

The Braaten-Cohen-Yang cloud detector is a model fine-tuned to Sentinel-2 data and it would be unrealistic to expect that it will work with other missions in the same way.

I am currently not familiar with Sentinel-3 cloud detection algorithm, but it would certainly be nice to find one.
Hopefully someone else in the forum will be able to help.