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.

Files changed (102) hide show
  1. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/METADATA +3 -3
  2. earthengine_api-1.7.4.dist-info/RECORD +109 -0
  3. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/WHEEL +1 -1
  4. ee/__init__.py +29 -28
  5. ee/_arg_types.py +7 -6
  6. ee/_cloud_api_utils.py +95 -78
  7. ee/_helpers.py +17 -13
  8. ee/_state.py +105 -0
  9. ee/_utils.py +2 -1
  10. ee/apifunction.py +21 -19
  11. ee/apitestcase.py +33 -38
  12. ee/batch.py +87 -77
  13. ee/blob.py +10 -12
  14. ee/classifier.py +57 -59
  15. ee/cli/commands.py +178 -114
  16. ee/cli/eecli.py +1 -1
  17. ee/cli/utils.py +61 -42
  18. ee/clusterer.py +39 -41
  19. ee/collection.py +64 -54
  20. ee/computedobject.py +19 -16
  21. ee/confusionmatrix.py +9 -9
  22. ee/customfunction.py +13 -12
  23. ee/data.py +220 -322
  24. ee/daterange.py +10 -10
  25. ee/deprecation.py +21 -13
  26. ee/deserializer.py +25 -20
  27. ee/dictionary.py +11 -11
  28. ee/ee_array.py +22 -20
  29. ee/ee_date.py +23 -23
  30. ee/ee_list.py +15 -16
  31. ee/ee_number.py +11 -21
  32. ee/ee_string.py +24 -32
  33. ee/ee_types.py +4 -4
  34. ee/element.py +15 -15
  35. ee/encodable.py +7 -4
  36. ee/errormargin.py +4 -4
  37. ee/feature.py +68 -71
  38. ee/featurecollection.py +41 -40
  39. ee/filter.py +90 -92
  40. ee/function.py +8 -8
  41. ee/geometry.py +95 -93
  42. ee/image.py +238 -236
  43. ee/image_converter.py +4 -4
  44. ee/imagecollection.py +30 -27
  45. ee/join.py +13 -15
  46. ee/kernel.py +55 -57
  47. ee/mapclient.py +9 -9
  48. ee/model.py +29 -31
  49. ee/oauth.py +76 -63
  50. ee/pixeltype.py +6 -6
  51. ee/projection.py +5 -4
  52. ee/reducer.py +41 -41
  53. ee/serializer.py +14 -14
  54. ee/table_converter.py +7 -6
  55. ee/terrain.py +7 -9
  56. ee/tests/_cloud_api_utils_test.py +21 -6
  57. ee/tests/_helpers_test.py +57 -4
  58. ee/tests/_state_test.py +49 -0
  59. ee/tests/algorithms.json +85 -2
  60. ee/tests/apifunction_test.py +5 -5
  61. ee/tests/batch_test.py +135 -57
  62. ee/tests/blob_test.py +5 -5
  63. ee/tests/classifier_test.py +3 -3
  64. ee/tests/clusterer_test.py +3 -3
  65. ee/tests/collection_test.py +48 -13
  66. ee/tests/confusionmatrix_test.py +3 -3
  67. ee/tests/data_test.py +484 -55
  68. ee/tests/daterange_test.py +4 -4
  69. ee/tests/deprecation_test.py +6 -4
  70. ee/tests/deserializer_test.py +64 -5
  71. ee/tests/dictionary_test.py +12 -12
  72. ee/tests/ee_array_test.py +3 -3
  73. ee/tests/ee_date_test.py +4 -4
  74. ee/tests/ee_list_test.py +3 -3
  75. ee/tests/ee_number_test.py +75 -30
  76. ee/tests/ee_string_test.py +11 -3
  77. ee/tests/ee_test.py +40 -22
  78. ee/tests/element_test.py +2 -2
  79. ee/tests/errormargin_test.py +1 -1
  80. ee/tests/feature_test.py +10 -10
  81. ee/tests/featurecollection_test.py +3 -3
  82. ee/tests/filter_test.py +4 -4
  83. ee/tests/function_test.py +5 -5
  84. ee/tests/geometry_point_test.py +3 -3
  85. ee/tests/geometry_test.py +93 -52
  86. ee/tests/image_converter_test.py +1 -3
  87. ee/tests/image_test.py +3 -3
  88. ee/tests/imagecollection_test.py +3 -3
  89. ee/tests/join_test.py +3 -3
  90. ee/tests/kernel_test.py +7 -3
  91. ee/tests/model_test.py +17 -5
  92. ee/tests/oauth_test.py +189 -7
  93. ee/tests/pixeltype_test.py +6 -7
  94. ee/tests/projection_test.py +5 -6
  95. ee/tests/reducer_test.py +16 -3
  96. ee/tests/serializer_test.py +39 -12
  97. ee/tests/table_converter_test.py +51 -7
  98. ee/tests/terrain_test.py +11 -3
  99. earthengine_api-1.5.13rc0.dist-info/RECORD +0 -107
  100. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/entry_points.txt +0 -0
  101. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/licenses/LICENSE +0 -0
  102. {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, Dict, Optional, Type, Union
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: Dict[str, Type[ImageConverter]] = {
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: Union[str, ImageConverter]
53
- ) -> Optional[ImageConverter]:
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 typing import Any, Callable, Dict, Optional, Sequence, Tuple
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: Optional[Any] = None) -> Dict[str, Any]:
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: Optional[Any] = None, *args
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. If supplied, the length must match the number of bands selected.
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: 'ImageCollection',
129
- linkedBands: Optional[Sequence[str]] = None,
130
- linkedProperties: Optional[Sequence[str]] = None,
131
- matchPropertyName: Optional[str] = None,
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: Optional[Dict[str, Any]] = None) -> str:
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. This can be done by mapping a visualization
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: Optional[Any] = None) -> str:
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 Dict[str, Any]]
256
- params: Optional[Any] = None,
257
- thumbType: Optional[str] = None, # pylint: disable=g-bad-name
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: Dict[str, Any],
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: Dict[str, Any]
354
- ) -> Tuple[ImageCollection, Dict[str, Any]]:
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: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.ImageCollection] = None,
426
+ covariates: _arg_types.ImageCollection | None = None,
425
427
  # pylint: disable-next=invalid-name
