earthengine-api 1.5.13rc0__py3-none-any.whl → 1.7.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of earthengine-api might be problematic. Click here for more details.
- {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/METADATA +3 -3
- earthengine_api-1.7.4.dist-info/RECORD +109 -0
- {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/WHEEL +1 -1
- ee/__init__.py +29 -28
- ee/_arg_types.py +7 -6
- ee/_cloud_api_utils.py +95 -78
- ee/_helpers.py +17 -13
- ee/_state.py +105 -0
- ee/_utils.py +2 -1
- ee/apifunction.py +21 -19
- ee/apitestcase.py +33 -38
- ee/batch.py +87 -77
- ee/blob.py +10 -12
- ee/classifier.py +57 -59
- ee/cli/commands.py +178 -114
- ee/cli/eecli.py +1 -1
- ee/cli/utils.py +61 -42
- ee/clusterer.py +39 -41
- ee/collection.py +64 -54
- ee/computedobject.py +19 -16
- ee/confusionmatrix.py +9 -9
- ee/customfunction.py +13 -12
- ee/data.py +220 -322
- ee/daterange.py +10 -10
- ee/deprecation.py +21 -13
- ee/deserializer.py +25 -20
- ee/dictionary.py +11 -11
- ee/ee_array.py +22 -20
- ee/ee_date.py +23 -23
- ee/ee_list.py +15 -16
- ee/ee_number.py +11 -21
- ee/ee_string.py +24 -32
- ee/ee_types.py +4 -4
- ee/element.py +15 -15
- ee/encodable.py +7 -4
- ee/errormargin.py +4 -4
- ee/feature.py +68 -71
- ee/featurecollection.py +41 -40
- ee/filter.py +90 -92
- ee/function.py +8 -8
- ee/geometry.py +95 -93
- ee/image.py +238 -236
- ee/image_converter.py +4 -4
- ee/imagecollection.py +30 -27
- ee/join.py +13 -15
- ee/kernel.py +55 -57
- ee/mapclient.py +9 -9
- ee/model.py +29 -31
- ee/oauth.py +76 -63
- ee/pixeltype.py +6 -6
- ee/projection.py +5 -4
- ee/reducer.py +41 -41
- ee/serializer.py +14 -14
- ee/table_converter.py +7 -6
- ee/terrain.py +7 -9
- ee/tests/_cloud_api_utils_test.py +21 -6
- ee/tests/_helpers_test.py +57 -4
- ee/tests/_state_test.py +49 -0
- ee/tests/algorithms.json +85 -2
- ee/tests/apifunction_test.py +5 -5
- ee/tests/batch_test.py +135 -57
- ee/tests/blob_test.py +5 -5
- ee/tests/classifier_test.py +3 -3
- ee/tests/clusterer_test.py +3 -3
- ee/tests/collection_test.py +48 -13
- ee/tests/confusionmatrix_test.py +3 -3
- ee/tests/data_test.py +484 -55
- ee/tests/daterange_test.py +4 -4
- ee/tests/deprecation_test.py +6 -4
- ee/tests/deserializer_test.py +64 -5
- ee/tests/dictionary_test.py +12 -12
- ee/tests/ee_array_test.py +3 -3
- ee/tests/ee_date_test.py +4 -4
- ee/tests/ee_list_test.py +3 -3
- ee/tests/ee_number_test.py +75 -30
- ee/tests/ee_string_test.py +11 -3
- ee/tests/ee_test.py +40 -22
- ee/tests/element_test.py +2 -2
- ee/tests/errormargin_test.py +1 -1
- ee/tests/feature_test.py +10 -10
- ee/tests/featurecollection_test.py +3 -3
- ee/tests/filter_test.py +4 -4
- ee/tests/function_test.py +5 -5
- ee/tests/geometry_point_test.py +3 -3
- ee/tests/geometry_test.py +93 -52
- ee/tests/image_converter_test.py +1 -3
- ee/tests/image_test.py +3 -3
- ee/tests/imagecollection_test.py +3 -3
- ee/tests/join_test.py +3 -3
- ee/tests/kernel_test.py +7 -3
- ee/tests/model_test.py +17 -5
- ee/tests/oauth_test.py +189 -7
- ee/tests/pixeltype_test.py +6 -7
- ee/tests/projection_test.py +5 -6
- ee/tests/reducer_test.py +16 -3
- ee/tests/serializer_test.py +39 -12
- ee/tests/table_converter_test.py +51 -7
- ee/tests/terrain_test.py +11 -3
- earthengine_api-1.5.13rc0.dist-info/RECORD +0 -107
- {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/entry_points.txt +0 -0
- {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/licenses/LICENSE +0 -0
- {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/top_level.txt +0 -0
ee/image_converter.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Converters used in the image data fetching methods."""
|
|
2
2
|
|
|
3
3
|
import io
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class ImageConverter:
|
|
@@ -43,14 +43,14 @@ class NumPyConverter(ImageConverter):
|
|
|
43
43
|
return numpy.load(io.BytesIO(data))
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
_PIXEL_DATA_CONVERTERS:
|
|
46
|
+
_PIXEL_DATA_CONVERTERS: dict[str, type[ImageConverter]] = {
|
|
47
47
|
'NUMPY_NDARRAY': NumPyConverter
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
def from_file_format(
|
|
52
|
-
file_format:
|
|
53
|
-
) ->
|
|
52
|
+
file_format: str | ImageConverter,
|
|
53
|
+
) -> ImageConverter | None:
|
|
54
54
|
if isinstance(file_format, ImageConverter):
|
|
55
55
|
return file_format
|
|
56
56
|
if file_format in _PIXEL_DATA_CONVERTERS:
|
ee/imagecollection.py
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from collections.abc import Callable, Sequence
|
|
6
|
+
from typing import Any
|
|
6
7
|
|
|
7
8
|
from ee import _arg_types
|
|
8
9
|
from ee import _utils
|
|
@@ -19,7 +20,7 @@ from ee import image
|
|
|
19
20
|
REDUCE_PREFIX = 'reduce'
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
class ImageCollection(collection.Collection):
|
|
23
|
+
class ImageCollection(collection.Collection[image.Image]):
|
|
23
24
|
"""Representation for an Earth Engine ImageCollection."""
|
|
24
25
|
|
|
25
26
|
_initialized = False
|
|
@@ -87,7 +88,7 @@ class ImageCollection(collection.Collection):
|
|
|
87
88
|
apifunction.ApiFunction.clearApi(cls)
|
|
88
89
|
cls._initialized = False
|
|
89
90
|
|
|
90
|
-
def getMapId(self, vis_params:
|
|
91
|
+
def getMapId(self, vis_params: Any | None = None) -> dict[str, Any]:
|
|
91
92
|
"""Fetch and return a Map ID.
|
|
92
93
|
|
|
93
94
|
This mosaics the collection to a single image and return a map ID suitable
|
|
@@ -105,7 +106,7 @@ class ImageCollection(collection.Collection):
|
|
|
105
106
|
@_utils.accept_opt_prefix('opt_names')
|
|
106
107
|
# pylint: disable-next=keyword-arg-before-vararg
|
|
107
108
|
def select(
|
|
108
|
-
self, selectors: Any, names:
|
|
109
|
+
self, selectors: Any, names: Any | None = None, *args
|
|
109
110
|
) -> ImageCollection:
|
|
110
111
|
"""Select bands from each image in a collection.
|
|
111
112
|
|
|
@@ -113,7 +114,7 @@ class ImageCollection(collection.Collection):
|
|
|
113
114
|
selectors: An array of names, regexes or numeric indices specifying the
|
|
114
115
|
bands to select.
|
|
115
116
|
names: An array of strings specifying the new names for the selected
|
|
116
|
-
bands.
|
|
117
|
+
bands. If supplied, the length must match the number of bands selected.
|
|
117
118
|
*args: Selector elements as varargs.
|
|
118
119
|
|
|
119
120
|
Returns:
|
|
@@ -125,10 +126,10 @@ class ImageCollection(collection.Collection):
|
|
|
125
126
|
# pylint: disable=unused-argument,g-bad-name
|
|
126
127
|
def linkCollection(
|
|
127
128
|
self,
|
|
128
|
-
imageCollection:
|
|
129
|
-
linkedBands:
|
|
130
|
-
linkedProperties:
|
|
131
|
-
matchPropertyName:
|
|
129
|
+
imageCollection: ImageCollection,
|
|
130
|
+
linkedBands: Sequence[str] | None = None,
|
|
131
|
+
linkedProperties: Sequence[str] | None = None,
|
|
132
|
+
matchPropertyName: str | None = None,
|
|
132
133
|
) -> ImageCollection:
|
|
133
134
|
"""Links images in this collection to matching images from imageCollection.
|
|
134
135
|
|
|
@@ -170,6 +171,7 @@ class ImageCollection(collection.Collection):
|
|
|
170
171
|
'Image.linkCollection', {'input': img, **kwargs})
|
|
171
172
|
|
|
172
173
|
return self.map(_linkCollection)
|
|
174
|
+
|
|
173
175
|
# pylint: enable=g-bad-name,unused-argument
|
|
174
176
|
|
|
175
177
|
def first(self) -> image.Image:
|
|
@@ -188,11 +190,11 @@ class ImageCollection(collection.Collection):
|
|
|
188
190
|
def elementType():
|
|
189
191
|
return image.Image
|
|
190
192
|
|
|
191
|
-
def getVideoThumbURL(self, params:
|
|
193
|
+
def getVideoThumbURL(self, params: dict[str, Any] | None = None) -> str:
|
|
192
194
|
"""Get the URL for an animated video thumbnail of the given collection.
|
|
193
195
|
|
|
194
196
|
Note: Videos can only be created when the image visualization
|
|
195
|
-
creates an RGB or RGBA image.
|
|
197
|
+
creates an RGB or RGBA image. This can be done by mapping a visualization
|
|
196
198
|
onto the collection or specifying three bands in the params.
|
|
197
199
|
|
|
198
200
|
Args:
|
|
@@ -221,7 +223,7 @@ class ImageCollection(collection.Collection):
|
|
|
221
223
|
"""
|
|
222
224
|
return self._getThumbURL(['gif'], params, thumbType='video')
|
|
223
225
|
|
|
224
|
-
def getFilmstripThumbURL(self, params:
|
|
226
|
+
def getFilmstripThumbURL(self, params: Any | None = None) -> str:
|
|
225
227
|
"""Get the URL for a "filmstrip" thumbnail of the given collection.
|
|
226
228
|
|
|
227
229
|
Args:
|
|
@@ -252,9 +254,9 @@ class ImageCollection(collection.Collection):
|
|
|
252
254
|
def _getThumbURL(
|
|
253
255
|
self,
|
|
254
256
|
valid_formats: Sequence[str],
|
|
255
|
-
# TODO(user): Need to drop the default None and use
|
|
256
|
-
params:
|
|
257
|
-
thumbType:
|
|
257
|
+
# TODO(user): Need to drop the default None and use dict[str, Any]]
|
|
258
|
+
params: Any | None = None,
|
|
259
|
+
thumbType: str | None = None, # pylint: disable=g-bad-name
|
|
258
260
|
) -> str:
|
|
259
261
|
"""Get the URL for a thumbnail of this collection.
|
|
260
262
|
|
|
@@ -314,7 +316,7 @@ class ImageCollection(collection.Collection):
|
|
|
314
316
|
def _apply_preparation_function(
|
|
315
317
|
self,
|
|
316
318
|
preparation_function: Callable[[Any, Any], Any],
|
|
317
|
-
params:
|
|
319
|
+
params: dict[str, Any],
|
|
318
320
|
) -> Any:
|
|
319
321
|
"""Applies a preparation function to an ImageCollection.
|
|
320
322
|
|
|
@@ -350,8 +352,8 @@ class ImageCollection(collection.Collection):
|
|
|
350
352
|
return self.map(apply_params), remaining_params
|
|
351
353
|
|
|
352
354
|
def prepare_for_export(
|
|
353
|
-
self, params:
|
|
354
|
-
) ->
|
|
355
|
+
self, params: dict[str, Any]
|
|
356
|
+
) -> tuple[ImageCollection, dict[str, Any]]:
|
|
355
357
|
"""Applies all relevant export parameters to an ImageCollection.
|
|
356
358
|
|
|
357
359
|
Args:
|
|
@@ -397,7 +399,7 @@ class ImageCollection(collection.Collection):
|
|
|
397
399
|
def combine(
|
|
398
400
|
self,
|
|
399
401
|
secondary: _arg_types.ImageCollection,
|
|
400
|
-
overwrite:
|
|
402
|
+
overwrite: _arg_types.Bool | None = None,
|
|
401
403
|
) -> ImageCollection:
|
|
402
404
|
"""Returns a collection adding all the bands from the image in secondary.
|
|
403
405
|
|
|
@@ -421,9 +423,9 @@ class ImageCollection(collection.Collection):
|
|
|
421
423
|
|
|
422
424
|
def formaTrend(
|
|
423
425
|
self,
|
|
424
|
-
covariates:
|
|
426
|
+
covariates: _arg_types.ImageCollection | None = None,
|
|
425
427
|
# pylint: disable-next=invalid-name
|
|
426
|
-
windowSize:
|
|
428
|
+
windowSize: _arg_types.Integer | None = None,
|
|
427
429
|
) -> image.Image:
|
|
428
430
|
"""Returns an image with the forma trend of the collection.
|
|
429
431
|
|
|
@@ -457,10 +459,10 @@ class ImageCollection(collection.Collection):
|
|
|
457
459
|
def getRegion(
|
|
458
460
|
self,
|
|
459
461
|
geometry: _arg_types.Geometry,
|
|
460
|
-
scale:
|
|
461
|
-
crs:
|
|
462
|
+
scale: _arg_types.Number | None = None,
|
|
463
|
+
crs: _arg_types.Projection | None = None,
|
|
462
464
|
# pylint: disable-next=invalid-name
|
|
463
|
-
crsTransform:
|
|
465
|
+
crsTransform: _arg_types.List | None = None,
|
|
464
466
|
) -> ee_list.List:
|
|
465
467
|
"""Returns a list of values for each [pixel, band, image] tuple.
|
|
466
468
|
|
|
@@ -488,7 +490,8 @@ class ImageCollection(collection.Collection):
|
|
|
488
490
|
@staticmethod
|
|
489
491
|
def load(
|
|
490
492
|
# pylint: disable-next=redefined-builtin
|
|
491
|
-
id: _arg_types.String,
|
|
493
|
+
id: _arg_types.String,
|
|
494
|
+
version: _arg_types.Integer | None = None,
|
|
492
495
|
) -> ImageCollection:
|
|
493
496
|
"""Returns the image collection given its ID.
|
|
494
497
|
|
|
@@ -537,7 +540,7 @@ class ImageCollection(collection.Collection):
|
|
|
537
540
|
self,
|
|
538
541
|
reducer: _arg_types.Reducer,
|
|
539
542
|
# pylint: disable-next=invalid-name
|
|
540
|
-
parallelScale:
|
|
543
|
+
parallelScale: _arg_types.Number | None = None,
|
|
541
544
|
) -> image.Image:
|
|
542
545
|
"""Returns a reduced image from the collection.
|
|
543
546
|
|
|
@@ -576,7 +579,7 @@ class ImageCollection(collection.Collection):
|
|
|
576
579
|
return apifunction.ApiFunction.call_(self.name() + '.toArray', self)
|
|
577
580
|
|
|
578
581
|
def toArrayPerBand(
|
|
579
|
-
self, axis:
|
|
582
|
+
self, axis: _arg_types.Integer | None = None
|
|
580
583
|
) -> image.Image:
|
|
581
584
|
"""Returns an image of an image collection converted into 2D arrays.
|
|
582
585
|
|
ee/join.py
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from ee import _arg_types
|
|
8
6
|
from ee import apifunction
|
|
9
7
|
from ee import computedobject
|
|
@@ -91,9 +89,9 @@ class Join(computedobject.ComputedObject):
|
|
|
91
89
|
@staticmethod
|
|
92
90
|
def inner(
|
|
93
91
|
# pylint: disable=invalid-name
|
|
94
|
-
primaryKey:
|
|
95
|
-
secondaryKey:
|
|
96
|
-
measureKey:
|
|
92
|
+
primaryKey: _arg_types.String | None = None,
|
|
93
|
+
secondaryKey: _arg_types.String | None = None,
|
|
94
|
+
measureKey: _arg_types.String | None = None,
|
|
97
95
|
# pylint: enable=invalid-name
|
|
98
96
|
) -> Join:
|
|
99
97
|
"""Returns a join with matching pairs of elements.
|
|
@@ -131,12 +129,12 @@ class Join(computedobject.ComputedObject):
|
|
|
131
129
|
@staticmethod
|
|
132
130
|
def saveAll(
|
|
133
131
|
# pylint: disable-next=invalid-name
|
|
134
|
-
matchesKey:
|
|
135
|
-
ordering:
|
|
136
|
-
ascending:
|
|
132
|
+
matchesKey: _arg_types.String | None = None,
|
|
133
|
+
ordering: _arg_types.String | None = None,
|
|
134
|
+
ascending: _arg_types.Bool | None = None,
|
|
137
135
|
# pylint: disable-next=invalid-name
|
|
138
|
-
measureKey:
|
|
139
|
-
outer:
|
|
136
|
+
measureKey: _arg_types.String | None = None,
|
|
137
|
+
outer: _arg_types.Bool | None = None,
|
|
140
138
|
) -> Join:
|
|
141
139
|
"""Returns a join that returns all pairs of elements.
|
|
142
140
|
|
|
@@ -166,7 +164,7 @@ class Join(computedobject.ComputedObject):
|
|
|
166
164
|
def saveBest(
|
|
167
165
|
matchKey: _arg_types.String, # pylint: disable=invalid-name
|
|
168
166
|
measureKey: _arg_types.String, # pylint: disable=invalid-name
|
|
169
|
-
outer:
|
|
167
|
+
outer: _arg_types.Bool | None = None,
|
|
170
168
|
) -> Join:
|
|
171
169
|
"""Returns a join that returns the best match pairs.
|
|
172
170
|
|
|
@@ -191,11 +189,11 @@ class Join(computedobject.ComputedObject):
|
|
|
191
189
|
@staticmethod
|
|
192
190
|
def saveFirst(
|
|
193
191
|
matchKey: _arg_types.String, # pylint: disable=invalid-name
|
|
194
|
-
ordering:
|
|
195
|
-
ascending:
|
|
192
|
+
ordering: _arg_types.String | None = None,
|
|
193
|
+
ascending: _arg_types.Bool | None = None,
|
|
196
194
|
# pylint: disable-next=invalid-name
|
|
197
|
-
measureKey:
|
|
198
|
-
outer:
|
|
195
|
+
measureKey: _arg_types.String | None = None,
|
|
196
|
+
outer: _arg_types.Bool | None = None,
|
|
199
197
|
) -> Join:
|
|
200
198
|
"""Returns a join that returns the first match pairs.
|
|
201
199
|
|
ee/kernel.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"""A wrapper for Kernels."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
from typing import Optional
|
|
5
|
-
|
|
6
4
|
from ee import _arg_types
|
|
7
5
|
from ee import apifunction
|
|
8
6
|
from ee import computedobject
|
|
@@ -58,7 +56,7 @@ class Kernel(computedobject.ComputedObject):
|
|
|
58
56
|
def add(
|
|
59
57
|
self,
|
|
60
58
|
kernel2: _arg_types.Kernel,
|
|
61
|
-
normalize:
|
|
59
|
+
normalize: _arg_types.Bool | None = None,
|
|
62
60
|
) -> Kernel:
|
|
63
61
|
"""Returns the addition of two kernels.
|
|
64
62
|
|
|
@@ -79,9 +77,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
79
77
|
@staticmethod
|
|
80
78
|
def chebyshev(
|
|
81
79
|
radius: _arg_types.Number,
|
|
82
|
-
units:
|
|
83
|
-
normalize:
|
|
84
|
-
magnitude:
|
|
80
|
+
units: _arg_types.String | None = None,
|
|
81
|
+
normalize: _arg_types.Bool | None = None,
|
|
82
|
+
magnitude: _arg_types.Number | None = None,
|
|
85
83
|
) -> Kernel:
|
|
86
84
|
"""Returns a Chebyshev kernel.
|
|
87
85
|
|
|
@@ -104,9 +102,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
104
102
|
@staticmethod
|
|
105
103
|
def circle(
|
|
106
104
|
radius: _arg_types.Number,
|
|
107
|
-
units:
|
|
108
|
-
normalize:
|
|
109
|
-
magnitude:
|
|
105
|
+
units: _arg_types.String | None = None,
|
|
106
|
+
normalize: _arg_types.Bool | None = None,
|
|
107
|
+
magnitude: _arg_types.Number | None = None,
|
|
110
108
|
) -> Kernel:
|
|
111
109
|
"""Returns a circle-shaped boolean kernel.
|
|
112
110
|
|
|
@@ -125,8 +123,8 @@ class Kernel(computedobject.ComputedObject):
|
|
|
125
123
|
|
|
126
124
|
@staticmethod
|
|
127
125
|
def compass(
|
|
128
|
-
magnitude:
|
|
129
|
-
normalize:
|
|
126
|
+
magnitude: _arg_types.Number | None = None,
|
|
127
|
+
normalize: _arg_types.Bool | None = None,
|
|
130
128
|
) -> Kernel:
|
|
131
129
|
"""Returns a 3x3 Prewitt's Compass edge-detection kernel.
|
|
132
130
|
|
|
@@ -140,9 +138,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
140
138
|
@staticmethod
|
|
141
139
|
def cross(
|
|
142
140
|
radius: _arg_types.Number,
|
|
143
|
-
units:
|
|
144
|
-
normalize:
|
|
145
|
-
magnitude:
|
|
141
|
+
units: _arg_types.String | None = None,
|
|
142
|
+
normalize: _arg_types.Bool | None = None,
|
|
143
|
+
magnitude: _arg_types.Number | None = None,
|
|
146
144
|
) -> Kernel:
|
|
147
145
|
"""Returns a cross-shaped boolean kernel.
|
|
148
146
|
|
|
@@ -162,9 +160,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
162
160
|
@staticmethod
|
|
163
161
|
def diamond(
|
|
164
162
|
radius: _arg_types.Number,
|
|
165
|
-
units:
|
|
166
|
-
normalize:
|
|
167
|
-
magnitude:
|
|
163
|
+
units: _arg_types.String | None = None,
|
|
164
|
+
normalize: _arg_types.Bool | None = None,
|
|
165
|
+
magnitude: _arg_types.Number | None = None,
|
|
168
166
|
) -> Kernel:
|
|
169
167
|
"""Returns a diamond-shaped boolean kernel.
|
|
170
168
|
|
|
@@ -184,9 +182,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
184
182
|
@staticmethod
|
|
185
183
|
def euclidean(
|
|
186
184
|
radius: _arg_types.Number,
|
|
187
|
-
units:
|
|
188
|
-
normalize:
|
|
189
|
-
magnitude:
|
|
185
|
+
units: _arg_types.String | None = None,
|
|
186
|
+
normalize: _arg_types.Bool | None = None,
|
|
187
|
+
magnitude: _arg_types.Number | None = None,
|
|
190
188
|
) -> Kernel:
|
|
191
189
|
"""Returns a distance kernel based on Euclidean (straight-line) distance.
|
|
192
190
|
|
|
@@ -206,12 +204,12 @@ class Kernel(computedobject.ComputedObject):
|
|
|
206
204
|
# TODO: Test missing weights.
|
|
207
205
|
@staticmethod
|
|
208
206
|
def fixed(
|
|
209
|
-
width:
|
|
210
|
-
height:
|
|
211
|
-
weights:
|
|
212
|
-
x:
|
|
213
|
-
y:
|
|
214
|
-
normalize:
|
|
207
|
+
width: _arg_types.Integer | None = None,
|
|
208
|
+
height: _arg_types.Integer | None = None,
|
|
209
|
+
weights: _arg_types.List | None = None,
|
|
210
|
+
x: _arg_types.Integer | None = None,
|
|
211
|
+
y: _arg_types.Integer | None = None,
|
|
212
|
+
normalize: _arg_types.Bool | None = None,
|
|
215
213
|
) -> Kernel:
|
|
216
214
|
"""Returns a kernel with the given weights.
|
|
217
215
|
|
|
@@ -234,10 +232,10 @@ class Kernel(computedobject.ComputedObject):
|
|
|
234
232
|
@staticmethod
|
|
235
233
|
def gaussian(
|
|
236
234
|
radius: _arg_types.Number,
|
|
237
|
-
sigma:
|
|
238
|
-
units:
|
|
239
|
-
normalize:
|
|
240
|
-
magnitude:
|
|
235
|
+
sigma: _arg_types.Number | None = None,
|
|
236
|
+
units: _arg_types.String | None = None,
|
|
237
|
+
normalize: _arg_types.Bool | None = None,
|
|
238
|
+
magnitude: _arg_types.Number | None = None,
|
|
241
239
|
) -> Kernel:
|
|
242
240
|
"""Returns a Gaussian kernel from a sampled continuous Gaussian.
|
|
243
241
|
|
|
@@ -265,8 +263,8 @@ class Kernel(computedobject.ComputedObject):
|
|
|
265
263
|
|
|
266
264
|
@staticmethod
|
|
267
265
|
def kirsch(
|
|
268
|
-
magnitude:
|
|
269
|
-
normalize:
|
|
266
|
+
magnitude: _arg_types.Number | None = None,
|
|
267
|
+
normalize: _arg_types.Bool | None = None,
|
|
270
268
|
) -> Kernel:
|
|
271
269
|
"""Returns a 3x3 Kirsch's Compass edge-detection kernel.
|
|
272
270
|
|
|
@@ -279,8 +277,8 @@ class Kernel(computedobject.ComputedObject):
|
|
|
279
277
|
|
|
280
278
|
@staticmethod
|
|
281
279
|
def laplacian4(
|
|
282
|
-
magnitude:
|
|
283
|
-
normalize:
|
|
280
|
+
magnitude: _arg_types.Number | None = None,
|
|
281
|
+
normalize: _arg_types.Bool | None = None,
|
|
284
282
|
) -> Kernel:
|
|
285
283
|
"""Returns a 3x3 Laplacian-4 edge-detection kernel.
|
|
286
284
|
|
|
@@ -295,8 +293,8 @@ class Kernel(computedobject.ComputedObject):
|
|
|
295
293
|
|
|
296
294
|
@staticmethod
|
|
297
295
|
def laplacian8(
|
|
298
|
-
magnitude:
|
|
299
|
-
normalize:
|
|
296
|
+
magnitude: _arg_types.Number | None = None,
|
|
297
|
+
normalize: _arg_types.Bool | None = None,
|
|
300
298
|
) -> Kernel:
|
|
301
299
|
"""Returns a 3x3 Laplacian-8 edge-detection kernel.
|
|
302
300
|
|
|
@@ -312,9 +310,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
312
310
|
@staticmethod
|
|
313
311
|
def manhattan(
|
|
314
312
|
radius: _arg_types.Number,
|
|
315
|
-
units:
|
|
316
|
-
normalize:
|
|
317
|
-
magnitude:
|
|
313
|
+
units: _arg_types.String | None = None,
|
|
314
|
+
normalize: _arg_types.Bool | None = None,
|
|
315
|
+
magnitude: _arg_types.Number | None = None,
|
|
318
316
|
) -> Kernel:
|
|
319
317
|
"""Returns a distance kernel based on rectilinear (city-block) distance.
|
|
320
318
|
|
|
@@ -334,9 +332,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
334
332
|
@staticmethod
|
|
335
333
|
def octagon(
|
|
336
334
|
radius: _arg_types.Number,
|
|
337
|
-
units:
|
|
338
|
-
normalize:
|
|
339
|
-
magnitude:
|
|
335
|
+
units: _arg_types.String | None = None,
|
|
336
|
+
normalize: _arg_types.Bool | None = None,
|
|
337
|
+
magnitude: _arg_types.Number | None = None,
|
|
340
338
|
) -> Kernel:
|
|
341
339
|
"""Returns an octagon-shaped boolean kernel.
|
|
342
340
|
|
|
@@ -356,9 +354,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
356
354
|
@staticmethod
|
|
357
355
|
def plus(
|
|
358
356
|
radius: _arg_types.Number,
|
|
359
|
-
units:
|
|
360
|
-
normalize:
|
|
361
|
-
magnitude:
|
|
357
|
+
units: _arg_types.String | None = None,
|
|
358
|
+
normalize: _arg_types.Bool | None = None,
|
|
359
|
+
magnitude: _arg_types.Number | None = None,
|
|
362
360
|
) -> Kernel:
|
|
363
361
|
"""Returns a plus-shaped boolean kernel.
|
|
364
362
|
|
|
@@ -377,8 +375,8 @@ class Kernel(computedobject.ComputedObject):
|
|
|
377
375
|
|
|
378
376
|
@staticmethod
|
|
379
377
|
def prewitt(
|
|
380
|
-
magnitude:
|
|
381
|
-
normalize:
|
|
378
|
+
magnitude: _arg_types.Number | None = None,
|
|
379
|
+
normalize: _arg_types.Bool | None = None,
|
|
382
380
|
) -> Kernel:
|
|
383
381
|
"""Returns a 3x3 Prewitt edge-detection kernel.
|
|
384
382
|
|
|
@@ -393,9 +391,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
393
391
|
def rectangle(
|
|
394
392
|
xRadius: _arg_types.Number, # pylint: disable=invalid-name
|
|
395
393
|
yRadius: _arg_types.Number, # pylint: disable=invalid-name
|
|
396
|
-
units:
|
|
397
|
-
normalize:
|
|
398
|
-
magnitude:
|
|
394
|
+
units: _arg_types.String | None = None,
|
|
395
|
+
normalize: _arg_types.Bool | None = None,
|
|
396
|
+
magnitude: _arg_types.Number | None = None,
|
|
399
397
|
) -> Kernel:
|
|
400
398
|
"""Returns a rectangular-shaped kernel.
|
|
401
399
|
|
|
@@ -415,8 +413,8 @@ class Kernel(computedobject.ComputedObject):
|
|
|
415
413
|
|
|
416
414
|
@staticmethod
|
|
417
415
|
def roberts(
|
|
418
|
-
magnitude:
|
|
419
|
-
normalize:
|
|
416
|
+
magnitude: _arg_types.Number | None = None,
|
|
417
|
+
normalize: _arg_types.Bool | None = None,
|
|
420
418
|
) -> Kernel:
|
|
421
419
|
"""Returns a 2x2 Roberts edge-detection kernel.
|
|
422
420
|
|
|
@@ -441,8 +439,8 @@ class Kernel(computedobject.ComputedObject):
|
|
|
441
439
|
|
|
442
440
|
@staticmethod
|
|
443
441
|
def sobel(
|
|
444
|
-
magnitude:
|
|
445
|
-
normalize:
|
|
442
|
+
magnitude: _arg_types.Number | None = None,
|
|
443
|
+
normalize: _arg_types.Bool | None = None,
|
|
446
444
|
) -> Kernel:
|
|
447
445
|
"""Returns a 3x3 Sobel edge-detection kernel.
|
|
448
446
|
|
|
@@ -456,9 +454,9 @@ class Kernel(computedobject.ComputedObject):
|
|
|
456
454
|
@staticmethod
|
|
457
455
|
def square(
|
|
458
456
|
radius: _arg_types.Number,
|
|
459
|
-
units:
|
|
460
|
-
normalize:
|
|
461
|
-
magnitude:
|
|
457
|
+
units: _arg_types.String | None = None,
|
|
458
|
+
normalize: _arg_types.Bool | None = None,
|
|
459
|
+
magnitude: _arg_types.Number | None = None,
|
|
462
460
|
) -> Kernel:
|
|
463
461
|
"""Returns a square-shaped boolean kernel.
|
|
464
462
|
|
ee/mapclient.py
CHANGED
|
@@ -8,7 +8,7 @@ This currently has several spots that are hard-coded for 256x256 tiles, even
|
|
|
8
8
|
though MapOverlay tries to track this.
|
|
9
9
|
|
|
10
10
|
Supports mouse-based pan and zoom as well as tile upsampling while waiting
|
|
11
|
-
for new tiles to load.
|
|
11
|
+
for new tiles to load. The map to display is specified by a MapOverlay, and
|
|
12
12
|
added to the GUI on creation or manually using addOverlay()
|
|
13
13
|
gui = MapClient(MakeOverlay(mapid))
|
|
14
14
|
|
|
@@ -35,7 +35,7 @@ import urllib.request
|
|
|
35
35
|
from PIL import Image
|
|
36
36
|
from PIL import ImageTk
|
|
37
37
|
|
|
38
|
-
# The default URL to fetch tiles from.
|
|
38
|
+
# The default URL to fetch tiles from. We could pull this from the EE library,
|
|
39
39
|
# however this doesn't have any other dependencies on that yet, so let's not.
|
|
40
40
|
BASE_URL = 'https://earthengine.googleapis.com'
|
|
41
41
|
|
|
@@ -52,7 +52,7 @@ class MapClient(threading.Thread):
|
|
|
52
52
|
"""Initialize the MapClient UI.
|
|
53
53
|
|
|
54
54
|
Args:
|
|
55
|
-
opt_overlay: A mapoverlay to display.
|
|
55
|
+
opt_overlay: A mapoverlay to display. If not specified, the default
|
|
56
56
|
Google Maps basemap is used.
|
|
57
57
|
opt_width: The default width of the frame to construct.
|
|
58
58
|
opt_height: The default height of the frame to construct.
|
|
@@ -178,7 +178,7 @@ class MapClient(threading.Thread):
|
|
|
178
178
|
image: The image tile to display.
|
|
179
179
|
key: A tuple containing the key of the image (level, x, y)
|
|
180
180
|
overlay: The overlay this tile belongs to.
|
|
181
|
-
layer: The layer number this overlay corresponds to.
|
|
181
|
+
layer: The layer number this overlay corresponds to. Only used
|
|
182
182
|
for caching purposes.
|
|
183
183
|
"""
|
|
184
184
|
# TODO(user): This function is called from multiple threads, and
|
|
@@ -205,7 +205,7 @@ class MapClient(threading.Thread):
|
|
|
205
205
|
|
|
206
206
|
Args:
|
|
207
207
|
event: The event that caused this zoom request.
|
|
208
|
-
direction: The direction to zoom.
|
|
208
|
+
direction: The direction to zoom. +1 for higher zoom, -1 for lower.
|
|
209
209
|
"""
|
|
210
210
|
if self.level + direction >= 0:
|
|
211
211
|
# Discard everything cached in the MapClient, and flush the fetch queues.
|
|
@@ -319,13 +319,13 @@ class MapOverlay:
|
|
|
319
319
|
"""Get the requested tile.
|
|
320
320
|
|
|
321
321
|
If the requested tile is already cached, it's returned (sent to the
|
|
322
|
-
callback) directly.
|
|
322
|
+
callback) directly. If it's not cached, a check is made to see if
|
|
323
323
|
a lower-res version is cached, and if so that's interpolated up, before
|
|
324
324
|
a request for the actual tile is made.
|
|
325
325
|
|
|
326
326
|
Args:
|
|
327
327
|
key: The key of the tile to fetch.
|
|
328
|
-
callback: The callback to call when the tile is available.
|
|
328
|
+
callback: The callback to call when the tile is available. The callback
|
|
329
329
|
may be called more than once if a low-res version is available.
|
|
330
330
|
"""
|
|
331
331
|
result = self.GetCachedTile(key)
|
|
@@ -456,12 +456,12 @@ def addToMap(eeobject, vis_params=None, *args):
|
|
|
456
456
|
|
|
457
457
|
Args:
|
|
458
458
|
eeobject: the object to add to the map.
|
|
459
|
-
vis_params: a dictionary of visualization parameters.
|
|
459
|
+
vis_params: a dictionary of visualization parameters. See
|
|
460
460
|
ee.data.getMapId().
|
|
461
461
|
*args: unused arguments, left for compatibility with the JS API.
|
|
462
462
|
|
|
463
463
|
This call exists to be an equivalent to the playground addToMap() call.
|
|
464
|
-
It uses a global MapInstance to hang on to "the map".
|
|
464
|
+
It uses a global MapInstance to hang on to "the map". If the MapInstance
|
|
465
465
|
isn't initialized, this creates a new one.
|
|
466
466
|
"""
|
|
467
467
|
del args # Unused.
|