-
Notifications
You must be signed in to change notification settings - Fork 978
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
43 changed files
with
1,198 additions
and
1,155 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 |
---|---|---|
@@ -1,26 +1 @@ | ||
All contributors to the Earth Engine API libraries must sign a CLA. | ||
|
||
What is a CLA? | ||
---------------------------------------- | ||
|
||
A CLA (Contributor License Agreement) basically says that you own the | ||
rights to any code you contribute, and that you give us permission to | ||
use that code in the Earth Engine API libraries. You maintain the | ||
copyright on that code. | ||
|
||
Where do I sign up? | ||
---------------------------------------- | ||
|
||
If you own all the rights to your code, you can fill out an individual CLA. | ||
http://code.google.com/legal/individual-cla-v1.0.html | ||
|
||
If your employer has any rights to your code, then they also need to fill | ||
out a corporate CLA. If you don't know if your employer has any rights | ||
to your code, you should ask before signing anything. | ||
http://code.google.com/legal/corporate-cla-v1.0.html | ||
|
||
CLA Signers | ||
---------------------------------------- | ||
|
||
By default, anyone with an @google.com email address already has a CLA | ||
signed for them. Congratulations! | ||
The Earth Engine API clients are not currently accepting pull requests. |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
* This class manages the algorithm dictionary and creates JavaScript functions | ||
* to apply each EE algorithm. | ||
* | ||
* @author [email protected] (Max Shawabkeh) | ||
*/ | ||
|
||
goog.provide('ee.ApiFunction'); | ||
|
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/** | ||
* @fileoverview Base class for ImageCollection and FeatureCollection. | ||
* This class is never intended to be instantiated by the user. | ||
* @author [email protected] (Noel Gorelick) | ||
*/ | ||
|
||
goog.provide('ee.Collection'); | ||
|
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/** | ||
* @fileoverview A representation of a computed earthengine object. | ||
* | ||
* @author [email protected] (Noel Gorelick) | ||
*/ | ||
|
||
goog.provide('ee.ComputedObject'); | ||
|
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/** | ||
* @fileoverview An object representing a custom EE Function. | ||
* @author [email protected] (Max Shawabkeh) | ||
*/ | ||
|
||
goog.provide('ee.CustomFunction'); | ||
|
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/** | ||
* @fileoverview Singleton for all of the library's communication | ||
* with the Earth Engine API. | ||
* @author [email protected] (Noel Gorelick) | ||
* @suppress {missingRequire} TODO(user): this shouldn't be needed | ||
* @suppress {useOfGoogProvide} TODO(user): Convert to goog.module. | ||
*/ | ||
|
@@ -75,6 +76,7 @@ goog.require('goog.singleton'); | |
goog.requireType('ee.Collection'); | ||
goog.requireType('ee.ComputedObject'); | ||
goog.requireType('ee.Element'); | ||
goog.requireType('ee.Encodable'); | ||
goog.requireType('ee.Image'); | ||
goog.requireType('ee.data.images'); | ||
goog.requireType('proto.google.protobuf.Value'); | ||
|
@@ -556,10 +558,12 @@ ee.data.listFeatures = function(asset, params, opt_callback) { | |
*/ | ||
ee.data.computeValue = function(obj, opt_callback) { | ||
const serializer = new ee.Serializer(true); | ||
const expression = ee.data.expressionAugmenter_( | ||
ee.Serializer.encodeCloudApiExpressionWithSerializer( | ||
serializer, obj, /* unboundName= */ undefined)); | ||
const request = {expression}; | ||
const expression = ee.Serializer.encodeCloudApiExpressionWithSerializer( | ||
serializer, obj, /* unboundName= */ undefined); | ||
let extraMetadata = {}; | ||
const request = { | ||
expression: ee.data.expressionAugmenter_(expression, extraMetadata) | ||
}; | ||
const workloadTag = ee.data.getWorkloadTag(); | ||
if (workloadTag) { | ||
request.workloadTag = workloadTag; | ||
|
@@ -961,7 +965,7 @@ ee.data.makeTableDownloadUrl = function(id) { | |
* returned by ee.data.startProcessing and other batch methods. | ||
* | ||
* @param {number=} opt_count The number of IDs to generate, one by default. | ||
* @param {function(!Array.<string>, string=)=} opt_callback An optional | ||
* @param {function(?Array.<string>, string=)=} opt_callback An optional | ||
* callback. If not supplied, the call is made synchronously. | ||
* @return {?Array.<string>} An array containing generated ID strings, or null | ||
* if a callback is specified. | ||
|
@@ -979,6 +983,16 @@ ee.data.newTaskId = function(opt_count, opt_callback) { | |
}; | ||
|
||
|
||
/** | ||
* Indicator function to determine if a response is an operation error. | ||
* @param {!Object} response Response from a JSON API call. | ||
* @return {boolean} | ||
*/ | ||
ee.data.isOperationError_ = function(response) { | ||
return response['name'] && response['done'] && response['error']; | ||
}; | ||
|
||
|
||
/** | ||
* Retrieve status of one or more long-running tasks. | ||
* | ||
|
@@ -997,13 +1011,16 @@ ee.data.getTaskStatus = function(taskId, opt_callback) { | |
ee.rpc_convert.taskIdToOperationName); | ||
if (opNames.length === 1) { | ||
const getResponse = (op) => [ee.rpc_convert.operationToTask(op)]; | ||
const call = new ee.apiclient.Call(opt_callback); | ||
// Return operation and don't throw error if operation itself had an error. | ||
const call = new ee.apiclient.Call(opt_callback) | ||
.withDetectPartialError(ee.data.isOperationError_); | ||
return call.handle(call.operations().get(opNames[0]).then(getResponse)); | ||
} | ||
const getResponse = (data) => | ||
opNames.map(id => ee.rpc_convert.operationToTask(data[id])); | ||
|
||
const call = new ee.apiclient.BatchCall(opt_callback); | ||
const call = new ee.apiclient.BatchCall(opt_callback) | ||
.withDetectPartialError(ee.data.isOperationError_); | ||
const operations = call.operations(); | ||
return call.send(opNames.map(op => [op, operations.get(op)]), getResponse); | ||
}; | ||
|
@@ -1171,10 +1188,13 @@ ee.data.getOperation = function(operationName, opt_callback) { | |
const opNames = ee.data.makeStringArray_(operationName) | ||
.map(ee.rpc_convert.taskIdToOperationName); | ||
if (!Array.isArray(operationName)) { | ||
const call = new ee.apiclient.Call(opt_callback); | ||
// Return operation and don't throw error if operation itself had an error. | ||
const call = new ee.apiclient.Call(opt_callback) | ||
.withDetectPartialError(ee.data.isOperationError_); | ||
return call.handle(call.operations().get(opNames[0])); | ||
} | ||
const call = new ee.apiclient.BatchCall(opt_callback); | ||
const call = new ee.apiclient.BatchCall(opt_callback) | ||
.withDetectPartialError(ee.data.isOperationError_); | ||
const operations = call.operations(); | ||
return call.send(opNames.map(op => [op, operations.get(op)])); | ||
}; | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
* We don't autogenerate this class because we want the constructor | ||
* to promote by pushing things through the server-side Date() function. | ||
* | ||
* @author [email protected] (Noel Gorelick) | ||
*/ | ||
|
||
goog.provide('ee.Date'); | ||
|
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/** | ||
* @fileoverview A deserializer that decodes EE object trees from JSON DAGs. | ||
* | ||
* @author [email protected] (Max Shawabkeh) | ||
*/ | ||
|
||
goog.provide('ee.Deserializer'); | ||
|
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/** | ||
* @fileoverview A wrapper for dicts. | ||
* @author [email protected] (Noel Gorelick) | ||
*/ | ||
|
||
goog.provide('ee.Dictionary'); | ||
|
Oops, something went wrong.