1

I am trying to implement this custom script for flood mapping in EO Browser. I have added the datasets using the additional datasets button, and specified the required timelines, but I keep getting the error:

Dataset with id: 0 not found.

I have followed the instructions in this answer, yet the error persists.

Below is the code;

//VERSION=3 (auto-converted from 1)
// Date Definition
var beforeflood_date = "2019-03-11";
var duringflood_date = "2019-03-23"; // Flood in Northern Nigeria

// Selection of polarization
function setup() {
    return {
        input: [
            {
                bands: ["VV"],
            },
        ],
        output: {bands: 3},
        mosaicking: "ORBIT",
    };
}

function preProcessScenes(collections) {
    var allowedDates = [beforeflood_date, duringflood_date]; // set dates for before-and-during flood analysis
    collections.scenes.orbits = collections.scenes.orbits.filter(function(orbit) {
        var orbitDateFrom = orbit.dateFrom.split("T")[0];
        return allowedDates.includes(orbitDateFrom);
    });
    return collections;
}

// Flood mapping
function calcFM(sample) {
    var outvv = sample.VV;
    return [1.5 * outvv];
}

function dateformat(d) {
    var dd = d.getDate();
    var mm = d.getMonth() + 1;
    var yyyy = d.getFullYear();
    if (dd < 10) {
        dd = "0" + dd;
    }
    if (mm < 10) {
        mm = "0" + mm;
    }
    var isodate = yyyy + "-" + mm + "-" + dd;
    return isodate;
}

function evaluatePixel(samples, scenes) {
    var outbe = 0;
    var outdu = 0;
    // before-flood image
    outbe = calcFM(samples[1]);
    // during-flood image
    outdu = calcFM(samples[0]);
    return [outbe, outdu, outdu];
    // ************************************
    // mask creation
    // var dout = outbe - outdu;
    // return [dout > 0.05 ?  1 : 0]
    // ************************************
}

I have attached below screenshots of my timespan specification, and the datasets I selected. What could I be doing wrong?

timespan dataset 1 dataset 2

1 Answer 1

0

For this script you do not need the Use additional datasets option.

Instead, specify the time range at the top using the Timespan button and pay attention that you only specify dates in the code which are actually available for your area of interest. You can see which dates are available in the calendar where you specify your timerange. All dates which have a gray background have data.

Here's an example that worked: https://sentinelshare.page.link/VJ91

And here's how the settings look like:

enter image description here

3
  • It worked! Thanks. One thing to note though is that the "Until" date in the timespan must correspond with the "duringflood_date" in the script. (And this applies to most time series analysis like this i've seen using EO browser), otherwise, it wont work.
    – Opegraphy
    Commented Nov 22, 2022 at 18:14
  • how can you tell which analyses require the additional datasets tab, and which don't.
    – Opegraphy
    Commented Nov 22, 2022 at 18:22
  • If the analysis is using two different data sources. For example Sentinel 1 and Sentinel 2. But for this one it is just Sentinel 1. Also please accept the answer if it solved your problem
    – JonasV
    Commented Nov 23, 2022 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.