Skip to content

Commit

Permalink
v0.1.404
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 636235702
  • Loading branch information
Google Earth Engine Authors authored and naschmitz committed May 22, 2024
1 parent 9aca55e commit 0db2ec7
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 289 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ on: [

jobs:
build:
name: "python ${{ matrix.python-version }} tests"
runs-on: ubuntu-latest
name: "Python ${{ matrix.python-version }} tests on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [
"3.7",
"3.8",
Expand All @@ -19,6 +21,11 @@ jobs:
"3.11",
"3.12",
]
include:
- os: macos-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.11"
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
32 changes: 16 additions & 16 deletions javascript/build/ee_api_js.js

Large diffs are not rendered by default.

193 changes: 95 additions & 98 deletions javascript/build/ee_api_js_debug.js

Large diffs are not rendered by default.

237 changes: 117 additions & 120 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.403",
"version": "0.1.404",
"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.403';
const API_CLIENT_VERSION = '0.1.404';

exports.VERSION = apiVersion.VERSION;
exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
Expand Down
4 changes: 2 additions & 2 deletions 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.403'
__version__ = '0.1.404'

# Using lowercase function naming to match the JavaScript names.
# pylint: disable=g-bad-name
Expand Down Expand Up @@ -62,7 +62,7 @@
# Tell pytype not to worry about dynamic attributes.
_HAS_DYNAMIC_ATTRIBUTES = True

# A list of autogenerated class names added by _InitializeGeneratedClasses.
# A list of autogenerated class names added by _InitializeGenerateClasses.
_generatedClasses: ListType[str] = []

