-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/complex-reduce'
- Loading branch information
Showing
56 changed files
with
996 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
{ | ||
"1": { | ||
"process_id": "apply", | ||
"arguments": { | ||
"data": { | ||
"from_node": "mintime" | ||
}, | ||
"process": { | ||
"callback": { | ||
"2": { | ||
"process_id": "linear_scale_range", | ||
"arguments": { | ||
"x": { | ||
"from_argument": "x" | ||
}, | ||
"inputMin": -1, | ||
"inputMax": 1, | ||
"outputMax": 255 | ||
}, | ||
"result": true | ||
} | ||
} | ||
} | ||
}, | ||
"description": "Stretch range from -1 / 1 to 0 / 255 for PNG visualization." | ||
}, | ||
"dc": { | ||
"process_id": "load_collection", | ||
"arguments": { | ||
"id": "COPERNICUS/S2", | ||
"spatial_extent": null, | ||
"temporal_extent": [ | ||
"2018-01-01T00:00:00Z", | ||
"2018-01-31T23:59:59Z" | ||
], | ||
"bands": [ | ||
"B8", | ||
"B4", | ||
"B2" | ||
] | ||
}, | ||
"description": "Loading the data; The order of the specified bands is important for the following reduce operation." | ||
}, | ||
"evi": { | ||
"process_id": "reduce", | ||
"arguments": { | ||
"data": { | ||
"from_node": "dc" | ||
}, | ||
"reducer": { | ||
"callback": { | ||
"nir": { | ||
"process_id": "array_element", | ||
"arguments": { | ||
"data": { | ||
"from_argument": "data" | ||
}, | ||
"index": 0 | ||
} | ||
}, | ||
"sub": { | ||
"process_id": "subtract", | ||
"arguments": { | ||
"data": [ | ||
{ | ||
"from_node": "nir" | ||
}, | ||
{ | ||
"from_node": "red" | ||
} | ||
] | ||
} | ||
}, | ||
"div": { | ||
"process_id": "divide", | ||
"arguments": { | ||
"data": [ | ||
{ | ||
"from_node": "sub" | ||
}, | ||
{ | ||
"from_node": "sum" | ||
} | ||
] | ||
} | ||
}, | ||
"p3": { | ||
"process_id": "product", | ||
"arguments": { | ||
"data": [ | ||
2.5, | ||
{ | ||
"from_node": "div" | ||
} | ||
] | ||
}, | ||
"result": true | ||
}, | ||
"sum": { | ||
"process_id": "sum", | ||
"arguments": { | ||
"data": [ | ||
1, | ||
{ | ||
"from_node": "nir" | ||
}, | ||
{ | ||
"from_node": "p1" | ||
}, | ||
{ | ||
"from_node": "p2" | ||
} | ||
] | ||
} | ||
}, | ||
"red": { | ||
"process_id": "array_element", | ||
"arguments": { | ||
"data": { | ||
"from_argument": "data" | ||
}, | ||
"index": 1 | ||
} | ||
}, | ||
"p1": { | ||
"process_id": "product", | ||
"arguments": { | ||
"data": [ | ||
6, | ||
{ | ||
"from_node": "red" | ||
} | ||
] | ||
} | ||
}, | ||
"blue": { | ||
"process_id": "array_element", | ||
"arguments": { | ||
"data": { | ||
"from_argument": "data" | ||
}, | ||
"index": 2 | ||
} | ||
}, | ||
"p2": { | ||
"process_id": "product", | ||
"arguments": { | ||
"data": [ | ||
-7.5, | ||
{ | ||
"from_node": "blue" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"dimension": "bands" | ||
}, | ||
"description": "Compute the EVI. Formula: 2.5 * (NIR - RED) / (1 + NIR + 6*RED + -7.5*BLUE)" | ||
}, | ||
"mintime": { | ||
"process_id": "reduce", | ||
"arguments": { | ||
"data": { | ||
"from_node": "evi" | ||
}, | ||
"reducer": { | ||
"callback": { | ||
"min": { | ||
"process_id": "min", | ||
"arguments": { | ||
"data": { | ||
"from_argument": "data" | ||
} | ||
}, | ||
"result": true | ||
} | ||
} | ||
}, | ||
"dimension": "temporal" | ||
}, | ||
"description": "Compute a minimum time composite by reducing the temporal dimension" | ||
}, | ||
"save": { | ||
"process_id": "save_result", | ||
"arguments": { | ||
"data": { | ||
"from_node": "1" | ||
}, | ||
"format": "PNG", | ||
"options": { | ||
"red": null, | ||
"green": null, | ||
"blue": null, | ||
"gray": null | ||
} | ||
}, | ||
"result": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const Process = require('../processgraph/process'); | ||
const Errors = require('../errors'); | ||
|
||
module.exports = class array_element extends Process { | ||
|
||
async execute(node, context) { | ||
var data = node.getArgument("data"); | ||
var index = node.getArgument("index"); | ||
var return_nodata = node.getArgument("return_nodata", false); | ||
|
||
if (Array.isArray(data) && typeof data[index] !== 'undefined') { | ||
return data[index]; | ||
} | ||
else if (return_nodata) { | ||
return null; | ||
} | ||
else { | ||
throw new Errors.IndexOutOfBounds(); | ||
} | ||
} | ||
|
||
}; |
Oops, something went wrong.