Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SkySat scripts #309

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Update SkySat scripts #309

wants to merge 4 commits into from

Conversation

zcernigoj
Copy link
Contributor

@zcernigoj zcernigoj commented Apr 10, 2024

Updated / added the NDVI scripts

  • cleaned up script.jswhich contains "normal" visualization without additional outputs needed for EO Browser statistics and histogram
  • added eob.js which contains additional outputs needed for EO Browser statistics and histogram
  • added raw.js which just outputs raw NDVI values


function evaluatePixel(sample) {
let NDVI = index(sample.NIR, sample.Red);
const indexVal = sample.dataMask === 1 ? NDVI : NaN;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would mask infinite value as well. For example:

const indexVal = isFinite(NDVI) && sample.dataMask === 1 ? NDVI : NaN;

Copy link
Contributor

@chorng chorng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some comments for minor changes

function evaluatePixel(sample) {
let NDVI = index(sample.NIR, sample.Red);
const indexVal = sample.dataMask === 1 ? NDVI : NaN;
let id_default = valueInterpolate(NDVI,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the dataMask in the valueInterpolate and include the dataMask later. In this case we can avoid repeatation.

);

return {
default: id_default,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include dataMask as the following:

default: id_default.concat(sample.dataMask),


function setup() {
return {
input: ["Red", "NIR", "dataMask"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dataMask can be removed

var NDVI = index(sample.nir, sample.red)
return valueInterpolate(NDVI,
let NDVI = index(sample.NIR, sample.Red);
let id_default = valueInterpolate(NDVI,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the eob script. I would remove the dataMask from valueInterpolate function and include dataMask later

]);

return {
default: id_default,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return {
    default: id_default.concat(sample.dataMask),
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants