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?