custom-scripts icon indicating copy to clipboard operation
custom-scripts copied to clipboard

Can anyone help me to isolate any of the indicators one by one? Se2WaQ

Open albertofrance opened this issue 3 years ago • 0 comments

Hi, herewith down this post is the complete script for analysing all 6 indicators Se2WaQ (Sentinel-2 Water Quality Script), Could anybody help me to isolate the script for anyone of them? Im afraid my knowledge in scripting is still very basic,

I really appreciate it! Alberto geovisualization.net

var FLAGparam = 4; var FLAGbackGround = 2;

var Black = [0]; // FLAGbackGround = 0 //var NDVI = index(B08, B04); // FLAGbackGround = 1 var NDVI = 1; var NDWI = index(B03, B08); var TrueColor = [B042.5, B032.5, B022.5]; // FLAGbackGround = 2 var Chl_a = 4.26 * Math.pow(B03/B01, 3.94); // FLAGparam = 0; S2-L2A; [1] Unit: mg/m2;
var Cya = 115530.31 * Math.pow(B03 * B04 / B02, 2.38); // FLAGparam = 1; S2-L2A; [1] Unit: 10^3 cell/ml; var Turb = 8.93 * (B03/B01) - 6.39; // FLAGparam = 2; S2-L2A; [1] Unit: NTU;
var CDOM = 537 * Math.exp(-2.93
B03/B04); // FLAGparam = 3; S2-L1C; [2] Unit: mg/l;
var DOC = 432 * Math.exp(-2.24B03/B04); // FLAGparam = 4; S2-L1C; [2] Unit: mg/l;
var Color = 25366 * Math.exp(-4.53
B03/B04); // FLAGparam = 5; S2-L1C; [2] Unit: mg.Pt/l;

var scaleChl_a = [0, 6, 12, 20, 30, 50]; var scaleCya = [0, 10, 20, 40, 50, 100]; var scaleTurb = [0, 4, 8, 12, 16, 20]; var scaleCDOM = [0, 1, 2, 3, 4, 5]; var scaleDOC = [0, 5, 10, 20, 30, 40]; var scaleColor = [0, 10, 20, 30, 40, 50];

var s = 255; var colorScale = [ [73/s, 111/s, 242/s], [130/s, 211/s, 95/s], [254/s, 253/s, 5/s], [253/s, 0/s, 4/s], [142/s, 32/s, 38/s], [217/s, 124/s, 245/s] ];

if (NDWI<0) { if ( FLAGbackGround == 0 ) { return Black; } else if ( FLAGbackGround == 1 ) { return [0, .5*(NDVI+1), 0]; } else if ( FLAGbackGround == 2 ) { return TrueColor; } } else { switch ( FLAGparam ) { case 0: return colorBlend(Chl_a, scaleChl_a, colorScale); break; case 1: return colorBlend(Cya, scaleCya, colorScale); break; case 2: return colorBlend(Turb, scaleTurb, colorScale); break; case 3: return colorBlend(CDOM, scaleCDOM, colorScale); break; case 4: return colorBlend(DOC, scaleDOC, colorScale); break; case 5: return colorBlend(Color, scaleColor, colorScale); break; default: return TrueColor; } }

albertofrance avatar Jul 21 '22 07:07 albertofrance