Coder Social home page Coder Social logo

Log scale about custom-scripts HOT 3 CLOSED

sentinel-hub avatar sentinel-hub commented on July 23, 2024
Log scale

from custom-scripts.

Comments (3)

mkadunc avatar mkadunc commented on July 23, 2024

You could try something like this:

   const min = 0.001;
   const max = 5;
   return [(Math.log(B04) - Math.log(min))/(Math.log(max) - Math.log(min))];

from custom-scripts.

geom16011 avatar geom16011 commented on July 23, 2024

Thanks for your answer.
for example i calculate this value
var R_443_560=B01/B03
var R_490_560=B02/B03
var MBR=Math.log10(Math.max(R_443_560,R_490_560))
var NDWI=(B03-B08)/(B03+B08)
var Med=Math.pow(10,(0.283-2.753MBR+1.457MBR2+0.659*MBR3-1.403*MBR**4))

And i want to show the values of Med with a logarithmic scale (however not changing the original values as caclulated from the script). Any ideas?

I was thinking using this function ColorGradientVisualizer.createWhiteGreen() but i would like to use logarithmic scale and not linear.

from custom-scripts.

mkadunc avatar mkadunc commented on July 23, 2024

You could just use the expression from argument of Math.pow in the visualizer (since log is inverse of pow).

const R_443_560 = B01/B03;
const R_490_560 = B02/B03;
const MBR = Math.log10(Math.max(R_443_560,R_490_560));
const NDWI = (B03-B08)/(B03+B08);
const logMed =   0.283
               - 2.753 * MBR
               + 1.457 * Math.pow(MBR,2) 
               + 0.659 * Math.pow(MBR,3)
               - 1.403 * Math.pow(MBR,4);

const minLog = Math.log10(0.01);
const maxLog = Math.log10(5);

return colorBlend(logMed,
                  [minLog, maxLog],
                  [[0, 0.5, 0], // dark green - minimum
                   [1,1,1]]); // white - maximum

from custom-scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.