From 651fb1149d1761462fdef39a713635009a868466 Mon Sep 17 00:00:00 2001 From: Google Earth Engine Authors Date: Wed, 24 Apr 2024 21:02:10 +0000 Subject: [PATCH] v0.1.401 PiperOrigin-RevId: 627843463 --- javascript/build/ee_api_js.js | 130 +++++++++--------- javascript/build/ee_api_js_debug.js | 53 ++++--- javascript/build/ee_api_js_npm.js | 97 ++++++------- javascript/package.json | 2 +- javascript/src/apiclient.js | 2 +- .../examples/UserInterface/LandsatExplorer.js | 16 ++- .../src/layers/earthenginetilesource.js | 29 ++-- python/ee/__init__.py | 2 +- python/ee/tests/algorithms.json | 4 +- python/ee/tests/apifunction_test.py | 43 ++++++ python/ee/tests/batch_test.py | 29 ++++ python/ee/tests/collection_test.py | 39 ++++++ python/ee/tests/computedobject_test.py | 5 + python/ee/tests/data_test.py | 54 ++++++++ python/ee/tests/dictionary_test.py | 19 +++ python/ee/tests/ee_date_test.py | 7 + python/ee/tests/ee_number_test.py | 19 +++ python/ee/tests/ee_string_test.py | 19 +++ python/ee/tests/element_test.py | 4 + python/ee/tests/feature_test.py | 6 + python/ee/tests/featurecollection_test.py | 7 + python/ee/tests/filter_test.py | 28 ++++ python/ee/tests/geometry_test.py | 11 ++ python/ee/tests/image_test.py | 22 +++ python/ee/tests/imagecollection_test.py | 9 ++ python/ee/tests/oauth_test.py | 1 - python/ee/tests/serializer_test.py | 4 + python/examples/py/Image/hsv_pan_sharpen.py | 2 +- python/pyproject.toml | 2 +- 29 files changed, 495 insertions(+), 170 deletions(-) diff --git a/javascript/build/ee_api_js.js b/javascript/build/ee_api_js.js index b59852192..f252c343a 100644 --- a/javascript/build/ee_api_js.js +++ b/javascript/build/ee_api_js.js @@ -10,8 +10,8 @@ da("Promise",function(a){function b(){this.pb=null}function c(f){return f instan })};var e=function(f){this.T=0;this.ia=void 0;this.uc=[];this.Lh=!1;var l=this.cf();try{f(l.resolve,l.reject)}catch(m){l.reject(m)}};e.prototype.cf=function(){function f(p){return function(v){m||(m=!0,p.call(l,v))}}var l=this,m=!1;return{resolve:f(this.wl),reject:f(this.ag)}};e.prototype.wl=function(f){if(f===this)this.ag(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof e)this.yl(f);else{a:switch(typeof f){case "object":var l=null!=f;break a;case "function":l=!0;break a;default:l= !1}l?this.vl(f):this.Ch(f)}};e.prototype.vl=function(f){var l=void 0;try{l=f.then}catch(m){this.ag(m);return}"function"==typeof l?this.zl(l,f):this.Ch(f)};e.prototype.ag=function(f){this.zi(2,f)};e.prototype.Ch=function(f){this.zi(1,f)};e.prototype.zi=function(f,l){if(0!=this.T)throw Error("Cannot settle("+f+", "+l+"): Promise already settled in state"+this.T);this.T=f;this.ia=l;2===this.T&&this.xl();this.Xk()};e.prototype.xl=function(){var f=this;d(function(){if(f.nl()){var l=k.console;"undefined"!== typeof l&&l.error(f.ia)}},1)};e.prototype.nl=function(){if(this.Lh)return!1;var f=k.CustomEvent,l=k.Event,m=k.dispatchEvent;if("undefined"===typeof m)return!0;"function"===typeof f?f=new f("unhandledrejection",{cancelable:!0}):"function"===typeof l?f=new l("unhandledrejection",{cancelable:!0}):(f=k.document.createEvent("CustomEvent"),f.initCustomEvent("unhandledrejection",!1,!0,f));f.promise=this;f.reason=this.ia;return m(f)};e.prototype.Xk=function(){if(null!=this.uc){for(var f=0;f>>0),Ba=0,Da=function(a,b,c){return a.call.apply(a.bind, arguments)},Ea=function(a,b,c){if(!a)throw Error();if(2c&&(c=Math.max(0,a.length+c));if("string"===typeof a)return"string"!==typeof b|| @@ -70,10 +70,10 @@ if(!a.aa||"function"!=typeof a.aa){if("undefined"!==typeof Map&&a instanceof Map b){if("function"==typeof a.every)return a.every(b,void 0);if(ya(a)||"string"===typeof a)return Array.prototype.every.call(a,b,void 0);for(var c=Fc(a),d=Ec(a),e=d.length,g=0;gc)return!1;!(b instanceof Ic)&&5e&&(e+=d);return[a.jl,c,e,b.y].join("/")};Nc.prototype.Nc=function(){return this.Ab.length};var Pc=function(a){z.call(this,"tileevent");this.count=a};x(Pc,z);var Qc=function(){},Rc=new Qc;function Sc(a){return Object.assign({},{P:{},Ol:{},keys:[],Ma:{},s:{},H:{},sh:!1},a)}var E=function(){this.h={}},F=function(a,b){return a.h.hasOwnProperty(b)?a.h[b]:null},G=function(a,b){return null!=a.h[b]};function Tc(a,b){return F(b,a)}function Uc(a,b,c){b[a]=c}function Vc(){return{}}function Wc(a,b){var c=new a;return null==b?c:Xc(b,Yc,Zc,$c,a)}function Yc(a,b){return b[a]}function Zc(a,b,c){b.h[a]=c} +Ic.prototype[Symbol.iterator]=function(){return this.values()};Ic.prototype.mb=function(a){this.size=a};var Nc=function(a,b,c){D.call(this);this.jl=b;this.token=c;this.Ab=[];this.vg=new Ic;this.yb=0;this.url=a};x(Nc,D);w("ee.AbstractOverlay",Nc);var Oc=function(a,b,c){var d=1<e&&(e+=d);return[a.jl,c,e,b.y].join("/")};Nc.prototype.Nc=function(){return this.Ab.length};var Pc=function(a){z.call(this,"tileevent");this.count=a};x(Pc,z);var Qc=function(){},Rc=new Qc;function Sc(a){return Object.assign({},{P:{},Pl:{},keys:[],Ma:{},s:{},H:{},sh:!1},a)}var E=function(){this.h={}},F=function(a,b){return a.h.hasOwnProperty(b)?a.h[b]:null},G=function(a,b){return null!=a.h[b]};function Tc(a,b){return F(b,a)}function Uc(a,b,c){b[a]=c}function Vc(){return{}}function Wc(a,b){var c=new a;return null==b?c:Xc(b,Yc,Zc,$c,a)}function Yc(a,b){return b[a]}function Zc(a,b,c){b.h[a]=c} function $c(a){if(null==a)throw Error("Cannot deserialize, target constructor was null.");return new a} -function Xc(a,b,c,d,e){e=d(e);for(var g=ad(a,e),f=g.P||{},l=g.s||{},m=g.Ma||{},p=n(g.keys||[]),v=p.next(),A={};!v.done;A={Wd:void 0},v=p.next()){v=v.value;var C=b(v,a);if(null!=C){var J=void 0;if(f.hasOwnProperty(v)){if(g.sh&&0===C.length)continue;J=bd(C,b,c,d,!0,!0,f[v])}else if(l.hasOwnProperty(v))J=bd(C,b,c,d,!1,!0,l[v]);else if(m.hasOwnProperty(v))A.Wd=m[v],J=A.Wd.pa?C.map(function(fa){return function(X){return cd(X,fa.Wd,b,c,d)}}(A)):cd(C,A.Wd,b,c,d);else if(Array.isArray(C)){if(g.sh&&0===C.length)continue; -J=bd(C,b,c,d,!0,!1)}else J=C instanceof Qc?null:C;c(v,e,J)}}return e}function cd(a,b,c,d,e){for(var g={},f=n(Object.keys(a)),l=f.next();!l.done;l=f.next()){l=l.value;var m=a[l];null!=m&&(g[l]=bd(m,c,d,e,b.ra,b.qa,b.ka))}return g} +function Xc(a,b,c,d,e){e=d(e);for(var g=ad(a,e),f=g.P||{},l=g.s||{},m=g.Ma||{},p=n(g.keys||[]),v=p.next(),A={};!v.done;A={Wd:void 0},v=p.next()){v=v.value;var C=b(v,a);if(null!=C){var I=void 0;if(f.hasOwnProperty(v)){if(g.sh&&0===C.length)continue;I=bd(C,b,c,d,!0,!0,f[v])}else if(l.hasOwnProperty(v))I=bd(C,b,c,d,!1,!0,l[v]);else if(m.hasOwnProperty(v))A.Wd=m[v],I=A.Wd.pa?C.map(function(fa){return function(X){return cd(X,fa.Wd,b,c,d)}}(A)):cd(C,A.Wd,b,c,d);else if(Array.isArray(C)){if(g.sh&&0===C.length)continue; +I=bd(C,b,c,d,!0,!1)}else I=C instanceof Qc?null:C;c(v,e,I)}}return e}function cd(a,b,c,d,e){for(var g={},f=n(Object.keys(a)),l=f.next();!l.done;l=f.next()){l=l.value;var m=a[l];null!=m&&(g[l]=bd(m,c,d,e,b.ra,b.qa,b.ka))}return g} function bd(a,b,c,d,e,g,f){if(g&&null==f)throw Error("Cannot deserialize a reference object without a constructor.");return null==a?a:e&&g?a.map(function(l){return Xc(l,b,c,d,f)}):e&&!g?a.map(function(l){return l}):!e&&g?Xc(a,b,c,d,f):a instanceof Qc?null:"object"===typeof a?JSON.parse(JSON.stringify(a)):a}function ad(a,b){if(b instanceof E)a=Sc(b.i());else if(a instanceof E)a=Sc(a.i());else throw Error("Cannot find ClassMetadata.");return a};var dd;var fd=function(a,b){if(b!==ed)throw Error("TrustedResourceUrl is not meant to be built directly");this.ki=a};fd.prototype.toString=function(){return this.ki+""}; var gd=function(a){if(a instanceof fd&&a.constructor===fd)return a.ki;Na("expected object of type TrustedResourceUrl, got '%s' of type %s",a,xa(a));return"type_error:TrustedResourceUrl"},ed={},hd=function(a){if(void 0===dd){var b=null;var c=r.trustedTypes;if(c&&c.createPolicy)try{b=c.createPolicy("goog#html",{createHTML:Ga,createScript:Ga,createScriptURL:Ga})}catch(d){r.console&&r.console.error(d.message)}dd=b}a=(b=dd)?b.createScriptURL(a):a;return new fd(a,ed)};/* @@ -95,7 +95,7 @@ function(a){a.N||(a.N=new Map,a.Y=0,a.ta&&be(a.ta,function(b,c){a.add(decodeURIC h.isEmpty=function(){se(this);return 0==this.Y};h.Pb=function(a){se(this);a=te(this,a);return this.N.has(a)};h.Ic=function(a){var b=this.aa();return $a(b,a)};h.forEach=function(a,b){se(this);this.N.forEach(function(c,d){c.forEach(function(e){a.call(b,e,d,this)},this)},this)};h.tb=function(){se(this);for(var a=Array.from(this.N.values()),b=Array.from(this.N.keys()),c=[],d=0;d"}else d=void 0===a?"undefined":null===a?"null":typeof a;Na("Argument is not an HTML Element with tag name "+(c+d))}a:{c=(a.ownerDocument&&a.ownerDocument.defaultView|| @@ -416,8 +416,8 @@ function gi(a,b){function c(){var l=ta.apply(0,arguments),m=this;return f.run(fu var ti=new Mh(function(){return new si},function(a){a.reset()}),ui=function(a,b,c){var d=ti.get();d.Yb=a;d.tc=b;d.context=c;return d};ri.prototype.then=function(a,b,c){null!=a&&Qa(a,"opt_onFulfilled should be a function.");null!=b&&Qa(b,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");return vi(this,"function"===typeof a?a:null,"function"===typeof b?b:null,c)};ri.prototype.$goog_Thenable=!0; ri.prototype.Dl=function(a,b){return vi(this,null,a,b)};ri.prototype.catch=ri.prototype.Dl;ri.prototype.cancel=function(a){if(0==this.T){var b=new qi(a);mi(function(){wi(this,b)},this)}}; var wi=function(a,b){if(0==a.T)if(a.X){var c=a.X;if(c.gb){for(var d=0,e=null,g=null,f=c.gb;f&&(f.ud||(d++,f.Ob==a&&(e=f),!(e&&1b.length)){var d=b[0].match(/\r\nContent-ID: ]*)>/)[1],e=Number(b[1].match(/^HTTP\S*\s(\d+)\s/)[1]);c(d,e,b.slice(2).join("\r\n\r\n"))}},Ej=function(){var a=Lj.replace(/\/api$/,"");return"window"in r&&!a.match(/^https?:\/\/content-/)?a.replace(/^(https?:\/\/)(.*\.googleapis\.com)$/,"$1content-$2"):a},Nj=function(a,b,c){var d=[];a&&(d=d.concat(Mj)); b&&d.push("https://www.googleapis.com/auth/devstorage.read_write");a=d=d.concat(c);c=b=0;for(var e={};cg)break;A++}return ik(C.status,function(J){try{return C.getResponseHeader(J)}catch(fa){return null}},C.responseText,l,void 0,e,d,f)},gk=function(a,b,c,d,e,g,f){var l=0,m={url:a,method:c,content:d,headers:e},p=ak,v=null!= -g?g:10;m.callback=function(A){A=A.target;if(429==A.getStatus()&&lg)break;A++}return ik(C.status,function(I){try{return C.getResponseHeader(I)}catch(fa){return null}},C.responseText,l,void 0,e,d,f)},gk=function(a,b,c,d,e,g,f){var l=0,m={url:a,method:c,content:d,headers:e},p=ak,v=null!= +g?g:10;m.callback=function(A){A=A.target;if(429==A.getStatus()&&lX||300<=X)return"Server returned HTTP code: "+X+" for "+f+" "+g},A,C;b=b("Content-Type")||"application/json";d=b.replace(/;.*/,"");if("application/json"===d||"text/json"===d)c=p(c),c.parsed? -C=c.parsed:A=c;else if("multipart/mixed"===d){C={};var J=[];Kj(b,c,function(X,ea,Ib){Ib=p(Ib);Ib.parsed&&(C[X]=Ib.parsed);(ea=(Ib.parsed?"":Ib)||v(ea))&&J.push(X+": "+ea)});J.length&&(A=J.join("\n"))}else var fa="Response was unexpectedly not JSON, but "+d;A=A||v(a)||fa;if(e)return e(C,A),null;if(!A)return C;throw Error(A);},Rj=function(a){var b=function(){Oj||(Oj=function(c,d){r.google.accounts.oauth2.initTokenClient({client_id:c.client_id,callback:d,scope:c.scope}).requestAccessToken()});a()};t(r.default_gsi)? +C=c.parsed:A=c;else if("multipart/mixed"===d){C={};var I=[];Kj(b,c,function(X,ea,Ib){Ib=p(Ib);Ib.parsed&&(C[X]=Ib.parsed);(ea=(Ib.parsed?"":Ib)||v(ea))&&I.push(X+": "+ea)});I.length&&(A=I.join("\n"))}else var fa="Response was unexpectedly not JSON, but "+d;A=A||v(a)||fa;if(e)return e(C,A),null;if(!A)return C;throw Error(A);},Rj=function(a){var b=function(){Oj||(Oj=function(c,d){r.google.accounts.oauth2.initTokenClient({client_id:c.client_id,callback:d,scope:c.scope}).requestAccessToken()});a()};t(r.default_gsi)? b():Ti(b)},Sj=function(a,b,c){if(c.access_token){b=c.token_type+" "+c.access_token;if(c.expires_in||0===c.expires_in){c=900*c.expires_in;var d=setTimeout(Tj,.9*c);void 0!==d.unref&&d.unref();Uj=Date.now()+c}Wj=b;a&&a()}else b&&b(c.error||"Unknown error.")},Fj=function(a){var b=new je;a=n(Object.entries(a));for(var c=a.next();!c.done;c=a.next()){var d=n(c.value);c=d.next().value;d=d.next().value;b.set(c,d)}return b},fk=[],hk=new Gi(function(){var a=fk.shift();if(a){var b=a.url,c=a.callback,d=a.method, e=a.content;a=a.headers;var g=jk,f=new mj;pj.push(f);c&&f.Xa("complete",c);f.Wc("ready",f.Rk);g&&(f.zc=Math.max(0,g));f.send(b,d,e,a)}0==fk.length||hk.qf()},350),Lj=null,Yj=null,Zj=null,ek=null,dk=qc,Wj=null,Uj=null,Pj=null,Qj=[],Oj=null,Mj=["https://www.googleapis.com/auth/earthengine","https://www.googleapis.com/auth/cloud-platform"],ck=null,Xj=!1,jk=0,ak=null;w("ee.api.ListAssetsResponse",Ug);w("ee.api.EarthEngineAsset",Qf);w("ee.api.Operation",Xg);w("ee.api.ListFeaturesResponse",Vg); w("ee.api.FeatureViewLocation",Tf);var kk=function(){};kk.prototype.Eh=function(){return null};var lk=function(){};w("ee.Encodable.SourceFrame",lk); @@ -530,7 +530,7 @@ var Sl=function(a){a=new K(a);return a.handle(a.Fc().list(Dj(),{prettyPrint:!1}) w("ee.data.getMapId",Vl);var Wl=function(a,b,c,d){if(!a.formatTileUrl){var e=Ul(a.mapid,a.token,a.urlFormat);a.urlFormat=e.urlFormat;a.formatTileUrl=e.formatTileUrl}return a.formatTileUrl(b,c,d)};w("ee.data.getTileUrl",Wl); var Ul=function(a,b,c){var d=void 0===c?"":c;d||(Bj(),c=Yj,d=b?c+"/map/"+a+"/{z}/{x}/{y}?token="+b:c+"/v1/"+a+"/tiles/{z}/{x}/{y}");return{mapid:a,token:b,formatTileUrl:function(e,g,f){var l=Math.pow(2,f);e%=l;e=String(0>e?e+l:e);return d.replace("{x}",e).replace("{y}",g).replace("{z}",f)},urlFormat:d}},Xl=function(a,b){var c=a.visParams?Rl(ll(a.visParams)):null;a=new qg({name:null,Nb:a.assetId,mapName:a.mapName,Cg:c});b=new K(b);return b.handle((new xh(b.M)).create(Dj(),a,{fields:["name"]}).then(function(d){var e= d.name.split("/").pop();return{token:e,formatTileUrl:function(g,f,l){return Yj+"/v1/"+d.name+"/tiles/"+l+"/"+g+"/"+f},rawTilesKey:e.substring(0,e.lastIndexOf("-"))}}))};w("ee.data.getFeatureViewTilesKey",Xl); -var Yl=function(a,b,c){c=new K(c);var d=Fk(a);a=c.handle;var e=c.assets();b=void 0===b?{}:b;var g=void 0===g?{}:g;e.j.C(d,RegExp("^projects/[^/]+/assets/.*$"));g=I(e.j,{body:null,B:"GET",D:"earthengine.projects.assets.listFeatures",path:"/"+e.m+"/"+d+":listFeatures",u:H(b,g),G:Vg});return a.call(c,g)};w("ee.data.listFeatures",Yl); +var Yl=function(a,b,c){c=new K(c);var d=Fk(a);a=c.handle;var e=c.assets();b=void 0===b?{}:b;var g=void 0===g?{}:g;e.j.C(d,RegExp("^projects/[^/]+/assets/.*$"));g=J(e.j,{body:null,B:"GET",D:"earthengine.projects.assets.listFeatures",path:"/"+e.m+"/"+d+":listFeatures",u:H(b,g),G:Vg});return a.call(c,g)};w("ee.data.listFeatures",Yl); var Zl=function(a,b){var c=new cl(!0);a=nl(c,a);var d={};c=pl(c,a);Object.keys(c).length&&(d={__source_code_nodes__:c});c={l:Rl(a,d)};if(a=Tl())c.workloadTag=a;b=new K(b);return b.handle(Hh(b.value(),Dj(),new Ff(c)).then(function(e){return e.result}))};w("ee.data.computeValue",Zl); var $l=function(a,b){if("string"===typeof a.image)throw Error("Image as JSON string not supported.");if(void 0!==a.version)throw Error("Image version specification not supported.");if(void 0!==a.region)throw Error('"region" not supported in call to ee.data.getThumbId. Use ee.Image.getThumbURL.');if(void 0!==a.dimensions)throw Error('"dimensions" is not supported in call to ee.data.getThumbId. Use ee.Image.getThumbURL.');a=new oh({name:null,l:Rl(ll(a.image)),F:tk(a.format),xa:a.name,da:wk(a.bands), ic:zk(a),grid:null});var c={fields:"name"},d=Tl();d&&(c.workloadTag=d);b=new K(b);return b.handle((new Fh(b.M)).create(Dj(),a,c).then(function(e){return{thumbid:e.name,token:""}}))};w("ee.data.getThumbId",$l); @@ -561,15 +561,15 @@ w("ee.data.getAssetRoots",Mm);var Nm=function(a,b){var c="projects/"+Ek(a);a="pr var Om=function(a,b,c,d,e){if(c)throw Error("Asset overwrite not supported.");if("string"===typeof a)throw Error("Asset cannot be specified as string.");b=a.name||b&&Fk(b);if(!b)throw Error("Either asset name or opt_path must be specified.");c=b.indexOf("/assets/");if(-1===c)throw Error("Asset name must contain /assets/.");a=Object.assign({},a);a.tilestoreEntry&&!a.tilestoreLocation&&(a.tilestoreLocation=a.tilestoreEntry,delete a.tilestoreEntry);a.tilestoreLocation&&(a.tilestoreLocation=new Wf(a.tilestoreLocation)); a.gcsLocation&&!a.cloudStorageLocation&&(a.cloudStorageLocation=a.gcsLocation,delete a.gcsLocation);a.cloudStorageLocation&&(a.cloudStorageLocation=new Ef(a.cloudStorageLocation));d&&!a.properties&&(a.properties=Object.assign({},d));d=n(["title","description"]);for(var g=d.next();!g.done;g=d.next())if(g=g.value,a[g]){var f={};a.properties=Object.assign((f[g]=a[g],f),a.properties||{});delete a[g]}a=new Qf(a);d=b.slice(0,c);b=b.slice(c+8);a.id=null;a.name=null;a:switch(c=a.type,c){case "ImageCollection":c= "IMAGE_COLLECTION";break a;case "Folder":c="FOLDER"}a.type=c;e=new K(e);return e.handle(e.assets().create(d,a,{assetId:b}).then(Gk))};w("ee.data.createAsset",Om);var Pm=function(a,b,c){return Om({type:"Folder"},a,b,void 0,c)};w("ee.data.createFolder",Pm);var Qm=function(a,b,c){a=Fk(a);b=Fk(b);b=new Zg({Qb:b});c=new K(c);c.handle(c.assets().move(a,b).then(Gk))};w("ee.data.renameAsset",Qm); -var Rm=function(a,b,c,d){a=Fk(a);b=Fk(b);c=new Jf({Qb:b,overwrite:null!=c?c:null});d=new K(d);b=d.handle;var e=d.assets();var g=void 0===g?{}:g;var f=void 0===f?{}:f;e.j.C(a,RegExp("^projects/[^/]+/assets/.*$"));g=I(e.j,{body:c,B:"POST",D:"earthengine.projects.assets.copy",path:"/"+e.m+"/"+a+":copy",u:H(g,f),G:Qf});b.call(d,g.then(Gk))};w("ee.data.copyAsset",Rm);var Sm=function(a,b){b=new K(b);b.handle(b.assets().delete(Fk(a)))};w("ee.data.deleteAsset",Sm); -var Tm=function(a,b){a=Fk(a);var c=new Eg;b=new K(b);var d=b.handle,e=b.assets(),g={prettyPrint:!1};g=void 0===g?{}:g;var f=void 0===f?{}:f;e.j.C(a,RegExp("^projects/[^/]+/assets/.*$"));f=I(e.j,{body:c,B:"POST",D:"earthengine.projects.assets.getIamPolicy",path:"/"+e.m+"/"+a+":getIamPolicy",u:H(g,f),G:kg});return d.call(b,f.then(Ok))};w("ee.data.getAssetAcl",Tm); -var Um=function(a,b,c,d){b=new rh({Nb:b,updateMask:(c||[]).join(",")});d=new K(d);c=d.handle;var e=d.assets();a=Fk(a);var g=void 0===g?{}:g;var f=void 0===f?{}:f;e.j.C(a,RegExp("^projects/[^/]+/assets/.*$"));g=I(e.j,{body:b,B:"PATCH",D:"earthengine.projects.assets.patch",path:"/"+e.m+"/"+a,u:H(g,f),G:Qf});return c.call(d,g.then(Gk))};w("ee.data.updateAsset",Um); -var Vm=function(a,b,c){a=Fk(a);b=Pk(b);b=new lh({kb:b});c=new K(c);var d=c.handle,e=c.assets(),g={prettyPrint:!1};g=void 0===g?{}:g;var f=void 0===f?{}:f;e.j.C(a,RegExp("^projects/[^/]+/assets/.*$"));f=I(e.j,{body:b,B:"POST",D:"earthengine.projects.assets.setIamPolicy",path:"/"+e.m+"/"+a+":setIamPolicy",u:H(g,f),G:kg});d.call(c,f)};w("ee.data.setAssetAcl",Vm); +var Rm=function(a,b,c,d){a=Fk(a);b=Fk(b);c=new Jf({Qb:b,overwrite:null!=c?c:null});d=new K(d);b=d.handle;var e=d.assets();var g=void 0===g?{}:g;var f=void 0===f?{}:f;e.j.C(a,RegExp("^projects/[^/]+/assets/.*$"));g=J(e.j,{body:c,B:"POST",D:"earthengine.projects.assets.copy",path:"/"+e.m+"/"+a+":copy",u:H(g,f),G:Qf});b.call(d,g.then(Gk))};w("ee.data.copyAsset",Rm);var Sm=function(a,b){b=new K(b);b.handle(b.assets().delete(Fk(a)))};w("ee.data.deleteAsset",Sm); +var Tm=function(a,b){a=Fk(a);var c=new Eg;b=new K(b);var d=b.handle,e=b.assets(),g={prettyPrint:!1};g=void 0===g?{}:g;var f=void 0===f?{}:f;e.j.C(a,RegExp("^projects/[^/]+/assets/.*$"));f=J(e.j,{body:c,B:"POST",D:"earthengine.projects.assets.getIamPolicy",path:"/"+e.m+"/"+a+":getIamPolicy",u:H(g,f),G:kg});return d.call(b,f.then(Ok))};w("ee.data.getAssetAcl",Tm); +var Um=function(a,b,c,d){b=new rh({Nb:b,updateMask:(c||[]).join(",")});d=new K(d);c=d.handle;var e=d.assets();a=Fk(a);var g=void 0===g?{}:g;var f=void 0===f?{}:f;e.j.C(a,RegExp("^projects/[^/]+/assets/.*$"));g=J(e.j,{body:b,B:"PATCH",D:"earthengine.projects.assets.patch",path:"/"+e.m+"/"+a,u:H(g,f),G:Qf});return c.call(d,g.then(Gk))};w("ee.data.updateAsset",Um); +var Vm=function(a,b,c){a=Fk(a);b=Pk(b);b=new lh({kb:b});c=new K(c);var d=c.handle,e=c.assets(),g={prettyPrint:!1};g=void 0===g?{}:g;var f=void 0===f?{}:f;e.j.C(a,RegExp("^projects/[^/]+/assets/.*$"));f=J(e.j,{body:b,B:"POST",D:"earthengine.projects.assets.setIamPolicy",path:"/"+e.m+"/"+a+":setIamPolicy",u:H(g,f),G:kg});d.call(c,f)};w("ee.data.setAssetAcl",Vm); var Wm=function(a,b,c){var d=Kk(b);b=Sc(d.i()).keys.filter(function(e){return"properties"!==e&&G(d,e)}).map(function(e){return e.replace(/([A-Z])/g,function(g,f){return"_"+f.toLowerCase()})}).concat(Object.keys(d.properties||{}).map(function(e){return'properties."'+e+'"'}));Um(a,d,b,c)};w("ee.data.setAssetProperties",Wm); var Xm=function(a,b){var c=Fk(a);b=new K(b);var d=b.assets(),e=d.j.C;d.j.C=function(g,f){"^projects\\/[^/]+\\/assets\\/.+$"===f.source&&(f=RegExp("^projects/[^/]+/assets/.*$"));return e(g,f)};c=d.get(c,{prettyPrint:!1});return b.handle(c.then(function(g){if(!(g instanceof Qf&&g.quota))throw Error(a+" is not a root folder.");g=g.quota;return{asset_count:{usage:Number(g.Pe||0),limit:Number(g.Nf||0)},asset_size:{usage:Number(g.sizeBytes||0),limit:Number(g.Wb||0)}}}))};w("ee.data.getAssetRootQuota",Xm); var Ym=function(){this.default=this.tag=""};Ym.prototype.get=function(){return this.tag};Ym.prototype.set=function(a){this.tag=this.validate(a)};Ym.prototype.reset=function(){this.tag=this.default}; Ym.prototype.validate=function(a){if(null==a||""===a)return"";a=String(a);if(!/^([a-z0-9]|[a-z0-9][-_a-z0-9]{0,61}[a-z0-9])$/g.test(a))throw Error('Invalid tag, "'+a+'". Tags must be 1-63 characters, beginning and ending with a lowercase alphanumeric character ([a-z0-9]) with dashes (-), underscores (_), and lowercase alphanumerics between.');return a};var Tl=function(){return Ml(Ym).get()};w("ee.data.getWorkloadTag",Tl);var Zm=function(a){Ml(Ym).set(a)};w("ee.data.setWorkloadTag",Zm); -var $m=function(a){var b=Ml(Ym);b.default=b.validate(a);Ml(Ym).set(a)};w("ee.data.setDefaultWorkloadTag",$m);var an=function(a){a&&(a=Ml(Ym),a.default=a.validate(""));Ml(Ym).reset()};w("ee.data.resetWorkloadTag",an);var tm={Il:"CANCEL",Ll:"UPDATE"};var O=function(a,b,c){if(!(this instanceof O))return bn(O,arguments);if(c&&(a||b))throw Error('When "opt_varName" is specified, "func" and "args" must be null.');if(a&&!b)throw Error('When "func" is specified, "args" must not be null.');this.I=a;this.args=b;this.U=c||null;this.Al=null};x(O,kk);w("ee.ComputedObject",O);O.prototype.Eh=function(){return this.Al};O.prototype.evaluate=function(a){if(!a||"function"!==typeof a)throw Error("evaluate() requires a callback function.");Zl(this,a)}; +var $m=function(a){var b=Ml(Ym);b.default=b.validate(a);Ml(Ym).set(a)};w("ee.data.setDefaultWorkloadTag",$m);var an=function(a){a&&(a=Ml(Ym),a.default=a.validate(""));Ml(Ym).reset()};w("ee.data.resetWorkloadTag",an);var tm={Jl:"CANCEL",Ml:"UPDATE"};var O=function(a,b,c){if(!(this instanceof O))return bn(O,arguments);if(c&&(a||b))throw Error('When "opt_varName" is specified, "func" and "args" must be null.');if(a&&!b)throw Error('When "func" is specified, "args" must not be null.');this.I=a;this.args=b;this.U=c||null;this.Al=null};x(O,kk);w("ee.ComputedObject",O);O.prototype.Eh=function(){return this.Al};O.prototype.evaluate=function(a){if(!a||"function"!==typeof a)throw Error("evaluate() requires a callback function.");Zl(this,a)}; O.prototype.evaluate=O.prototype.evaluate;O.prototype.V=function(a){return Zl(this,a)};O.prototype.getInfo=O.prototype.V;O.prototype.encode=function(a){if(null===this.I&&null===this.args)return{type:"ArgumentRef",value:this.U};var b={},c;for(c in this.args)void 0!==this.args[c]&&(b[c]=a(this.args[c]));b={type:"Invocation",arguments:b};a=a(this.I);b["string"===typeof a?"functionName":"function"]=a;return b}; O.prototype.na=function(a){if(null===this.I&&null===this.args){a=this.U||a.Qi;if(!a)throw Error("A mapped function's arguments cannot be used in client-side operations");return new qf({Mb:a})}var b={},c;for(c in this.args)void 0!==this.args[c]&&(b[c]=nk(tl(a,this.args[c])));return"string"===typeof this.I?qk(String(this.I),b):this.I.Gd(a,b)};O.prototype.va=function(a){return(void 0===a?0:a)?hl(this):rl(this)};O.prototype.serialize=O.prototype.va; O.prototype.toString=function(){return"ee."+this.name()+"("+jl(this)+")"};w("ee.ComputedObject.prototype.toString",O.prototype.toString);O.prototype.name=function(){return"ComputedObject"};O.prototype.Gg=function(a,b){var c=Array.from(arguments);c[0]=this;a.apply(r,c);return this};O.prototype.aside=O.prototype.Gg; @@ -636,11 +636,11 @@ var Ko=function(a,b,c,d){var e={};a=a.map(function(l){l=to(l,b.params);return uo if(void 0===m)try{p=cm(l)}catch(v){m=String(v.message)}b.callback(p,m)});else return cm(c(g))};Z.prototype.S=function(a,b){var c=R(Z.prototype.S,arguments),d=Q("ImageCollection.mosaic",this);if(c.callback)d.S(c.visParams,c.callback);else return d.S(c.visParams)};Z.prototype.getMapId=Z.prototype.S;Z.prototype.getMap=Z.prototype.S;Z.prototype.getMap=Z.prototype.getMap;Z.prototype.V=function(a){return Z.L.V.call(this,a)};Z.prototype.getInfo=Z.prototype.V; Z.prototype.select=function(a,b){var c=arguments;return this.map(function(d){return d.select.apply(d,c)})};Z.prototype.select=Z.prototype.select;Z.prototype.Hf=function(a,b,c,d){var e=R(Z.prototype.Hf,arguments);return this.map(function(g){return Q("Image.linkCollection",g,e.imageCollection,e.linkedBands,e.linkedProperties,e.matchPropertyName)})};Z.prototype.linkCollection=Z.prototype.Hf;Z.prototype.first=function(){return new N(Q("Collection.first",this))};Z.prototype.first=Z.prototype.first; Z.prototype.name=function(){return"ImageCollection"};Z.prototype.elementType=function(){return N};var Lo=function(a){this.af=a;this.id=null},No=function(a){var b={element:Mo(a)};Object.assign(b,a);b=Gb(b,function(c){return null!=c});return new Lo(b)};Lo.prototype.start=function(a,b){var c=this;B(this.af,"Task config must be specified for tasks to be started.");this.id=this.id||im(1)[0];Pa(this.id,"Failed to obtain task ID.");if(a)zm(this.id,this.af,function(e,g){if(g)b(g);else{var f;c.id=null!=(f=e.taskId)?f:null;a()}});else{var d;this.id=null!=(d=zm(this.id,this.af).taskId)?d:null}}; -Lo.prototype.start=Lo.prototype.start;var Oo=function(a,b,c,d,e,g,f,l,m,p,v,A){var C=R(Oo,arguments);C=Po(C,"ASSET","EXPORT_IMAGE");return No(C)};w("module$contents$ee$batch_Export.image.toAsset",Oo);var Qo=function(a,b,c,d,e,g,f,l,m,p,v,A,C,J,fa,X){var ea=R(Qo,arguments);ea=Po(ea,"GOOGLE_CLOUD_STORAGE","EXPORT_IMAGE");return No(ea)};w("module$contents$ee$batch_Export.image.toCloudStorage",Qo); -var Ro=function(a,b,c,d,e,g,f,l,m,p,v,A,C,J,fa,X){var ea=R(Ro,arguments);ea=Po(ea,"DRIVE","EXPORT_IMAGE");return No(ea)};w("module$contents$ee$batch_Export.image.toDrive",Ro);var So=function(a,b,c,d,e,g,f,l,m,p,v,A,C,J){var fa=R(So,arguments);fa=Po(fa,"GOOGLE_CLOUD_STORAGE","EXPORT_TILES");return No(fa)};w("module$contents$ee$batch_Export.map.toCloudStorage",So);var To=function(a,b,c,d,e,g,f,l){var m=R(To,arguments);m=Po(m,"GOOGLE_CLOUD_STORAGE","EXPORT_FEATURES");return No(m)}; +Lo.prototype.start=Lo.prototype.start;var Oo=function(a,b,c,d,e,g,f,l,m,p,v,A){var C=R(Oo,arguments);C=Po(C,"ASSET","EXPORT_IMAGE");return No(C)};w("module$contents$ee$batch_Export.image.toAsset",Oo);var Qo=function(a,b,c,d,e,g,f,l,m,p,v,A,C,I,fa,X){var ea=R(Qo,arguments);ea=Po(ea,"GOOGLE_CLOUD_STORAGE","EXPORT_IMAGE");return No(ea)};w("module$contents$ee$batch_Export.image.toCloudStorage",Qo); +var Ro=function(a,b,c,d,e,g,f,l,m,p,v,A,C,I,fa,X){var ea=R(Ro,arguments);ea=Po(ea,"DRIVE","EXPORT_IMAGE");return No(ea)};w("module$contents$ee$batch_Export.image.toDrive",Ro);var So=function(a,b,c,d,e,g,f,l,m,p,v,A,C,I){var fa=R(So,arguments);fa=Po(fa,"GOOGLE_CLOUD_STORAGE","EXPORT_TILES");return No(fa)};w("module$contents$ee$batch_Export.map.toCloudStorage",So);var To=function(a,b,c,d,e,g,f,l){var m=R(To,arguments);m=Po(m,"GOOGLE_CLOUD_STORAGE","EXPORT_FEATURES");return No(m)}; w("module$contents$ee$batch_Export.table.toCloudStorage",To);var Uo=function(a,b,c,d,e,g,f,l){var m=R(Uo,arguments);m.type="EXPORT_FEATURES";m=Po(m,"DRIVE","EXPORT_FEATURES");return No(m)};w("module$contents$ee$batch_Export.table.toDrive",Uo);var Vo=function(a,b,c,d,e){var g=R(Vo,arguments);g=Po(g,"ASSET","EXPORT_FEATURES");return No(g)};w("module$contents$ee$batch_Export.table.toAsset",Vo);var Wo=function(a,b,c,d,e,g,f,l){var m=R(Wo,arguments);m=Po(m,"FEATURE_VIEW","EXPORT_FEATURES");return No(m)}; -w("module$contents$ee$batch_Export.table.toFeatureView",Wo);var Xo=function(a,b,c,d,e,g,f,l){var m=R(Xo,arguments);m=Po(m,"BIGQUERY","EXPORT_FEATURES");return No(m)};w("module$contents$ee$batch_Export.table.toBigQuery",Xo);var Yo=function(a,b,c,d,e,g,f,l,m,p,v,A,C){var J=R(Yo,arguments);J=Po(J,"GOOGLE_CLOUD_STORAGE","EXPORT_VIDEO");return No(J)};w("module$contents$ee$batch_Export.video.toCloudStorage",Yo); -var Zo=function(a,b,c,d,e,g,f,l,m,p,v,A,C){var J=R(Zo,arguments);J=Po(J,"DRIVE","EXPORT_VIDEO");return No(J)};w("module$contents$ee$batch_Export.video.toDrive",Zo);var $o=function(a,b,c,d,e,g,f,l,m,p,v,A,C,J,fa,X,ea,Ib,Zq,$q,ar){var wj=R($o,arguments);wj=Po(wj,"GOOGLE_CLOUD_STORAGE","EXPORT_VIDEO_MAP");return No(wj)};w("module$contents$ee$batch_Export.videoMap.toCloudStorage",$o);var ap=function(a,b,c,d){var e=R(ap,arguments);e=Po(e,"ASSET","EXPORT_CLASSIFIER");return No(e)}; +w("module$contents$ee$batch_Export.table.toFeatureView",Wo);var Xo=function(a,b,c,d,e,g,f,l){var m=R(Xo,arguments);m=Po(m,"BIGQUERY","EXPORT_FEATURES");return No(m)};w("module$contents$ee$batch_Export.table.toBigQuery",Xo);var Yo=function(a,b,c,d,e,g,f,l,m,p,v,A,C){var I=R(Yo,arguments);I=Po(I,"GOOGLE_CLOUD_STORAGE","EXPORT_VIDEO");return No(I)};w("module$contents$ee$batch_Export.video.toCloudStorage",Yo); +var Zo=function(a,b,c,d,e,g,f,l,m,p,v,A,C){var I=R(Zo,arguments);I=Po(I,"DRIVE","EXPORT_VIDEO");return No(I)};w("module$contents$ee$batch_Export.video.toDrive",Zo);var $o=function(a,b,c,d,e,g,f,l,m,p,v,A,C,I,fa,X,ea,Ib,Zq,$q,ar){var wj=R($o,arguments);wj=Po(wj,"GOOGLE_CLOUD_STORAGE","EXPORT_VIDEO_MAP");return No(wj)};w("module$contents$ee$batch_Export.videoMap.toCloudStorage",$o);var ap=function(a,b,c,d){var e=R(ap,arguments);e=Po(e,"ASSET","EXPORT_CLASSIFIER");return No(e)}; w("module$contents$ee$batch_Export.classifier.toAsset",ap); var Mo=function(a){var b=function(d){return d in a},c=bp.find(b);B(1===Za(bp,b),'Expected a single "image", "collection" or "classifier" key.');b=a[c];if(!(b instanceof N||b instanceof Y||b instanceof Z||b instanceof S||b instanceof O))throw Error("Unknown element type provided: "+typeof b+". Expected: ee.Image, ee.ImageCollection, ee.FeatureCollection, ee.Element or ee.ComputedObject.");delete a[c];return b},Po=function(a,b,c){var d=void 0===d?!0:d;var e={type:c};Object.assign(e,a);switch(c){case "EXPORT_IMAGE":null== e.fileFormat&&(e.fileFormat="GeoTIFF");a=e.fileFormat;null==a&&(a="GEO_TIFF");a=a.toUpperCase();switch(a){case "TIFF":case "TIF":case "GEO_TIFF":case "GEOTIFF":a="GEO_TIFF";break;case "TF_RECORD":case "TF_RECORD_IMAGE":case "TFRECORD":a="TF_RECORD_IMAGE";break;default:throw Error("Invalid file format "+a+". Supported formats are: 'GEOTIFF', 'TFRECORD'.");}e.fileFormat=a;null!=e.formatOptions&&(a=cp(e,a),delete e.formatOptions,Object.assign(e,a));e=dp(e,b);null!=e.crsTransform&&(e.crs_transform=e.crsTransform, @@ -666,7 +666,7 @@ e)};return new O(new c,b)}throw Error("Invalid function value");},Ap=function(a) var wp=function(a){var b=Wc(Gf,a),c={},d=function(f,l){if(!(f in c)){if(!(f in b.values))throw Error("Cannot find "+l+" "+f);c[f]=e(b.values[f])}return c[f]},e=function(f){if(null!==f.hb)f=f.hb;else if(null!==f.Fa)f=f.Fa.values.map(e);else if(null!==f.Ga)f=Hb(f.Ga.values,e);else if(null!==f.Mb)f=op(Object,f.Mb);else if(null!==f.Ua)f=g(f.Ua);else if(null!==f.ya){var l=f.ya;f=l.Va?d(l.Va,"function"):pn(l.functionName);l=Hb(l.arguments,e);f=zp(f,l)}else f=null!==f.qb?yp(new qf({qb:f.qb}),f.qb):null!== f.Wa?yp(new qf({Wa:f.Wa}),f.Wa):null!==f.Oa?d(f.Oa,"reference"):null;return f},g=function(f){var l=d(f.body,"function body");f={args:f.lc.map(function(m){return{name:m,type:"Object",optional:!1}}),name:"",returns:"Object"};return new np(f,function(){return l})};return d(b.result,"result value")};w("ee.Deserializer.decodeCloudApi",wp);var Bp=function(a){if(!(this instanceof Bp))return bn(Bp,arguments);if(a instanceof Bp)return a;Cp();hn(a)?(O.call(this,null,null),this.Kc=a):(a instanceof O&&a.I&&"Dictionary"==a.I.Z().returns?O.call(this,a.I,a.args,a.U):O.call(this,new P("Dictionary"),{input:a},null),this.Kc=null)};x(Bp,O);w("ee.Dictionary",Bp);var Dp=!1,Cp=function(){Dp||(xn(Bp,"Dictionary","Dictionary"),Dp=!0)};Bp.prototype.encode=function(a){return null!==this.Kc?a(this.Kc):Bp.L.encode.call(this,a)}; Bp.prototype.na=function(a){return null!==this.Kc?nk(tl(a,this.Kc)):Bp.L.na.call(this,a)};Bp.prototype.name=function(){return"Dictionary"};var Ep={};w("ee.Terrain",Ep);Ep.Df=!1;Ep.initialize=function(){Ep.Df||(xn(Ep,"Terrain","Terrain"),Ep.Df=!0)};Ep.reset=function(){yn(Ep);Ep.Df=!1};var Kp=function(a,b,c,d,e,g){if("ready"!=Fp||a||b){var f=null!=c;if(d)if(f)Gp.push(d);else throw Error("Can't pass an error callback without a success callback.");if("loading"==Fp&&f)Hp.push(c);else if(Fp="loading",Bj(a,b,e,g),f)Hp.push(c),tn(Ip,Jp);else try{tn(),Ip()}catch(l){throw Jp(l),l;}}else c&&c()};w("ee.initialize",Kp); -var Np=function(){Fp="not_ready";Zj=Yj=Lj=null;Xj=!1;rn=null;sn={};yn(rp);tp=!1;yn(Bp);Dp=!1;yn(S);Fn=!1;yn(N);Ao=!1;yn(W);so=!1;yn(V);qo=!1;yn(Z);Jo=!1;yn(Y);Ho=!1;yn(U);ao=!1;yn(T);In=!1;yn(Do);Fo=!1;yn(hp);jp=!1;yn(kp);mp=!1;Ep.reset();for(var a=r.ee,b=0;b/,"");c[g]=!0}var f=r.ee,l;for(l in b)l in c&&!(l in f)&&(f[l]=Rp(l),Lp.push(l),a[l]?(f[l].signature=a[l],f[l].signature.isConstructor=!0,sn[l]=!0):f[l].signature={});dn=f;Sp()}catch(m){Jp(m);return}Fp="ready";for(Gp=[];0=this.R()){for(var c=this.Aa,d=0;d>1,a[d].getKey()>c.getKey())a[b]=a[d],b=d;else break;a[b]=c};h=Kq.prototype; h.remove=function(){var a=this.Aa,b=a.length,c=a[0];if(!(0>=b)){if(1==b)a.length=0;else{a[0]=a.pop();a=0;b=this.Aa;for(var d=b.length,e=b[a];a>1;){var g=2*a+1,f=2*a+2;g=fe.getKey())break;b[a]=b[g];a=g}b[a]=e}return c.ve}};h.aa=function(){for(var a=this.Aa,b=[],c=a.length,d=0;dthis.ll)return!1;this.Kg++;yq(this.ga,this.fa);setTimeout(u(this.Cl,this),0);return!0}; h.Cl=function(){if(!this.kc){var a=u(function(d){this.kc||(xq(this.ga,this.fa,d),ac(this.ga,Wq,u(this.Zk,this)),this.ga.start())},this),b=this.getUrl();if(qe(b).Ba.Pb("profiling")){var c=new mj;c.xc="blob";c.Xa("complete",u(function(){this.mi=c.getResponseHeader("X-Earth-Engine-Computation-Profile")||null;if(200<=c.getStatus()&&300>c.getStatus())try{var d=xd(yd(yj(c)));var e=d!==wd.toString()}catch(g){}a(e?d:b)},this));c.Wc("ready",u(c.Ra,c));c.send(b,"GET")}else a(b)}};h.Kg=0;h.kc=!1;h.ga=null; h.Ni=null;h.Ja=null;h.mi=null;var Wq=["load","abort","error"],Xq=function(){y.call(this);this.Ea=!1};q(Xq,y);Xq.prototype.setActive=function(a){this.Ea=a};Xq.prototype.isActive=function(){return this.Ea};var Sq=function(a,b){Nq.call(this,a,b)};q(Sq,Nq);Sq.prototype.bf=function(){return new Xq};Sq.prototype.Ed=function(a){a.Ra()};Sq.prototype.Sf=function(a){return!a.Sa&&!a.isActive()};var Yq=function(a,b,c,d,e){Nc.call(this,a,b,c,d,e);this.minZoom=d.minZoom||0;this.maxZoom=d.maxZoom||20;if(!window.google||!window.google.maps)throw Error("Google Maps API hasn't been initialized.");this.tileSize=d.tileSize||new google.maps.Size(256,256);this.name=d.name;this.wg=new Ic;this.Tf=1;this.ua=e||null};q(Yq,Nc);h=Yq.prototype;h.Oe=function(a){return bc(this,"tileevent",a)};h.bg=function(a){jc(a)}; h.getTile=function(a,b,c){if(ba.y||a.y>=1< { + this.handleAvailableToken_(tile, token); + }; + const tokenPool = this.getGlobalTokenPool_(); tokenPool.getObject(handleAvailableToken, opt_priority); } @@ -83,7 +90,7 @@ const EarthEngineTileSource = class extends AbstractTileSource { * @private */ handleAvailableToken_(tile, token) { - var tokenPool = EarthEngineTileSource.getGlobalTokenPool_(); + const tokenPool = this.getGlobalTokenPool_(); // Exit early if the tile was aborted (e.g. because the layer was hidden or // this tile was panned out of view). @@ -122,10 +129,10 @@ const EarthEngineTileSource = class extends AbstractTileSource { * @return {!PriorityPool} The global EE tile request token pool. * @private */ - static getGlobalTokenPool_() { + getGlobalTokenPool_() { if (!EarthEngineTileSource.TOKEN_POOL_) { EarthEngineTileSource.TOKEN_POOL_ = - new PriorityPool(0, EarthEngineTileSource.TOKEN_COUNT_); + new PriorityPool(0, this.token_count_); } return EarthEngineTileSource.TOKEN_POOL_; } @@ -135,7 +142,11 @@ goog.exportSymbol('ee.layers.EarthEngineTileSource', EarthEngineTileSource); /** @private {?PriorityPool} The global EE tile token pool. */ EarthEngineTileSource.TOKEN_POOL_ = null; -/** @private {number} The global max count of outstanding EE tile requests. */ -EarthEngineTileSource.TOKEN_COUNT_ = 4; +/** + * @private {number} + * @const + * The default global count of outstanding EE tile requests. + */ +EarthEngineTileSource.DEFAULT_TOKEN_COUNT_ = 4; exports = EarthEngineTileSource; diff --git a/python/ee/__init__.py b/python/ee/__init__.py index cd38b76fb..496aff3e1 100644 --- a/python/ee/__init__.py +++ b/python/ee/__init__.py @@ -1,6 +1,6 @@ """The EE Python library.""" -__version__ = '0.1.400' +__version__ = '0.1.401' # Using lowercase function naming to match the JavaScript names. # pylint: disable=g-bad-name diff --git a/python/ee/tests/algorithms.json b/python/ee/tests/algorithms.json index 8be106fbd..96ae9dd03 100644 --- a/python/ee/tests/algorithms.json +++ b/python/ee/tests/algorithms.json @@ -11446,7 +11446,7 @@ }, { "name": "algorithms/List.sequence", "description": "Generate a sequence of numbers from start to end (inclusive) in increments of step, or in count equally-spaced increments. If end is not specified it is computed from start + step * count, so at least one of end or count must be specified.", - "returnType": "List\u003cNumber\u003e", + "returnType": "List\u003cObject\u003e", "arguments": [{ "argumentName": "start", "type": "Number" @@ -11459,7 +11459,7 @@ "argumentName": "step", "type": "Number", "optional": true, - "defaultValue": 1.0 + "defaultValue": null }, { "argumentName": "count", "type": "Integer", diff --git a/python/ee/tests/apifunction_test.py b/python/ee/tests/apifunction_test.py index 657fabf72..1aec77b29 100644 --- a/python/ee/tests/apifunction_test.py +++ b/python/ee/tests/apifunction_test.py @@ -66,6 +66,49 @@ class Child(Base): self.assertNotEqual(Base.addBands, Child.addBands) # pytype: enable=attribute-error + def testEq(self): + a_signature = {'hello': 'world', 'args': []} + b_signature = { + 'hello': 'world', + 'args': [{'name': 'foo', 'type': 'number'}], + } + + # Identical. + self.assertEqual( + ee.ApiFunction(name='test', signature=a_signature), + ee.ApiFunction(name='test', signature=a_signature), + ) + # Different name. + self.assertNotEqual( + ee.ApiFunction(name='test-1', signature=a_signature), + ee.ApiFunction(name='test-2', signature=a_signature), + ) + # Different signature. + self.assertNotEqual( + ee.ApiFunction(name='test', signature=a_signature), + ee.ApiFunction(name='test', signature=b_signature), + ) + # Different type. + self.assertNotEqual( + ee.ApiFunction(name='test', signature=a_signature), a_signature + ) + + def testInitOptParams(self): + signature = {'hello': 'world', 'args': []} + self.assertEqual( + ee.ApiFunction(name='test', signature=signature), + ee.ApiFunction(name='test', opt_signature=signature), + ) + + def testImportApiOptParams(self): + args = dict( + target=ee.Dictionary, prefix='Dictionary', type_name='Dictionary' + ) + ee.ApiFunction.importApi(**args, prepend='test1_') + self.assertTrue(hasattr(ee.Dictionary, 'test1_getNumber')) + ee.ApiFunction.importApi(**args, opt_prepend='test2_') + self.assertTrue(hasattr(ee.Dictionary, 'test2_getNumber')) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/batch_test.py b/python/ee/tests/batch_test.py index 668120018..8add4f546 100644 --- a/python/ee/tests/batch_test.py +++ b/python/ee/tests/batch_test.py @@ -861,6 +861,35 @@ def testExportMapToCloudStorageCloudApi_WithV1Parameters(self): task_keyed.config, ) + def testExportMapToCloudStorageCloudApi_WithV1AlphaParameters(self): + """Verifies Export.map.toCloudStorage() tasks with v1alpha parameters.""" + with apitestcase.UsingCloudApi(): + task_keyed = ee.batch.Export.map.toCloudStorage( + image=ee.Image(0), + bucket='test-bucket', + minZoom=2, + maxWorkers=1, + maxZoom=3, + skipEmptyTiles=True, + ) + self.assertEqual( + { + 'expression': ee.Image(0), + 'description': 'myExportMapTask', + 'tileOptions': {'startZoom': 2, 'endZoom': 3, 'skipEmpty': True}, + 'tileExportOptions': { + 'fileFormat': 'AUTO_JPEG_PNG', + 'cloudStorageDestination': { + 'bucket': 'test-bucket', + 'filenamePrefix': 'myExportMapTask', + 'permissions': 'PUBLIC', + }, + }, + 'maxWorkers': {'value': 1}, + }, + task_keyed.config, + ) + def testExportTableCloudApi(self): """Verifies the task created by Export.table().""" with apitestcase.UsingCloudApi(): diff --git a/python/ee/tests/collection_test.py b/python/ee/tests/collection_test.py index f130d8037..032b2f02c 100644 --- a/python/ee/tests/collection_test.py +++ b/python/ee/tests/collection_test.py @@ -172,5 +172,44 @@ def testUnboundArguments(self): ): fc.map(lambda x: x.serialize()) + def testInitOptVarName(self): + result = ee.Collection(func=None, args=None, opt_varName='test').serialize() + self.assertIn('"argumentReference": "test"', result) + + def testFilterDateOptParams(self): + result = ( + ee.Collection(func=None, args=None, varName='test') + .filterDate(0, opt_end=42) + .serialize() + ) + self.assertIn('"end": {"constantValue": 42}', result) + + def testLimitOptParams(self): + result = ( + ee.Collection(func=None, args=None, varName='test') + .limit(0, opt_property='abc', opt_ascending=True) + .serialize() + ) + self.assertIn('"key": {"constantValue": "abc"}', result) + self.assertIn('"ascending": {"constantValue": true}', result) + + def testSortOptParams(self): + result = ( + ee.Collection(func=None, args=None, varName='test') + .sort('abc', opt_ascending=True) + .serialize() + ) + self.assertIn('"ascending": {"constantValue": true}', result) + + def testMapOptParams(self): + a_func = lambda x: ee.Image(0) + result = ( + ee.Collection(func=None, args=None, varName='test') + .map(a_func, opt_dropNulls=True) + .serialize() + ) + self.assertIn('"dropNulls": {"constantValue": true}', result) + + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/computedobject_test.py b/python/ee/tests/computedobject_test.py index 2083367d3..b4983e7cb 100644 --- a/python/ee/tests/computedobject_test.py +++ b/python/ee/tests/computedobject_test.py @@ -137,6 +137,11 @@ def test_is_func_returning_same(self): number_computed_object_func = number.add(1) self.assertTrue(number_computed_object_func) + def test_serialize_opt_params(self): + obj = ee.ComputedObject(func=None, args=None, varName='test') + self.assertIn('\n', obj.serialize(opt_pretty=True)) + self.assertNotIn('\n', obj.serialize(opt_pretty=False)) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/data_test.py b/python/ee/tests/data_test.py index cc6c8c328..bd0675ee0 100644 --- a/python/ee/tests/data_test.py +++ b/python/ee/tests/data_test.py @@ -754,6 +754,60 @@ def testWorkloadTag(self): ee.data.resetWorkloadTag(True) self.assertEqual('', ee.data.getWorkloadTag()) + def testResetWorkloadTagOptParams(self): + ee.data.setDefaultWorkloadTag('reset-me') + self.assertEqual('reset-me', ee.data.getWorkloadTag()) + ee.data.resetWorkloadTag(opt_resetDefault=True) + self.assertEqual('', ee.data.getWorkloadTag()) + + def testGetAssetRootQuota_V1Alpha(self): + cloud_api_resource = mock.MagicMock() + with apitestcase.UsingCloudApi(cloud_api_resource=cloud_api_resource): + fake_asset = { + 'type': 'FOLDER', + 'name': 'projects/test-proj/assets', + 'quota': { + 'assetCount': 123, + 'maxAssets': 456, + 'sizeBytes': 789, + 'maxSizeBytes': 1001, + }, + } + cloud_api_resource.projects().assets().get().execute.return_value = ( + fake_asset + ) + + quota = ee.data.getAssetRootQuota('projects/test-proj/assets') + expected = { + 'asset_count': {'usage': 123, 'limit': 456}, + 'asset_size': {'usage': 789, 'limit': 1001}, + } + self.assertEqual(expected, quota) + + def testGetAssetRootQuota(self): + cloud_api_resource = mock.MagicMock() + with apitestcase.UsingCloudApi(cloud_api_resource=cloud_api_resource): + fake_asset = { + 'type': 'FOLDER', + 'name': 'projects/test-proj/assets', + 'quota': { + 'assetCount': 123, + 'maxAssetCount': 456, + 'sizeBytes': 789, + 'maxSizeBytes': 1001, + }, + } + cloud_api_resource.projects().assets().get().execute.return_value = ( + fake_asset + ) + + quota = ee.data.getAssetRootQuota('projects/test-proj/assets') + expected = { + 'asset_count': {'usage': 123, 'limit': 456}, + 'asset_size': {'usage': 789, 'limit': 1001}, + } + self.assertEqual(expected, quota) + def DoCloudProfileStubHttp(test, expect_profiling): diff --git a/python/ee/tests/dictionary_test.py b/python/ee/tests/dictionary_test.py index 05e233e8c..efaddd2a8 100644 --- a/python/ee/tests/dictionary_test.py +++ b/python/ee/tests/dictionary_test.py @@ -2,6 +2,7 @@ """Test for the ee.dictionary module.""" import json from typing import Any, Dict +import unittest import ee from ee import apitestcase @@ -344,6 +345,24 @@ def test_toImage(self): result = json.loads(expression.serialize()) self.assertEqual(expect, result) + def test_encode_opt_params(self): + a_dict = ee.Dictionary({'x': 1}) + + mock_encoder = unittest.mock.Mock(return_value='encoded-value') + result = a_dict.encode(opt_encoder=mock_encoder) + + mock_encoder.assert_called() + self.assertEqual('encoded-value', result) + + def test_encode_cloud_value_opt_params(self): + a_dict = ee.Dictionary({'x': 1}) + + mock_encoder = unittest.mock.Mock(return_value='encoded-value') + result = a_dict.encode_cloud_value(opt_encoder=mock_encoder) + + mock_encoder.assert_called() + self.assertEqual({'valueReference': 'encoded-value'}, result) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/ee_date_test.py b/python/ee/tests/ee_date_test.py index 47764aec3..32093c291 100644 --- a/python/ee/tests/ee_date_test.py +++ b/python/ee/tests/ee_date_test.py @@ -337,6 +337,13 @@ def test_update(self): result = json.loads(expression.serialize()) self.assertEqual(expect, result) + def test_init_opt_params(self): + date = '2023-1-01T00:00:00.000Z' + result = ee.Date(date, opt_tz='US/Pacific').serialize() + self.assertIn( + '"value": {"constantValue": "2023-1-01T00:00:00.000Z"}', result + ) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/ee_number_test.py b/python/ee/tests/ee_number_test.py index ce233fdd1..7200fdc24 100644 --- a/python/ee/tests/ee_number_test.py +++ b/python/ee/tests/ee_number_test.py @@ -3,6 +3,7 @@ import json from typing import Any, Dict +import unittest import ee from ee import apitestcase @@ -1130,6 +1131,24 @@ def test_unitScale(self): result = json.loads(expression.serialize()) self.assertEqual(expect, result) + @unittest.mock.patch.object(ee.ComputedObject, 'encode') + def test_encode_opt_params(self, mock_encode): + number = ee.Number(ee.Dictionary({'a': 3}).get('a')) + + mock_encoder = unittest.mock.Mock() + number.encode(opt_encoder=mock_encoder) + + mock_encode.assert_called_once_with(mock_encoder) + + @unittest.mock.patch.object(ee.ComputedObject, 'encode_cloud_value') + def test_encode_cloud_value_opt_params(self, mock_encode_cloud_value): + number = ee.Number(ee.Dictionary({'a': 3}).get('a')) + + mock_encoder = unittest.mock.Mock() + number.encode_cloud_value(opt_encoder=mock_encoder) + + mock_encode_cloud_value.assert_called_once_with(mock_encoder) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/ee_string_test.py b/python/ee/tests/ee_string_test.py index 99f5b2f46..b473c14aa 100644 --- a/python/ee/tests/ee_string_test.py +++ b/python/ee/tests/ee_string_test.py @@ -2,6 +2,7 @@ """Test for the ee.string module.""" import json from typing import Any, Dict +import unittest import ee from ee import apitestcase @@ -263,6 +264,24 @@ def test_trim(self): result = json.loads(expression.serialize()) self.assertEqual(expect, result) + @unittest.mock.patch.object(ee.ComputedObject, 'encode') + def test_encode_opt_params(self, mock_encode): + a_string = ee.String(ee.Dictionary({'a': 'a_string'}).get('a')) + + mock_encoder = unittest.mock.Mock() + a_string.encode(opt_encoder=mock_encoder) + + mock_encode.assert_called_once_with(mock_encoder) + + @unittest.mock.patch.object(ee.ComputedObject, 'encode_cloud_value') + def test_encode_cloud_value_opt_params(self, mock_encode_cloud_value): + a_string = ee.String(ee.Dictionary({'a': 'a_string'}).get('a')) + + mock_encoder = unittest.mock.Mock() + a_string.encode_cloud_value(opt_encoder=mock_encoder) + + mock_encode_cloud_value.assert_called_once_with(mock_encoder) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/element_test.py b/python/ee/tests/element_test.py index 675d31165..862272ad0 100644 --- a/python/ee/tests/element_test.py +++ b/python/ee/tests/element_test.py @@ -44,6 +44,10 @@ def CheckMultiProperties(result): CheckMultiProperties(image.set(computed_arg)) CheckMultiProperties(image.set({'properties': computed_arg})) + def testInitOptParams(self): + result = ee.Element(func=None, args=None, opt_varName='test').serialize() + self.assertIn('"0": {"argumentReference": "test"}', result) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/feature_test.py b/python/ee/tests/feature_test.py index 265788caf..c829c49a2 100644 --- a/python/ee/tests/feature_test.py +++ b/python/ee/tests/feature_test.py @@ -69,6 +69,12 @@ def testGetMap(self): self.assertEqual('fakeMapId', mapid['mapid']) self.assertEqual(manual.serialize(), mapid['image'].serialize()) + def testInitOptParams(self): + result = ee.Feature( + geom=ee.Geometry.Point(1, 2), opt_properties=dict(prop='a') + ).serialize() + self.assertIn('"metadata": {"constantValue": {"prop": "a"}}', result) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/featurecollection_test.py b/python/ee/tests/featurecollection_test.py index 0555278fb..df65537ed 100644 --- a/python/ee/tests/featurecollection_test.py +++ b/python/ee/tests/featurecollection_test.py @@ -110,5 +110,12 @@ def equals(c1, c2): equals(fc.select(['a'], None, False), fc.select(propertySelectors=['a'], retainGeometry=False)) + def testInitOptColumn(self): + result = ee.FeatureCollection( + args='[{}]', opt_column='a-column' + ).serialize() + self.assertIn('"geometryColumn": {"constantValue": "a-column"}', result) + + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/filter_test.py b/python/ee/tests/filter_test.py index c5b52075c..f063bd455 100644 --- a/python/ee/tests/filter_test.py +++ b/python/ee/tests/filter_test.py @@ -118,6 +118,34 @@ def testInternals(self): self.assertNotEqual(b, c) self.assertNotEqual(hash(a), hash(b)) + def testInitOptParams(self): + result = ee.Filter(opt_filter=[ee.Filter.gt('prop', 1)]).serialize() + self.assertIn('"functionName": "Filter.greaterThan"', result) + + def test_date_opt_params(self): + result = ee.Filter.date( + start='1996-01-01T00:00', opt_end='2023-01-01T00:00' + ).serialize() + self.assertIn('"end": {"constantValue": "2023-01-01T00:00"}', result) + + def test_in_list_opt_params(self): + result = ee.Filter.inList( + opt_leftField='lf', + opt_rightValue='rv', + opt_rightField='rf', + opt_leftValue='lv', + ).serialize() + self.assertIn('"leftField": {"constantValue": "rf"}', result) + self.assertIn('"leftValue": {"constantValue": "rv"}', result) + self.assertIn('"rightField": {"constantValue": "lf"}', result) + self.assertIn('"rightValue": {"constantValue": "lv"}', result) + + def test_bounds_opt_params(self): + result = ee.Filter.bounds( + geometry=ee.Geometry.Point(0, 0), opt_errorMargin=12345 + ).serialize() + self.assertIn('"value": {"constantValue": 12345}', result) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/geometry_test.py b/python/ee/tests/geometry_test.py index 53a00ae8b..7ebf8303c 100644 --- a/python/ee/tests/geometry_test.py +++ b/python/ee/tests/geometry_test.py @@ -495,6 +495,17 @@ def testInternals(self): self.assertNotEqual(b, c) self.assertNotEqual(hash(a), hash(b)) + def testInitOptParams(self): + result = ee.Geometry( + geo_json={'type': 'Polygon', 'coordinates': [[[-2, 1]]]}, + opt_proj='abc', + opt_geodesic=True, + opt_evenOdd=True, + ).serialize() + self.assertIn('"crs": {"constantValue": "abc"}', result) + self.assertIn('"geodesic": {"constantValue": true}', result) + self.assertIn('"evenOdd": {"constantValue": true}', result) + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/image_test.py b/python/ee/tests/image_test.py index 138579e7d..c5f5a6bfa 100644 --- a/python/ee/tests/image_test.py +++ b/python/ee/tests/image_test.py @@ -675,5 +675,27 @@ def testMorphologicalOperators(self): """Verifies the focal operators are installed with aliases.""" ee.Image(0).focal_min().focalMin() + def testSelectOptParams(self): + result = ( + ee.Image(1) + .select(opt_selectors=['selector_a', 4], opt_names=['name_a', 'name_b']) + .serialize() + ) + self.assertIn( + '"bandSelectors": {"constantValue": ["selector_a", 4]}', result + ) + self.assertIn('"newNames": {"constantValue": ["name_a", "name_b"]}', result) + + def testExpressionOptParams(self): + result = ( + ee.Image(1) + .expression(expression='abc(0)', opt_map={'bcd': 'cef'}) + .serialize() + ) + # The values are nested too deep to compare the entire node. + self.assertIn('bcd', result) + self.assertIn('cef', result) + + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/imagecollection_test.py b/python/ee/tests/imagecollection_test.py index b26b5d3d2..e7da0cc60 100644 --- a/python/ee/tests/imagecollection_test.py +++ b/python/ee/tests/imagecollection_test.py @@ -88,5 +88,14 @@ def expected_preparation_function(img): collection.serialize(for_cloud_api=True)) self.assertEqual({}, params) + def testSelectOptParams(self): + result = ( + ee.ImageCollection([]) + .select(['selector_a', 4], opt_names=['name_a', 'name_b']) + .serialize() + ) + self.assertIn('"newNames": {"constantValue": ["name_a", "name_b"]}', result) + + if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/oauth_test.py b/python/ee/tests/oauth_test.py index 39296446f..b81e33422 100644 --- a/python/ee/tests/oauth_test.py +++ b/python/ee/tests/oauth_test.py @@ -59,6 +59,5 @@ def mock_credentials_path(): def test_in_colab_shell(self): self.assertFalse(ee.oauth.in_colab_shell()) - if __name__ == '__main__': unittest.main() diff --git a/python/ee/tests/serializer_test.py b/python/ee/tests/serializer_test.py index ad18c7a70..0a01753c1 100644 --- a/python/ee/tests/serializer_test.py +++ b/python/ee/tests/serializer_test.py @@ -280,6 +280,10 @@ def testDepthLimit_withDictionaries(self): encoded = serializer.encode(x, for_cloud_api=True) self.assertLess(_max_depth(encoded), 60) + def testToJsonOptParams(self): + self.assertIn('\n', serializer.toJSON(ee.Image(0), opt_pretty=True)) + self.assertNotIn('\n', serializer.toJSON(ee.Image(0), opt_pretty=False)) + if __name__ == '__main__': unittest.main() diff --git a/python/examples/py/Image/hsv_pan_sharpen.py b/python/examples/py/Image/hsv_pan_sharpen.py index e1c4b3a77..b651a87fd 100644 --- a/python/examples/py/Image/hsv_pan_sharpen.py +++ b/python/examples/py/Image/hsv_pan_sharpen.py @@ -23,5 +23,5 @@ # Display before and after layers using the same vis parameters. visparams = {'min': [.15, .15, .25], 'max': [1, .9, .9], 'gamma': 1.6} -ee.mapclient.addToMap(rgb, visparams, 'Orignal') +ee.mapclient.addToMap(rgb, visparams, 'Original') ee.mapclient.addToMap(upres, visparams, 'Pansharpened') diff --git a/python/pyproject.toml b/python/pyproject.toml index b12c9d08e..1f12b8ad1 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "earthengine-api" -version = "0.1.400" +version = "0.1.401" description = "Earth Engine Python API" requires-python = ">=3.7" keywords = [