Skip to content

Commit

Permalink
v0.1.399
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 623562928
  • Loading branch information
Google Earth Engine Authors authored and schwehr committed Apr 17, 2024
1 parent b85f7af commit b191918
Show file tree
Hide file tree
Showing 17 changed files with 1,566 additions and 473 deletions.
54 changes: 27 additions & 27 deletions javascript/build/ee_api_js.js

Large diffs are not rendered by default.

285 changes: 82 additions & 203 deletions javascript/build/ee_api_js_debug.js

Large diffs are not rendered by default.

331 changes: 105 additions & 226 deletions javascript/build/ee_api_js_npm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@google/earthengine",
"version": "0.1.398",
"version": "0.1.399",
"description": "JavaScript client for Google Earth Engine API.",
"author": "Google LLC",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion javascript/src/apiclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const {trustedResourceUrl} = goog.require('safevalues');
/** @namespace */
const apiclient = {};

const API_CLIENT_VERSION = '0.1.398';
const API_CLIENT_VERSION = '0.1.399';

exports.VERSION = apiVersion.VERSION;
exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
Expand Down
2 changes: 1 addition & 1 deletion javascript/src/eeapiclient/promise_request_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export abstract class PromiseRequestService {
);
}

abstract makeRequest(params: MakeRequestParams): Promise<{}>;
abstract makeRequest(params: MakeRequestParams): Promise<unknown>;
}
4 changes: 2 additions & 2 deletions javascript/src/geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {

/**
* The coordinates of the geometry, up to 4 nested levels with numbers at
* the last level. Null iff type is GeometryCollection.
* the last level. Null if and only if type is GeometryCollection.
* @type {Array?}
* @private
*/
Expand All @@ -121,7 +121,7 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {
null;

/**
* The subgeometries, non-null iff type is GeometryCollection.
* The subgeometries, non-null if and only if type is GeometryCollection.
* @type {Array?}
* @private
*/
Expand Down
3 changes: 2 additions & 1 deletion javascript/src/profiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ ee.data.Profiler = class extends goog.events.EventTarget {
this.isEnabled_ = false;

/**
* Non-null unique object iff we have a refresh request outstanding.
* Non-null unique object if and only if we have a refresh request
* outstanding.
* @private {?Object}
*/
this.lastRefreshToken_ = null;
Expand Down
2 changes: 1 addition & 1 deletion python/ee/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""The EE Python library."""

__version__ = '0.1.398'
__version__ = '0.1.399'

# Using lowercase function naming to match the JavaScript names.
# pylint: disable=g-bad-name
Expand Down
3 changes: 2 additions & 1 deletion python/ee/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def getList(params: Dict[str, Any]) -> Any:

def listImages(
params: Union[str, Dict[str, Any]],
) -> Dict[str, Optional[List[int]]]:
) -> Dict[str, Optional[List[Any]]]:
"""Returns the images in an image collection or folder.
Args:
Expand Down Expand Up @@ -1927,6 +1927,7 @@ def startIngestion(
'overwrite':
allow_overwrite
}

# It's only safe to retry the request if there's a unique ID to make it
# idempotent.
num_retries = MAX_RETRIES if request_id else 0
Expand Down
207 changes: 207 additions & 0 deletions python/ee/ee_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,210 @@ def encode_cloud_value(self, encoder: Any = None) -> Any:
return _cloud_api_utils.encode_number_as_cloud_value(self._number)
else:
return super().encode_cloud_value(encoder)

def abs(self) -> 'Number':
"""Computes the absolute value of the input."""

return apifunction.ApiFunction.call_(self.name() + '.abs', self)

def acos(self) -> 'Number':
"""Computes the arccosine in radians of the input."""

return apifunction.ApiFunction.call_(self.name() + '.acos', self)

def add(self, right: _NumberType) -> 'Number':
"""Adds the right value.
Args:
right: The value to add to the current ee.Number.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(self.name() + '.add', self, right)

# `and` is not allowed by the Python parser.
def And(self, right: _NumberType) -> 'Number':
"""Returns 1 if and only if both values are non-zero.
Args:
right: The value to and with the current ee.Number.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(self.name() + '.and', self, right)

def asin(self) -> 'Number':
"""Computes the arcsine in radians of the input."""

return apifunction.ApiFunction.call_(self.name() + '.asin', self)

def atan(self) -> 'Number':
"""Computes the arctangent in radians of the input."""

return apifunction.ApiFunction.call_(self.name() + '.atan', self)

def atan2(self, right: _NumberType) -> 'Number':
"""Calculates the angle in radians formed by the 2D vector [x, y].
Args:
right: The second value of the atan2 call.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(self.name() + '.atan2', self, right)

def bitCount(self) -> 'Number':
"""Returns the number of one-bits in the Number.
Calculates the number of one-bits in the 64-bit two's complement binary
representation of the input.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(self.name() + '.bitCount', self)

def bitwiseAnd(self, right: _NumberType) -> 'Number':
"""Calculates the bitwise AND of the input values.
Args:
right: The value to do the bitwise AND with.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(
self.name() + '.bitwiseAnd', self, right
)

def bitwiseNot(self) -> 'Number':
"""Returns the bitwise NOT of the input.
Uses the smallest signed integer type that can hold the input.
"""

return apifunction.ApiFunction.call_(self.name() + '.bitwiseNot', self)

def bitwiseOr(self, right: _NumberType) -> 'Number':
"""Calculates the bitwise OR of the input values.
Args:
right: The value to OR with.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(
self.name() + '.bitwiseOr', self, right
)

def bitwiseXor(self, right: _NumberType) -> 'Number':
"""Calculates the bitwise XOR of the input values.
Args:
right: The right-hand value.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(
self.name() + '.bitwiseXor', self, right
)

def byte(self) -> 'Number':
"""Casts the input value to an unsigned 8-bit integer."""

return apifunction.ApiFunction.call_(self.name() + '.byte', self)

def cbrt(self) -> 'Number':
"""Computes the cubic root of the input."""

return apifunction.ApiFunction.call_(self.name() + '.cbrt', self)

def ceil(self) -> 'Number':
"""Computes the smallest integer greater than or equal to the input."""

return apifunction.ApiFunction.call_(self.name() + '.ceil', self)

# TODO: Add clamp method with `min` and `max` args.

def cos(self) -> 'Number':
"""Computes the cosine of the input in radians."""

return apifunction.ApiFunction.call_(self.name() + '.cos', self)

def cosh(self) -> 'Number':
"""Computes the hyperbolic cosine of the input."""

return apifunction.ApiFunction.call_(self.name() + '.cosh', self)

def digamma(self) -> 'Number':
"""Computes the digamma function of the input."""

return apifunction.ApiFunction.call_(self.name() + '.digamma', self)

def divide(self, right: _NumberType) -> 'Number':
"""Divides the first value by the second, returning 0 for division by 0.
Args:
right: The value to divide by.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(self.name() + '.divide', self, right)

def double(self) -> 'Number':
"""Casts the input value to a 64-bit float."""

return apifunction.ApiFunction.call_(self.name() + '.double', self)

def eq(self, right: _NumberType) -> 'Number':
"""Returns 1 if and only if the first value is equal to the second.
Args:
right: The value to compare to.
Returns:
An ee.Number.
"""

return apifunction.ApiFunction.call_(self.name() + '.eq', self, right)

def erf(self) -> 'Number':
"""Computes the error function of the input."""

return apifunction.ApiFunction.call_(self.name() + '.erf', self)

def erfInv(self) -> 'Number':
"""Computes the inverse error function of the input."""

return apifunction.ApiFunction.call_(self.name() + '.erfInv', self)

def erfc(self) -> 'Number':
"""Computes the complementary error function of the input."""

return apifunction.ApiFunction.call_(self.name() + '.erfc', self)

def erfcInv(self) -> 'Number':
"""Computes the inverse complementary error function of the input."""

return apifunction.ApiFunction.call_(self.name() + '.erfcInv', self)

def exp(self) -> 'Number':
"""Computes the Euler's number e raised to the power of the input."""

return apifunction.ApiFunction.call_(self.name() + '.exp', self)

# TODO: Add expression staticmethod
2 changes: 1 addition & 1 deletion python/ee/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def Not(self):
"""Returns the opposite of this filter.
Returns:
The negated filter, which will match iff this filter doesn't.
The negated filter, which will match if and only if this filter does not.
"""
return apifunction.ApiFunction.call_('Filter.not', self)

Expand Down
2 changes: 1 addition & 1 deletion python/ee/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(
self._type = geo_json['type']

# The coordinates of the geometry, up to 4 nested levels with numbers at
# the last level. None iff type is GeometryCollection.
# the last level. None if and only if type is GeometryCollection.
self._coordinates = geo_json.get('coordinates')

# The subgeometries, None unless type is GeometryCollection.
Expand Down
10 changes: 4 additions & 6 deletions python/ee/tests/algorithms.json
Original file line number Diff line number Diff line change
Expand Up @@ -11071,7 +11071,7 @@
}]
}, {
"name": "algorithms/reduce.and",
"description": "Reduces an image collection by setting each pixel to 1 iff all the non-masked values at that pixel are non-zero across the stack of all matching bands. Bands are matched by name.",
"description": "Reduces an image collection by setting each pixel to 1 if and only if all the non-masked values at that pixel are non-zero across the stack of all matching bands. Bands are matched by name.",
"returnType": "Image\u003cunknown bands\u003e",
"arguments": [{
"argumentName": "collection",
Expand All @@ -11080,7 +11080,7 @@
}]
}, {
"name": "algorithms/reduce.or",
"description": "Reduces an image collection by setting each pixel to 1 iff any of the non-masked values at that pixel are non-zero across the stack of all matching bands. Bands are matched by name.",
"description": "Reduces an image collection by setting each pixel to 1 if and only if any of the non-masked values at that pixel are non-zero across the stack of all matching bands. Bands are matched by name.",
"returnType": "Image\u003cunknown bands\u003e",
"arguments": [{
"argumentName": "collection",
Expand Down Expand Up @@ -11626,9 +11626,7 @@
"type": "Dictionary\u003cObject\u003e"
}, {
"argumentName": "key",
"type": "String",
"optional": true,
"defaultValue": null
"type": "String"
}]
}, {
"name": "algorithms/Dictionary.fromLists",
Expand Down Expand Up @@ -15739,7 +15737,7 @@
}]
}, {
"name": "algorithms/Reducer.kendallsCorrelation",
"description": "Creates a reducer that computes the Kendall\u0027s Tau-b rank correlation. A positive tau value indicates an increasing trend; negative value indicates a decreasing trend. See https://commons.apache.org/proper/commons-math/javadocs/api-3.6/org/apache/commons/math3/stat/correlation/KendallsCorrelation.html for details.",
"description": "Creates a reducer that computes the Kendall\u0027s Tau-b rank correlation. A positive tau value indicates an increasing trend; negative value indicates a decreasing trend. See https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/stat/correlation/KendallsCorrelation.html for details.",
"returnType": "Reducer",
"arguments": [{
"argumentName": "numInputs",
Expand Down
31 changes: 31 additions & 0 deletions python/ee/tests/data_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,37 @@ def testCreateFolder(self):
asset = mock_create_asset.call_args.kwargs['body']
self.assertEqual(asset, {'type': 'FOLDER'})

@unittest.skip('Does not work on github with python 3.7')
def testStartIngestion(self):
cloud_api_resource = mock.MagicMock()
with apitestcase.UsingCloudApi(cloud_api_resource=cloud_api_resource):
mock_result = {'name': 'operations/ingestion', 'done': False}
cloud_api_resource.projects().image().import_().execute.return_value = (
mock_result
)
manifest = {
'id': 'projects/some-project/assets/some-name',
'arg': 'something',
}
result = ee.data.startIngestion(
'request_id',
manifest,
True
)
self.assertEqual(result['id'], 'ingestion')
self.assertEqual(result['name'], 'operations/ingestion')

mock_import = cloud_api_resource.projects().image().import_
import_args = mock_import.call_args.kwargs['body']
self.assertEqual(
import_args['imageManifest'],
{
'name': 'projects/some-project/assets/some-name',
'arg': 'something',
},
)
self.assertTrue(import_args['overwrite'])

def testSetAssetProperties(self):
mock_http = mock.MagicMock(httplib2.Http)
with apitestcase.UsingCloudApi(mock_http=mock_http), mock.patch.object(
Expand Down
Loading

0 comments on commit b191918

Please sign in to comment.