// Sentinel-1 False-Color Visualization V1.0.0// Twitter: Pierre Markuse (@pierre_markuse)// Website: https://pierre-markuse.net/// CC BY 4.0 International - https://creativecommons.org/licenses/by/4.0/functionstretch(val,min,max){return(val-min)/(max-min);}functionsatEnh(rgbArr){varavg=rgbArr.reduce((a,b)=>a+b,0)/rgbArr.length;returnrgbArr.map(a=>avg*(1-saturation)+a*saturation);}varBLUE=[0.0,0.2,1.0];varGREEN=[0.0,0.7,0.0];varBLACK=[0.0,0.0,0.0];varRED=[1.0,0.0,0.0];varwater_normal=[stretch(VV*1,0.0,0.99),stretch(VV*8,0.0,0.99),0.5+VV*3+stretch(VH*2000,0.0,0.99)];varwater_bright=[stretch(VV*1.33,0.0,0.99),stretch(VV*10,0.0,0.99),0.5+VV*4+stretch(VH*3000,0.0,0.99)];varoilspill_1=[stretch(VV*5.0,0.2,0.99),0.0+stretch(VV*10,0.10,0.50),0.0+stretch(VV*20,0.10,0.50)];varoilspill_2=[stretch(VV*5.0,0.2,0.99),0.0+stretch(VV*10,0.15,0.40),0.1+stretch(VV*20,0.15,0.40)];varoilspill_3=[stretch(VV*5.0,0.2,0.99),0.1+stretch(VV*11,0.03,0.60),0.1+stretch(VV*23,0.01,0.58)];varland_redder=[stretch(VV*3.4,-0.0,0.99),(stretch(VV*1.1,-0.0,0.99)+stretch(VH*8.75,-0.0,0.99)),stretch(VH*1.75,-0.0,0.99)];varland_normal=[stretch(VV*3.0,-0.0,0.99),(stretch(VV*1.1,-0.0,0.99)+stretch(VH*8.75,-0.0,0.99)),stretch(VH*1.75,-0.0,0.99)];varland_greener=[stretch(VV*3.0,-0.0,0.99),(stretch(VV*1.4,-0.0,0.99)+stretch(VH*9.75,-0.0,0.99)),stretch(VH*1.75,-0.0,0.99)];varcity=[0.9-VV-2*VH,0.9-VV-3*VH,0.9-0.3*VV-6*VH];varwatervis=water_normal;varlandvis=land_normal;varwater_threshold=25;//lower means more watervarsaturation=1.0;//Standard 1.0varbrightness=1.0;//Standard 1.0varavoid_dark_land=0;//0=off,1=onvaravoid_dark_land_threshold=0.1;//Standard 0.05varavoid_dark_water=0;//0=off,1=onvaravoid_dark_water_threshold=1.00;//Standard 1.00varmanualCorrection_water=[0.00,0.00,0.00];varmanualCorrection_land=[0.00,0.00,0.00];vari=0;while(i<3){watervis[i]=watervis[i]+manualCorrection_water[i];landvis[i]=landvis[i]+manualCorrection_land[i];landvis[i]=landvis[i]*brightness;i++;};varwatervis=satEnh(watervis);varlandvis=satEnh(landvis);if(avoid_dark_land){vardark=landvis[0]+landvis[1]+landvis[2];if(dark<avoid_dark_land_threshold){varlandvis=BLUE;};//Try other things than BLUE!};if(avoid_dark_water){vardark=watervis[0]+watervis[1]+watervis[2];if(dark<avoid_dark_water_threshold){varwatervis=BLUE;};//Try other things than BLUE!};return((VV/VH)>water_threshold)?watervis:landvis;
This script offers different false color visualizations and the ability to easily add more visualizations. Variables allow you to influence the resulting image regarding the content you would like to point out. More info here.