NO_PROJECT_EXCEPTION = ('ee.Initialize: no project found. Call with project='
Expand Down
20 changes: 8 additions & 12 deletions python/ee/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,12 +1256,11 @@ def getDownloadId(params: Dict[str, Any]) -> Dict[str, str]:
possible values:
image - The image to download.
- name: a base name to use when constructing filenames. Only applicable
when format is "ZIPPED_GEO_TIFF" (default),
"ZIPPED_GEO_TIFF_PER_BAND", or filePerBand is true. Defaults to the
image id (or "download" for computed images) when format is
"ZIPPED_GEO_TIFF", "ZIPPED_GEO_TIFF_PER_BAND", or filePerBand is
true, otherwise a random character string is generated. Band names
are appended when filePerBand is true.
when format is "ZIPPED_GEO_TIFF" (default) or filePerBand is true.
Defaults to the image id (or "download" for computed images) when
format is "ZIPPED_GEO_TIFF" or filePerBand is true, otherwise a
random character string is generated. Band names are appended when
filePerBand is true.
- bands: a description of the bands to download. Must be an array of
band names or an array of dictionaries, each with the
following keys:
Expand All @@ -1286,13 +1285,10 @@ def getDownloadId(params: Dict[str, Any]) -> Dict[str, str]:
and crs_transform are specified.
- filePerBand: whether to produce a separate GeoTIFF per band (boolean).
Defaults to true. If false, a single GeoTIFF is produced and all
band-level transformations will be ignored. Note that this is
ignored if the format is "ZIPPED_GEO_TIFF" or
"ZIPPED_GEO_TIFF_PER_BAND".
band-level transformations will be ignored.
- format: the download format. One of:
"ZIPPED_GEO_TIFF" (GeoTIFF file wrapped in a zip file, default),
"ZIPPED_GEO_TIFF_PER_BAND" (Multiple GeoTIFF files wrapped in a
zip file), "GEO_TIFF" (GeoTIFF file), "NPY" (NumPy binary format).
"ZIPPED_GEO_TIFF" (GeoTIFF file(s) wrapped in a zip file, default),
"GEO_TIFF" (GeoTIFF file), "NPY" (NumPy binary format).
If "GEO_TIFF" or "NPY", filePerBand and all band-level
transformations will be ignored. Loading a NumPy output results in
a structured array.
Expand Down
67 changes: 31 additions & 36 deletions python/ee/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@
from ee import geometry


def _parse_dimensions(dimensions: Any) -> Sequence[Any]:
"""Parses a dimensions specification into a one or two element list."""
if ee_types.isNumber(dimensions):
return [dimensions]
elif isinstance(dimensions, str):
# Unpack WIDTHxHEIGHT
return [int(x) for x in dimensions.split('x')]
elif isinstance(dimensions, (list, tuple)) and 1 <= len(dimensions) <= 2:
return dimensions

raise ee_exception.EEException(
'Invalid dimensions {}.'.format(dimensions))


class Image(element.Element):
"""An object to represent an Earth Engine image."""

Expand Down Expand Up @@ -119,10 +105,6 @@ def reset(cls) -> None:
apifunction.ApiFunction.clearApi(cls)
cls._initialized = False

@staticmethod
def name() -> str:
return 'Image'

# pylint: disable-next=useless-parent-delegation
def getInfo(self) -> Optional[Any]:
"""Fetch and return information about this image.
Expand All @@ -138,7 +120,7 @@ def getMapId(self, vis_params: Optional[Any] = None) -> Dict[str, Any]:
"""Fetch and return a map ID dictionary, suitable for use in a Map overlay.
Args:
vis_params: The visualization parameters. See ee.data.getMapId.
vis_params: The visualization parameters. See ee.data.getMapId.
Returns:
A map ID dictionary as described in ee.data.getMapId.
Expand Down Expand Up @@ -452,12 +434,11 @@ def getDownloadURL(self, params: Optional[Dict[str, Any]] = None) -> str:
params: An object containing download options with the following
possible values:
- name: a base name to use when constructing filenames. Only applicable
when format is "ZIPPED_GEO_TIFF" (default),
"ZIPPED_GEO_TIFF_PER_BAND" or filePerBand is true. Defaults to the
image id (or "download" for computed images) when format is
"ZIPPED_GEO_TIFF", "ZIPPED_GEO_TIFF_PER_BAND", or filePerBand is
true, otherwise a random character string is generated. Band names
are appended when filePerBand is true.
when format is "ZIPPED_GEO_TIFF" (default) or filePerBand is true.
Defaults to the image id (or "download" for computed images) when
format is "ZIPPED_GEO_TIFF" or filePerBand is true, otherwise a
random character string is generated. Band names are appended when
filePerBand is true.
- bands: a description of the bands to download. Must be an array of
band names or an array of dictionaries, each with the
following keys:
Expand All @@ -482,13 +463,10 @@ def getDownloadURL(self, params: Optional[Dict[str, Any]] = None) -> str:
and crs_transform are specified.
- filePerBand: whether to produce a separate GeoTIFF per band (boolean).
Defaults to true. If false, a single GeoTIFF is produced and all
band-level transformations will be ignored. Note that this is
ignored if the format is "ZIPPED_GEO_TIFF" or
"ZIPPED_GEO_TIFF_PER_BAND".
band-level transformations will be ignored.
- format: the download format. One of:
"ZIPPED_GEO_TIFF" (GeoTIFF file wrapped in a zip file, default),
"ZIPPED_GEO_TIFF_PER_BAND" (Multiple GeoTIFF files wrapped in a
zip file), "GEO_TIFF" (GeoTIFF file), "NPY" (NumPy binary format).
"ZIPPED_GEO_TIFF" (GeoTIFF file(s) wrapped in a zip file, default),
"GEO_TIFF" (GeoTIFF file), "NPY" (NumPy binary format).
If "GEO_TIFF" or "NPY", filePerBand and all band-level
transformations will be ignored. Loading a NumPy output results in
a structured array.
Expand Down Expand Up @@ -535,8 +513,8 @@ def getThumbURL(self, params: Optional[Dict[str, Any]] = None) -> str:
computed by proportional scaling.
region - (ee.Geometry, GeoJSON, list of numbers, list of points)
Geospatial region of the image to render. By default, the whole
image. If given a list of min lon, min lat, max lon, max lat,
a planar rectangle is created. If given a list of points a
image. If given a list of min lon, min lat, max lon, max lat,
a planar rectangle is created. If given a list of points a
planar polygon is created.
format - (string) Either 'png' or 'jpg'.
Expand Down Expand Up @@ -694,7 +672,7 @@ def expression(self, expression: Any, map_: Optional[Any] = None) -> Image:
accessed like image.band_name or image[0].
Both b() and image[] allow multiple arguments, to specify multiple bands,
such as b(1, 'name', 3). Calling b() with no arguments, or using a variable
such as b(1, 'name', 3). Calling b() with no arguments, or using a variable
by itself, returns all bands of the image.
Args:
Expand Down Expand Up @@ -752,7 +730,6 @@ def clip(self, clip_geometry: Any) -> Image:
clip_geometry = geometry.Geometry(clip_geometry)
except ee_exception.EEException:
pass # Not an ee.Geometry or GeoJSON. Just pass it along.

return apifunction.ApiFunction.call_('Image.clip', self, clip_geometry)

def rename(self, names: Any, *args) -> Image:
Expand All @@ -762,7 +739,7 @@ def rename(self, names: Any, *args) -> Image:
Args:
names: An array of strings specifying the new names for the
bands. Must exactly match the number of bands in the image.
bands. Must exactly match the number of bands in the image.
*args: Band names as varargs.
Returns:
Expand All @@ -779,3 +756,21 @@ def rename(self, names: Any, *args) -> Image:
'names': names
}
return apifunction.ApiFunction.apply_('Image.rename', algorithm_args)

@staticmethod
def name() -> str:
return 'Image'


def _parse_dimensions(dimensions: Any) -> Sequence[Any]:
"""Parses a dimensions specification into a one or two element list."""
if ee_types.isNumber(dimensions):
return [dimensions]
elif isinstance(dimensions, str):
# Unpack WIDTHxHEIGHT
return [int(x) for x in dimensions.split('x')]
elif isinstance(dimensions, (list, tuple)) and 1 <= len(dimensions) <= 2:
return dimensions

raise ee_exception.EEException(
'Invalid dimensions {}.'.format(dimensions))
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "earthengine-api"
version = "0.1.403"
version = "0.1.404"
description = "Earth Engine Python API"
requires-python = ">=3.7"
keywords = [
Expand Down

0 comments on commit 0db2ec7

Please sign in to comment.