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

normalized_difference: A datacube with two bands vs. two datacubes with one band #60

Closed
m-mohr opened this issue May 22, 2019 · 5 comments

Comments

@m-mohr
Copy link
Member

m-mohr commented May 22, 2019

I am currently trying to implement normalized_difference.

The process normalized_difference takes two datacubes, each having a band dimension holding a single band so you usually need to filter two times in advance. Example:

var collection  = load_collection("Sentinel-2");
var b1 = filter_bands(collection, ["B4"]);
var b2 = filter_bands(collection, ["B8"]);
var nd = normalized_difference(b1, b2);

This feels cumbersome. We could also allow:

var collection  = load_collection("Sentinel-2");
var nd = normalized_difference(collection, "B4", "B8");

Unfortunately, this is not easily to add to the other signature of normalized_difference. Also, if you get the bands from two collections (e.g. B8A and B4 would be different collections at EURAC) that would be more complicated then:

var collection10  = load_collection("Sentinel-2-10m");
var collection20  = load_collection("Sentinel-2-20m");
var collection10resampled = resample(collection10, "20m"); // That's not an actual process, just for making the point clear...
var collection = merge_cubes(collection10resampled, collection20);
var nd = normalized_difference(collection, "B4", "B8");

So, what do you think should we use? Wouldn't it in most cases be easier to just accept a single data cube with two bands?

@m-mohr m-mohr added this to the v0.5 milestone May 22, 2019
@aljacob
Copy link
Member

aljacob commented May 23, 2019

that depends on how people setup the data cubes. In some cases those might be one band per cube. Or are we saying that all bands have to be in the same collection as a definite rule for openEO data cubes? Otherwise overloading was not possible in the processes, right? So we could not have the same process with two different set of parameters? Or can we have a must have of one data cube and an optional second data cube. If only one is specified, then it is implicitly understood to read both bands from the same data cube, otherwise read the first band from first data cube and the second band from second data cube? What do you think?

@jdries
Copy link
Contributor

jdries commented May 23, 2019

I also did not yet implement this process, specifically because of having to combine multiple datacubes.
Also you usually do normalized difference between spectral bands of the same sensor, which are quite likely to be available in a single datacube.
I would opt for taking a datacube, and some kind of reference to two bands in that single cube.

@edzer
Copy link
Member

edzer commented May 23, 2019

I agree: it is essentially a reducer, and the band selector could be another process.

@m-mohr
Copy link
Member Author

m-mohr commented May 23, 2019

So basically somthing like normalized_difference(datacube, bandName1 = null, bandName2 = null) : datacube? If bandName1 and bandName2 are not set by the user, it simply takes the first and second band (order set by filter_bands).

Edit: Or we see it more as a reducer, comparable with the EVI example.

@m-mohr m-mohr added help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Nov 18, 2019
@m-mohr
Copy link
Member Author

m-mohr commented Nov 18, 2019

Telco: We'll make this a reducer: normalized_difference(number red, number nir).

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

No branches or pull requests

4 participants