Skip to content

Commit

Permalink
v0.1.386
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 597577360
  • Loading branch information
Google Earth Engine Authors authored and sufyanAbbasi committed Jan 18, 2024
1 parent a898ffc commit 8fee1d9
Show file tree
Hide file tree
Showing 69 changed files with 1,131 additions and 846 deletions.
664 changes: 334 additions & 330 deletions javascript/build/ee_api_js.js

Large diffs are not rendered by default.

301 changes: 122 additions & 179 deletions javascript/build/ee_api_js_debug.js

Large diffs are not rendered by default.

345 changes: 144 additions & 201 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.385",
"version": "0.1.386",
"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 @@ -25,7 +25,7 @@ const {trustedResourceUrl} = goog.require('safevalues');
/** @namespace */
const apiclient = {};

const API_CLIENT_VERSION = '0.1.385';
const API_CLIENT_VERSION = '0.1.386';

exports.VERSION = apiVersion.VERSION;
exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
Expand Down
9 changes: 7 additions & 2 deletions python/ee/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
"""The EE Python library."""

__version__ = '0.1.385'
__version__ = '0.1.386'

# Using lowercase function naming to match the JavaScript names.
# pylint: disable=g-bad-name
Expand Down Expand Up @@ -37,13 +36,15 @@
from .ee_string import String
from .element import Element
from .encodable import Encodable
from .errormargin import ErrorMargin
from .feature import Feature
from .featurecollection import FeatureCollection
from .filter import Filter
from .function import Function
from .geometry import Geometry
from .image import Image
from .imagecollection import ImageCollection
from .join import Join
from .pixeltype import PixelType
from .serializer import Serializer
from .terrain import Terrain
Expand Down Expand Up @@ -163,12 +164,14 @@ def Initialize(
Date.initialize()
Dictionary.initialize()
Element.initialize()
ErrorMargin.initialize()
Feature.initialize()
FeatureCollection.initialize()
Filter.initialize()
Geometry.initialize()
Image.initialize()
ImageCollection.initialize()
Join.initialize()
List.initialize()
Number.initialize()
PixelType.initialize()
Expand All @@ -191,12 +194,14 @@ def Reset() -> None:
Blob.reset()
Date.reset()
Dictionary.reset()
ErrorMargin.reset()
Feature.reset()
FeatureCollection.reset()
Filter.reset()
Geometry.reset()
Image.reset()
ImageCollection.reset()
Join.reset()
List.reset()
Number.reset()
PixelType.reset()
Expand Down
1 change: 0 additions & 1 deletion python/ee/_cloud_api_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Earth Engine helper functions for working with the Cloud API.
Many of the functions defined here are for mapping legacy calls in ee.data into
Expand Down
1 change: 0 additions & 1 deletion python/ee/_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Convenience functions and code used by ee/__init__.py.
These functions are in general re-exported from the "ee" module and should be
Expand Down
1 change: 0 additions & 1 deletion python/ee/_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""General decorators and helper methods which should not import ee."""

import functools
Expand Down
1 change: 0 additions & 1 deletion python/ee/apifunction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A class for representing built-in EE API Function.
Earth Engine can dynamically produce a JSON array listing the
Expand Down
1 change: 0 additions & 1 deletion python/ee/apitestcase.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A TestCase that initializes the library with standard API methods."""

import contextlib
Expand Down
135 changes: 65 additions & 70 deletions python/ee/batch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""An interface to the Earth Engine batch processing system.
Use the static methods on the Export class to create export tasks, call start()
Expand Down Expand Up @@ -360,43 +359,41 @@ def toCloudStorage(image,
description: Human-readable name of the task.
bucket: The name of a Cloud Storage bucket for the export.
fileNamePrefix: Cloud Storage object name prefix for the export.
Defaults to the name of the task.
dimensions: The dimensions of the exported image. Takes either a
single positive integer as the maximum dimension or "WIDTHxHEIGHT"
where WIDTH and HEIGHT are each positive integers.
region: The lon,lat coordinates for a LinearRing or Polygon
specifying the region to export. Can be specified as a nested
lists of numbers or a serialized string. Defaults to the image's
region.
scale: The resolution in meters per pixel. Defaults to the
native resolution of the image asset unless a crsTransform
is specified.
crs: The coordinate reference system of the exported image's
projection. Defaults to the image's default projection.
crsTransform: A comma-separated string of 6 numbers describing
the affine transform of the coordinate reference system of the
exported image's projection, in the order: xScale, xShearing,
xTranslation, yShearing, yScale and yTranslation. Defaults to
the image's native CRS transform.
maxPixels: The maximum allowed number of pixels in the exported
image. The task will fail if the exported region covers more
pixels in the specified projection. Defaults to 100,000,000.
Defaults to the name of the task.
dimensions: The dimensions of the exported image. Takes either a single
positive integer as the maximum dimension or "WIDTHxHEIGHT" where
WIDTH and HEIGHT are each positive integers.
region: The lon,lat coordinates for a LinearRing or Polygon specifying
the region to export. Can be specified as a nested lists of numbers or
a serialized string. Defaults to the image's region.
scale: The resolution in meters per pixel. Defaults to the native
resolution of the image asset unless a crsTransform is specified.
crs: The coordinate reference system of the exported image's projection.
Defaults to the image's default projection.
crsTransform: A comma-separated string of 6 numbers describing the
affine transform of the coordinate reference system of the exported
image's projection, in the order: xScale, xShearing, xTranslation,
yShearing, yScale and yTranslation. Defaults to the image's native CRS
transform.
maxPixels: The maximum allowed number of pixels in the exported image.
The task will fail if the exported region covers more pixels in the
specified projection. Defaults to 100,000,000.
shardSize: Size in pixels of the tiles in which this image will be
computed. Defaults to 256.
computed. Defaults to 256.
fileDimensions: The dimensions in pixels of each image file, if the
image is too large to fit in a single file. May specify a
single number to indicate a square shape, or a tuple of two
dimensions to indicate (width,height). Note that the image will
still be clipped to the overall image dimensions. Must be a
multiple of shardSize.
skipEmptyTiles: If true, skip writing empty (i.e. fully-masked)
image tiles. Defaults to false. Only supported on GeoTIFF exports.
image is too large to fit in a single file. May specify a single
number to indicate a square shape, or a tuple of two dimensions to
indicate (width,height). Note that the image will still be clipped to
the overall image dimensions. Must be a multiple of shardSize.
skipEmptyTiles: If true, skip writing empty (i.e. fully-masked) image
tiles. Defaults to false. Only supported on GeoTIFF exports.
fileFormat: The string file format to which the image is exported.
Currently only 'GeoTIFF' and 'TFRecord' are supported, defaults to
'GeoTIFF'.
formatOptions: A dictionary of string keys to format specific options.
Currently only 'GeoTIFF' and 'TFRecord' are supported, defaults to
'GeoTIFF'.
formatOptions: A dictionary of string keys to format-specific options.
For 'GeoTIFF': 'cloudOptimized' (bool), 'noData' (float).
**kwargs: Holds other keyword arguments that may have been deprecated
such as 'crs_transform'.
such as 'crs_transform'.
Returns:
An unstarted Task that exports the image to Google Cloud Storage.
Expand Down Expand Up @@ -428,46 +425,44 @@ def toDrive(image,
Args:
image: The image to be exported.
description: Human-readable name of the task.
folder: The name of a unique folder in your Drive account to
export into. Defaults to the root of the drive.
fileNamePrefix: The Google Drive filename for the export.
Defaults to the name of the task.
dimensions: The dimensions of the exported image. Takes either a
single positive integer as the maximum dimension or "WIDTHxHEIGHT"
where WIDTH and HEIGHT are each positive integers.
region: The lon,lat coordinates for a LinearRing or Polygon
specifying the region to export. Can be specified as a nested
lists of numbers or a serialized string. Defaults to the image's
region.
scale: The resolution in meters per pixel. Defaults to the
native resolution of the image asset unless a crsTransform
is specified.
crs: The coordinate reference system of the exported image's
projection. Defaults to the image's default projection.
crsTransform: A comma-separated string of 6 numbers describing
the affine transform of the coordinate reference system of the
exported image's projection, in the order: xScale, xShearing,
xTranslation, yShearing, yScale and yTranslation. Defaults to
the image's native CRS transform.
maxPixels: The maximum allowed number of pixels in the exported
image. The task will fail if the exported region covers more
pixels in the specified projection. Defaults to 100,000,000.
folder: The name of a unique folder in your Drive account to export
into. Defaults to the root of the drive.
fileNamePrefix: The Google Drive filename for the export. Defaults to
the name of the task.
dimensions: The dimensions of the exported image. Takes either a single
positive integer as the maximum dimension or "WIDTHxHEIGHT" where
WIDTH and HEIGHT are each positive integers.
region: The lon,lat coordinates for a LinearRing or Polygon specifying
the region to export. Can be specified as a nested lists of numbers or
a serialized string. Defaults to the image's region.
scale: The resolution in meters per pixel. Defaults to the native
resolution of the image asset unless a crsTransform is specified.
crs: The coordinate reference system of the exported image's projection.
Defaults to the image's default projection.
crsTransform: A comma-separated string of 6 numbers describing the
affine transform of the coordinate reference system of the exported
image's projection, in the order: xScale, xShearing, xTranslation,
yShearing, yScale and yTranslation. Defaults to the image's native CRS
transform.
maxPixels: The maximum allowed number of pixels in the exported image.
The task will fail if the exported region covers more pixels in the
specified projection. Defaults to 100,000,000.
shardSize: Size in pixels of the tiles in which this image will be
computed. Defaults to 256.
computed. Defaults to 256.
fileDimensions: The dimensions in pixels of each image file, if the
image is too large to fit in a single file. May specify a
single number to indicate a square shape, or a tuple of two
dimensions to indicate (width,height). Note that the image will
still be clipped to the overall image dimensions. Must be a
multiple of shardSize.
skipEmptyTiles: If true, skip writing empty (i.e. fully-masked)
image tiles. Defaults to false. Only supported on GeoTIFF exports.
image is too large to fit in a single file. May specify a single
number to indicate a square shape, or a tuple of two dimensions to
indicate (width,height). Note that the image will still be clipped to
the overall image dimensions. Must be a multiple of shardSize.
skipEmptyTiles: If true, skip writing empty (i.e. fully-masked) image
tiles. Defaults to false. Only supported on GeoTIFF exports.
fileFormat: The string file format to which the image is exported.
Currently only 'GeoTIFF' and 'TFRecord' are supported, defaults to
'GeoTIFF'.
formatOptions: A dictionary of string keys to format specific options.
Currently only 'GeoTIFF' and 'TFRecord' are supported, defaults to
'GeoTIFF'.
formatOptions: A dictionary of string keys to format-specific options.
For 'GeoTIFF': 'cloudOptimized' (bool), 'noData' (float).
**kwargs: Holds other keyword arguments that may have been deprecated
such as 'crs_transform', 'driveFolder', and 'driveFileNamePrefix'.
such as 'crs_transform', 'driveFolder', and 'driveFileNamePrefix'.
Returns:
An unstarted Task that exports the image to Drive.
Expand Down
3 changes: 1 addition & 2 deletions python/ee/blob.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A wrapper for Blobs."""

from typing import Any, Dict, Union
Expand Down Expand Up @@ -39,7 +38,7 @@ def __init__(self, url: Union[str, computedobject.ComputedObject]):
self.initialize()

if isinstance(url, computedobject.ComputedObject):
if url.func and url.func.getSignature()['returns'] == self.name():
if self.is_func_returning_same(url):
# If it is a call that is already returning a Blob, just cast.
super().__init__(url.func, url.args, url.varName)
return
Expand Down
1 change: 0 additions & 1 deletion python/ee/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#!/usr/bin/env python3
# Exposes CLI tool as a package.
1 change: 0 additions & 1 deletion python/ee/cli/commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Commands supported by the Earth Engine command line interface.
Each command is implemented by extending the Command class. Each class
Expand Down
1 change: 0 additions & 1 deletion python/ee/cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Support utilities used by the Earth Engine command line interface.
This module defines the Command class which is the base class of all
Expand Down
1 change: 0 additions & 1 deletion python/ee/collection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Common representation for ImageCollection and FeatureCollection.
This class is never intended to be instantiated by the user.
Expand Down
8 changes: 7 additions & 1 deletion python/ee/computedobject.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A representation of an Earth Engine computed object."""

from __future__ import annotations
Expand Down Expand Up @@ -248,3 +247,10 @@ def freeze(obj: Any) -> Any:
return tuple(map(ComputedObject.freeze, obj))
else:
return obj

def is_func_returning_same(self, an_object: Any) -> bool:
if not isinstance(an_object, ComputedObject):
return False
if not an_object.func:
return False
return an_object.func.getReturnType() == self.name()
1 change: 0 additions & 1 deletion python/ee/customfunction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""An object representing a custom EE Function."""

from __future__ import annotations
Expand Down
1 change: 0 additions & 1 deletion python/ee/data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Singleton for the library's communication with the Earth Engine API."""

# Using lowercase function naming to match the JavaScript names.
Expand Down
1 change: 0 additions & 1 deletion python/ee/deprecation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Decorators to mark function deprecated."""

import functools
Expand Down
1 change: 0 additions & 1 deletion python/ee/deserializer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A deserializer that decodes EE object trees from JSON DAGs."""

import json
Expand Down
6 changes: 2 additions & 4 deletions python/ee/dictionary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A wrapper for dictionaries."""


Expand Down Expand Up @@ -40,10 +39,9 @@ def __init__(
self._dictionary = arg
else:
self._dictionary = None
if (isinstance(arg, computedobject.ComputedObject)
and arg.func
and arg.func.getSignature()['returns'] == self.name()):
if self.is_func_returning_same(arg):
# If it's a call that's already returning a Dictionary, just cast.
assert isinstance(arg, computedobject.ComputedObject)
super().__init__(arg.func, arg.args, arg.varName)
else:
# Delegate everything else to the server-side constructor.
Expand Down
3 changes: 1 addition & 2 deletions python/ee/ee_date.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A wrapper for dates."""

import datetime
Expand Down Expand Up @@ -60,7 +59,7 @@ def __init__(
f'Invalid argument specified for ee.Date(..., opt_tz): {tz}'
)
elif isinstance(date, computedobject.ComputedObject):
if date.func and date.func.getSignature()['returns'] == self.name():
if self.is_func_returning_same(date):
# If it's a call that's already returning a Date, just cast.
func = date.func
args = date.args
Expand Down
1 change: 0 additions & 1 deletion python/ee/ee_exception.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A simple exception for the EE library."""


Expand Down
1 change: 0 additions & 1 deletion python/ee/ee_list.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A wrapper for lists."""

# List clashes with the class List, so call it ListType
Expand Down
1 change: 0 additions & 1 deletion python/ee/ee_number.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A wrapper for numbers."""

from typing import Any, Optional, Union
Expand Down
3 changes: 1 addition & 2 deletions python/ee/ee_string.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A wrapper for strings."""

from typing import Any, Union
Expand Down Expand Up @@ -36,7 +35,7 @@ def __init__(
if isinstance(string, str):
super().__init__(None, None)
elif isinstance(string, computedobject.ComputedObject):
if string.func and string.func.getSignature()['returns'] == self.name():
if self.is_func_returning_same(string):
# If it's a call that's already returning a String, just cast.
super().__init__(string.func, string.args, string.varName)
else:
Expand Down
1 change: 0 additions & 1 deletion python/ee/ee_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""A set of utilities to work with EE types."""

# Using lowercase function naming to match the JavaScript names.
Expand Down
1 change: 0 additions & 1 deletion python/ee/element.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Base class for Image, Feature and Collection.
This class is never intended to be instantiated by the user.
Expand Down
Loading

0 comments on commit 8fee1d9

Please sign in to comment.