forked from open-geocomputing/OpenEarthEngineLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DarftNewFunction
30 lines (23 loc) · 1.47 KB
/
DarftNewFunction
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var inputs=[{name:'paramName1',description:'the description', type:'number',defaultValue:null,optional:false},
{name:'paramName1',description:'the description', type:'ee.Image',defaultValue:null,optional:true},
{name:'Return',description:'Return', type:'ee.Image',defaultValue:null,optional:true} // change the return type accordingly OR remove this line if the function doesn’t have an output
]
var reference={name:'DarftNewFunction',license:'MIT', description:'the description of the function'};
// reference can get any supplementary field that can be relevant, in particular
// "experimental" which add a small flask to highlight the experimental point in the documentation,
// "DOI" that automatically add a citation field in the documentation with APA citation,
// but many other can be added such as "contributors" ...
exports.createDocumentation=function(){ return {inputs:inputs, reference:reference};}
exports.createFunction=function(internal,relPath,oeel){
return function(){
var inputDictionary=internal.readInputs(Array.prototype.slice.call(arguments,0),inputs,reference,relPath);
internal.addRef(reference,relPath);
//do whatever
return inputDictionary.val;
}
}
// remove everything after this for submission
// load your function
var yourFunction=exports.createFunction(require('users/OEEL/lib:loadAll').internal.internal,'',require('users/OEEL/lib:loadAll'));
// test your function
print(yourFunction(10))