Skip to content

Commit

Permalink
Fixed reducer names
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed May 25, 2024
1 parent 1d388f6 commit 42e91a0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
10 changes: 8 additions & 2 deletions src/api/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export default class JobsAPI {
];
const assets = {};
for(const file of files) {
console.log(file.stat);
const fileName = path.relative(folder, file.path);
const href = Utils.getApiUrl("/storage/" + job.token + "/" + fileName);
const type = Utils.extensionToMediaType(fileName);
Expand All @@ -271,13 +272,18 @@ export default class JobsAPI {
assets[fileName] = {
href: href,
roles: ["data"],
type: type
type: type,
"file:size": file.stat.size,
created: file.stat.birthtime,
updated: file.stat.mtime
};
}
}
const item = {
stac_version: packageInfo.stac_version,
stac_extensions: [],
stac_extensions: [
"https://stac-extensions.github.io/file/v2.0.0/schema.json",
],
id: job._id,
type: "Feature",
geometry: null,
Expand Down
2 changes: 1 addition & 1 deletion src/processes/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import GeeProcessing from './utils/processing.js';
export default class all extends GeeProcess {

executeSync(node) {
return GeeProcessing.reduceNumericalFunction(node, 'allNonZero');
return GeeProcessing.reduceNumericalFunction(node, ['allNonZero', 'all']);
}

}
2 changes: 1 addition & 1 deletion src/processes/any.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import GeeProcessing from './utils/processing.js';
export default class any extends GeeProcess {

executeSync(node) {
return GeeProcessing.reduceNumericalFunction(node, 'anyNonZero');
return GeeProcessing.reduceNumericalFunction(node, ['anyNonZero', 'any']);
}

}
7 changes: 4 additions & 3 deletions src/processes/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ export default class count extends GeeProcess {
const condition = node.getArgument("condition");
let reducer;
if (condition === true) {
reducer = ee => ee.Reducer.countEvery;
// Seems buggy: https://issuetracker.google.com/issues/342705677
reducer = 'countEvery';
}
else if (condition === null) {
// openEO asks to not count infinity, nan and no data values
// GEE doesn't handle infinity and nan and often uses null or 0 as no data values.
// As such the closest we can get is to count all values that are not null.
reducer = ee => ee.Reducer.count;
reducer = 'count';
}
else {
throw node.invalidArgument("condition", "Unsupported value, must be one of `null` or `true`.");
}
return GeeProcessing.reduceNumericalFunction(node, reducer);
return GeeProcessing.reduceNumericalFunction(node, [reducer, 'count']);
}

}
2 changes: 1 addition & 1 deletion src/processes/first.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class first extends GeeProcess {
executeSync(node) {
const ignore_nodata = node.getArgument('ignore_nodata', true);
const reducer = ignore_nodata ? 'firstNonNull' : 'first';
return GeeProcessing.reduceNumericalFunction(node, reducer);
return GeeProcessing.reduceNumericalFunction(node, [reducer, 'first']);
}

}
2 changes: 1 addition & 1 deletion src/processes/last.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class last extends GeeProcess {
executeSync(node) {
const ignore_nodata = node.getArgument('ignore_nodata', true);
const reducer = ignore_nodata ? 'lastNonNull' : 'last';
return GeeProcessing.reduceNumericalFunction(node, reducer);
return GeeProcessing.reduceNumericalFunction(node, [reducer, 'last']);
}

}

0 comments on commit 42e91a0

Please sign in to comment.