addTimeProperties: eval("(function(){var exports={};var inputs=[{name:'sinceEpoch',description:'minified',type:'boolean',defaultValue:false,optional:false},{name:'timeVariable',description:'minified',type:'string|object',defaultValue:'start',optional:false},{name:'timeZone',description:'minified',type:'string',defaultValue:'UTC',optional:false},{name:'image',description:'minified',type:'ee.Image',optional:true},{name:'feature',description:'minified',type:'ee.Feature',optional:true},{name:'collection',description:'minified',type:'ee.Collection',optional:true},{name:'Return',description:'minified',type:'function|ee.Image|ee.Feature|ee.Collection',defaultValue:null,optional:true}]\nvar reference={name:'addTimeProperties',license:'MIT',description:'minified',contributors:['Mathieu Gravey']};exports.createDocumentation=function(){return{inputs:inputs,reference:reference};}\nexports.createFunction=function(internal,relPath){return function(){var inputDictionary=internal.readInputs(Array.prototype.slice.call(arguments,0),inputs,reference,relPath);internal.addRef(reference,relPath);var sinceEpoch=inputDictionary.sinceEpoch;var timeZone=inputDictionary.timeZone;if(internal.typeObject(inputDictionary.timeVariable)=='string')\nif(inputDictionary.timeVariable=='both')\nvar timeVar=['start','end'];else\nvar timeVar=[inputDictionary.timeVariable];else\nvar timeVar=inputDictionary.timeVariable;var epoch=ee.Date.fromYMD(1970,1,1,timeZone);var fun=function(ft){var obj={};for(var i=0;i<timeVar.length;i++){var localName=timeVar[i];if(localName=='start'){var time=ee.Date(ft.get('system:time_start'));}else if(localName=='end'){var time=ee.Date(ft.get('system:time_end'));}else{var time=ee.Date(ft.get(localName));}\nif(sinceEpoch){obj[\"oeel:\"+localName+\"_hour_epoch\"]=time.difference(epoch,'hour').floor();obj[\"oeel:\"+localName+\"_minute_epoch\"]=time.difference(epoch,'minute').floor();obj[\"oeel:\"+localName+\"_second_epoch\"]=time.difference(epoch,'second').floor();obj[\"oeel:\"+localName+\"_day_epoch\"]=time.difference(epoch,'day').floor();obj[\"oeel:\"+localName+\"_week_epoch\"]=time.difference(epoch,'week').floor();obj[\"oeel:\"+localName+\"_month_epoch\"]=time.difference(epoch,'month').floor();obj[\"oeel:\"+localName+\"_year_epoch\"]=time.difference(epoch,'year').floor();}\nelse{obj[\"oeel:\"+localName+\"_hour\"]=time.get('hour',timeZone);obj[\"oeel:\"+localName+\"_minute\"]=time.get('minute',timeZone);obj[\"oeel:\"+localName+\"_second\"]=time.get('second',timeZone);obj[\"oeel:\"+localName+\"_day\"]=time.get('day',timeZone);obj[\"oeel:\"+localName+\"_week\"]=time.get('week',timeZone);obj[\"oeel:\"+localName+\"_month\"]=time.get('month',timeZone);obj[\"oeel:\"+localName+\"_year\"]=time.get('year',timeZone);}}\nreturn ft.setMulti(obj);}\nif(inputDictionary.image)\nreturn fun(inputDictionary.image);if(inputDictionary.feature)\nreturn fun(inputDictionary.feature);if(inputDictionary.collection)\nreturn inputDictionary.collection.map(fun);return fun;}};return exports})()")},
0 commit comments