Skip to main content

Hi,
I’ve noticed that since the migration to new version, when I open saved links, that lead to v2 scripts the browser prints “Failed to load instances” and afterward the buttons for image generation do not work (prints “There was a problem downloading image” in the Analytical submenu).
Because of this I am really eager to get going with the V3 scripts, but am sort of a newbie in this, and would like to ask if you can tell me if math expressions are available, and if so how to work with them?
Maybe you can give an example or convert this old version script to the new version?

return Math.sqrt(0.55 * (B04+B03+(-B12))/2 - 0.018)*2.25,
Math.sqrt(0.55 * (B02+B01+(-B10))/2 - 0.014)*2.25]

P.S.
My user profile now tells me that “Your SH account has expired.” Does it mean that from now on SentinelHub will become a paid only service for the public?

Thank you

Hey,

It seems that your Sentinel Hub account is expired. You need one if you want to use these custom configuration options of the EO Browser. We kindly invite you to subscribe to one of the Sentinel Hub packages or apply for free R&D subscription.

Concerning your question about v3 evalscripts. Yes, math expressions also work in v3 scripts. You can read more on how v3 scripts work here.
In short: You always need 2 functions (setup, evaluatePixels). Translated your script above (which is basic) to v3 would look like:

//VERSION=3
function setup() {
return {
input: ["B01", "B02", "B03", "B04", "B10", "B11", "B12"],
output: { bands: 3 }
};
}

function evaluatePixel(sample) {
return [
Math.sqrt(0.55 * (sample.B12+sample.B11+(-sample.B11))/2 - 0.018)*2.25,
Math.sqrt(0.55 * (sample.B04+sample.B03+(-sample.B12))/2 - 0.018)*2.25,
Math.sqrt(0.55 * (sample.B02+sample.B01+(-sample.B10))/2 - 0.014)*2.25
]
}

To convert your v1/v2 evalscripts you can also use a processing API for an automatic conversion.

Best


Hi! Thank you for the answer and explanations!


Reply