426
- windowSize: Optional[_arg_types.Integer] = None,
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: Optional[_arg_types.Number] = None,
461
- crs: Optional[_arg_types.Projection] = None,
462
+ scale: _arg_types.Number | None = None,
463
+ crs: _arg_types.Projection | None = None,
462
464
  # pylint: disable-next=invalid-name
463
- crsTransform: Optional[_arg_types.List] = None,
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, version: Optional[_arg_types.Integer] = None
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: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.Integer] = None
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: Optional[_arg_types.String] = None,
95
- secondaryKey: Optional[_arg_types.String] = None,
96
- measureKey: Optional[_arg_types.String] = None,
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: Optional[_arg_types.String] = None,
135
- ordering: Optional[_arg_types.String] = None,
136
- ascending: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.String] = None,
139
- outer: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.String] = None,
195
- ascending: Optional[_arg_types.Bool] = None,
192
+ ordering: _arg_types.String | None = None,
193
+ ascending: _arg_types.Bool | None = None,
196
194
  # pylint: disable-next=invalid-name
197
- measureKey: Optional[_arg_types.String] = None,
198
- outer: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.String] = None,
83
- normalize: Optional[_arg_types.Bool] = None,
84
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.String] = None,
108
- normalize: Optional[_arg_types.Bool] = None,
109
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.Number] = None,
129
- normalize: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.String] = None,
144
- normalize: Optional[_arg_types.Bool] = None,
145
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.String] = None,
166
- normalize: Optional[_arg_types.Bool] = None,
167
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.String] = None,
188
- normalize: Optional[_arg_types.Bool] = None,
189
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.Integer] = None,
210
- height: Optional[_arg_types.Integer] = None,
211
- weights: Optional[_arg_types.List] = None,
212
- x: Optional[_arg_types.Integer] = None,
213
- y: Optional[_arg_types.Integer] = None,
214
- normalize: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.Number] = None,
238
- units: Optional[_arg_types.String] = None,
239
- normalize: Optional[_arg_types.Bool] = None,
240
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.Number] = None,
269
- normalize: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.Number] = None,
283
- normalize: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.Number] = None,
299
- normalize: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.String] = None,
316
- normalize: Optional[_arg_types.Bool] = None,
317
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.String] = None,
338
- normalize: Optional[_arg_types.Bool] = None,
339
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.String] = None,
360
- normalize: Optional[_arg_types.Bool] = None,
361
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.Number] = None,
381
- normalize: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.String] = None,
397
- normalize: Optional[_arg_types.Bool] = None,
398
- magnitude: Optional[_arg_types.Number] = None,
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: Optional[_arg_types.Number] = None,
419
- normalize: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.Number] = None,
445
- normalize: Optional[_arg_types.Bool] = None,
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: Optional[_arg_types.String] = None,
460
- normalize: Optional[_arg_types.Bool] = None,
461
- magnitude: Optional[_arg_types.Number] = None,
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. The map to display is specified by a MapOverlay, and
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. We could pull this from the EE library,
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. If not specified, the default
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. Only used
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. +1 for higher zoom, -1 for lower.
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. If it's not cached, a check is made to see if
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. The callback
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. See
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". If the MapInstance
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.