earthengine-api 1.5.24__py3-none-any.whl → 1.6.0__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 (63) hide show
  1. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/METADATA +1 -1
  2. earthengine_api-1.6.0.dist-info/RECORD +107 -0
  3. ee/__init__.py +11 -10
  4. ee/_arg_types.py +2 -1
  5. ee/_cloud_api_utils.py +7 -6
  6. ee/_helpers.py +3 -2
  7. ee/apifunction.py +11 -9
  8. ee/apitestcase.py +2 -1
  9. ee/batch.py +46 -42
  10. ee/blob.py +2 -2
  11. ee/classifier.py +57 -59
  12. ee/cli/commands.py +9 -7
  13. ee/cli/utils.py +13 -9
  14. ee/clusterer.py +39 -41
  15. ee/collection.py +42 -42
  16. ee/computedobject.py +10 -10
  17. ee/confusionmatrix.py +8 -8
  18. ee/customfunction.py +2 -2
  19. ee/data.py +15 -14
  20. ee/daterange.py +9 -9
  21. ee/deprecation.py +13 -11
  22. ee/deserializer.py +5 -5
  23. ee/dictionary.py +11 -11
  24. ee/ee_array.py +17 -17
  25. ee/ee_date.py +22 -22
  26. ee/ee_list.py +15 -15
  27. ee/ee_number.py +5 -5
  28. ee/ee_string.py +6 -6
  29. ee/ee_types.py +2 -2
  30. ee/element.py +14 -14
  31. ee/errormargin.py +3 -3
  32. ee/feature.py +67 -70
  33. ee/featurecollection.py +30 -32
  34. ee/filter.py +88 -90
  35. ee/function.py +3 -3
  36. ee/geometry.py +61 -62
  37. ee/image.py +216 -209
  38. ee/image_converter.py +2 -2
  39. ee/imagecollection.py +23 -20
  40. ee/join.py +13 -15
  41. ee/kernel.py +55 -57
  42. ee/oauth.py +26 -20
  43. ee/pixeltype.py +5 -5
  44. ee/projection.py +4 -3
  45. ee/reducer.py +39 -41
  46. ee/serializer.py +4 -4
  47. ee/table_converter.py +3 -2
  48. ee/terrain.py +6 -8
  49. ee/tests/_cloud_api_utils_test.py +1 -1
  50. ee/tests/_helpers_test.py +1 -1
  51. ee/tests/batch_test.py +1 -1
  52. ee/tests/data_test.py +2 -2
  53. ee/tests/ee_test.py +3 -3
  54. ee/tests/errormargin_test.py +1 -1
  55. ee/tests/image_converter_test.py +2 -2
  56. ee/tests/pixeltype_test.py +1 -2
  57. ee/tests/projection_test.py +2 -3
  58. ee/tests/table_converter_test.py +2 -2
  59. earthengine_api-1.5.24.dist-info/RECORD +0 -107
  60. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/WHEEL +0 -0
  61. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/entry_points.txt +0 -0
  62. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/licenses/LICENSE +0 -0
  63. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/top_level.txt +0 -0
ee/geometry.py CHANGED
@@ -3,9 +3,10 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import collections.abc
6
+ from collections.abc import Sequence
6
7
  import json
7
8
  import math
8
- from typing import Any, Optional, Sequence, Union
9
+ from typing import Any
9
10
 
10
11
  from ee import _arg_types
11
12
  from ee import _utils
@@ -36,10 +37,10 @@ class Geometry(computedobject.ComputedObject):
36
37
  @_utils.accept_opt_prefix('opt_proj', 'opt_geodesic', 'opt_evenOdd')
37
38
  def __init__(
38
39
  self,
39
- geo_json: Union[dict[str, Any], computedobject.ComputedObject, Geometry],
40
- proj: Optional[Any] = None,
41
- geodesic: Optional[bool] = None,
42
- evenOdd: Optional[bool] = None, # pylint: disable=g-bad-name
40
+ geo_json: dict[str, Any] | computedobject.ComputedObject | Geometry,
41
+ proj: Any | None = None,
42
+ geodesic: bool | None = None,
43
+ evenOdd: bool | None = None, # pylint: disable=g-bad-name
43
44
  ):
44
45
  """Creates a geometry.
45
46
 
@@ -296,10 +297,10 @@ class Geometry(computedobject.ComputedObject):
296
297
 
297
298
  @staticmethod
298
299
  def BBox(
299
- west: Union[float, computedobject.ComputedObject],
300
- south: Union[float, computedobject.ComputedObject],
301
- east: Union[float, computedobject.ComputedObject],
302
- north: Union[float, computedobject.ComputedObject],
300
+ west: float | computedobject.ComputedObject,
301
+ south: float | computedobject.ComputedObject,
302
+ east: float | computedobject.ComputedObject,
303
+ north: float | computedobject.ComputedObject,
303
304
  ) -> Geometry:
304
305
  """Constructs a rectangle ee.Geometry from lines of latitude and longitude.
305
306
 
@@ -333,11 +334,9 @@ class Geometry(computedobject.ComputedObject):
333
334
  # support the general idea of an around-the-globe latitude band. By writing
334
335
  # them negated, we also reject NaN.
335
336
  if not west < math.inf:
336
- raise ee_exception.EEException(
337
- 'Geometry.BBox: west must not be {}'.format(west))
337
+ raise ee_exception.EEException(f'Geometry.BBox: west must not be {west}')
338
338
  if not east > -math.inf:
339
- raise ee_exception.EEException(
340
- 'Geometry.BBox: east must not be {}'.format(east))
339
+ raise ee_exception.EEException(f'Geometry.BBox: east must not be {east}')
341
340
  # Reject cases which, if we clamped them instead, would move a box whose
342
341
  # bounds lie entirely "past" a pole to being at the pole. By writing them
343
342
  # negated, we also reject NaN.
@@ -600,7 +599,7 @@ class Geometry(computedobject.ComputedObject):
600
599
  return Geometry(Geometry._parseArgs('MultiPolygon', 4, all_args))
601
600
 
602
601
  @_utils.accept_opt_prefix('opt_encoder')
603
- def encode(self, encoder: Optional[Any] = None) -> dict[str, Any]:
602
+ def encode(self, encoder: Any | None = None) -> dict[str, Any]:
604
603
  """Returns a GeoJSON-compatible representation of the geometry."""
605
604
  if not getattr(self, '_type', None):
606
605
  return super().encode(encoder)
@@ -694,7 +693,7 @@ class Geometry(computedobject.ComputedObject):
694
693
  (nesting == 4 or not coords)))
695
694
 
696
695
  @staticmethod
697
- def _isValidCoordinates(shape: Union[Sequence[float], Geometry]) -> int:
696
+ def _isValidCoordinates(shape: Sequence[float] | Geometry) -> int:
698
697
  """Validate the coordinates of a geometry.
699
698
 
700
699
  Args:
@@ -886,8 +885,8 @@ class Geometry(computedobject.ComputedObject):
886
885
  def area(
887
886
  self,
888
887
  # pylint: disable-next=invalid-name
889
- maxError: Optional[_arg_types.ErrorMargin] = None,
890
- proj: Optional[_arg_types.Projection] = None,
888
+ maxError: _arg_types.ErrorMargin | None = None,
889
+ proj: _arg_types.Projection | None = None,
891
890
  ) -> ee_number.Number:
892
891
  """Returns the area of the geometry.
893
892
 
@@ -909,8 +908,8 @@ class Geometry(computedobject.ComputedObject):
909
908
  def bounds(
910
909
  self,
911
910
  # pylint: disable-next=invalid-name
912
- maxError: Optional[_arg_types.ErrorMargin] = None,
913
- proj: Optional[_arg_types.Projection] = None,
911
+ maxError: _arg_types.ErrorMargin | None = None,
912
+ proj: _arg_types.Projection | None = None,
914
913
  ) -> Geometry:
915
914
  """Returns the bounding rectangle of the geometry.
916
915
 
@@ -929,8 +928,8 @@ class Geometry(computedobject.ComputedObject):
929
928
  self,
930
929
  distance: _arg_types.Number,
931
930
  # pylint: disable-next=invalid-name
932
- maxError: Optional[_arg_types.ErrorMargin] = None,
933
- proj: Optional[_arg_types.Projection] = None,
931
+ maxError: _arg_types.ErrorMargin | None = None,
932
+ proj: _arg_types.Projection | None = None,
934
933
  ) -> Geometry:
935
934
  """Returns the input buffered by a given distance.
936
935
 
@@ -957,8 +956,8 @@ class Geometry(computedobject.ComputedObject):
957
956
  def centroid(
958
957
  self,
959
958
  # pylint: disable-next=invalid-name
960
- maxError: Optional[_arg_types.ErrorMargin] = None,
961
- proj: Optional[_arg_types.Projection] = None,
959
+ maxError: _arg_types.ErrorMargin | None = None,
960
+ proj: _arg_types.Projection | None = None,
962
961
  ) -> Geometry:
963
962
  """Returns a point at the center of the highest-dimension components.
964
963
 
@@ -981,8 +980,8 @@ class Geometry(computedobject.ComputedObject):
981
980
  self,
982
981
  right: _arg_types.Geometry,
983
982
  # pylint: disable-next=invalid-name
984
- maxError: Optional[_arg_types.ErrorMargin] = None,
985
- proj: Optional[_arg_types.Projection] = None,
983
+ maxError: _arg_types.ErrorMargin | None = None,
984
+ proj: _arg_types.Projection | None = None,
986
985
  ) -> computedobject.ComputedObject:
987
986
  """Returns the point on the right input that is nearest to the left input.
988
987
 
@@ -1010,8 +1009,8 @@ class Geometry(computedobject.ComputedObject):
1010
1009
  self,
1011
1010
  right: _arg_types.Geometry,
1012
1011
  # pylint: disable-next=invalid-name
1013
- maxError: Optional[_arg_types.ErrorMargin] = None,
1014
- proj: Optional[_arg_types.Projection] = None,
1012
+ maxError: _arg_types.ErrorMargin | None = None,
1013
+ proj: _arg_types.Projection | None = None,
1015
1014
  ) -> computedobject.ComputedObject:
1016
1015
  """Returns the points on the right input that are nearest to the left input.
1017
1016
 
@@ -1042,8 +1041,8 @@ class Geometry(computedobject.ComputedObject):
1042
1041
  self,
1043
1042
  right: _arg_types.Geometry,
1044
1043
  # pylint: disable-next=invalid-name
1045
- maxError: Optional[_arg_types.ErrorMargin] = None,
1046
- proj: Optional[_arg_types.Projection] = None,
1044
+ maxError: _arg_types.ErrorMargin | None = None,
1045
+ proj: _arg_types.Projection | None = None,
1047
1046
  ) -> computedobject.ComputedObject:
1048
1047
  """Returns true if and only if one geometry is contained in the other.
1049
1048
 
@@ -1067,8 +1066,8 @@ class Geometry(computedobject.ComputedObject):
1067
1066
  self,
1068
1067
  right: _arg_types.Geometry,
1069
1068
  # pylint: disable-next=invalid-name
1070
- maxError: Optional[_arg_types.ErrorMargin] = None,
1071
- proj: Optional[_arg_types.Projection] = None,
1069
+ maxError: _arg_types.ErrorMargin | None = None,
1070
+ proj: _arg_types.Projection | None = None,
1072
1071
  ) -> computedobject.ComputedObject:
1073
1072
  """Returns true if and only if one geometry contains the other.
1074
1073
 
@@ -1091,8 +1090,8 @@ class Geometry(computedobject.ComputedObject):
1091
1090
  def convexHull(
1092
1091
  self,
1093
1092
  # pylint: disable-next=invalid-name
1094
- maxError: Optional[_arg_types.ErrorMargin] = None,
1095
- proj: Optional[_arg_types.Projection] = None,
1093
+ maxError: _arg_types.ErrorMargin | None = None,
1094
+ proj: _arg_types.Projection | None = None,
1096
1095
  ) -> Geometry:
1097
1096
  """Returns the convex hull of the given geometry.
1098
1097
 
@@ -1121,7 +1120,7 @@ class Geometry(computedobject.ComputedObject):
1121
1120
  def coveringGrid(
1122
1121
  self,
1123
1122
  proj: _arg_types.Projection,
1124
- scale: Optional[_arg_types.Number] = None,
1123
+ scale: _arg_types.Number | None = None,
1125
1124
  ) -> featurecollection.FeatureCollection:
1126
1125
  """Returns a collection of features that cover this geometry.
1127
1126
 
@@ -1145,8 +1144,8 @@ class Geometry(computedobject.ComputedObject):
1145
1144
  self,
1146
1145
  distances: _arg_types.List,
1147
1146
  # pylint: disable-next=invalid-name
1148
- maxError: Optional[_arg_types.ErrorMargin] = None,
1149
- proj: Optional[_arg_types.Projection] = None,
1147
+ maxError: _arg_types.ErrorMargin | None = None,
1148
+ proj: _arg_types.Projection | None = None,
1150
1149
  ) -> Geometry:
1151
1150
  """Returns geometries cut into pieces along the given distances.
1152
1151
 
@@ -1173,8 +1172,8 @@ class Geometry(computedobject.ComputedObject):
1173
1172
  self,
1174
1173
  right: _arg_types.Geometry,
1175
1174
  # pylint: disable-next=invalid-name
1176
- maxError: Optional[_arg_types.ErrorMargin] = None,
1177
- proj: Optional[_arg_types.Projection] = None,
1175
+ maxError: _arg_types.ErrorMargin | None = None,
1176
+ proj: _arg_types.Projection | None = None,
1178
1177
  ) -> Geometry:
1179
1178
  """Returns the result of subtracting the 'right' geometry from the geometry.
1180
1179
 
@@ -1195,8 +1194,8 @@ class Geometry(computedobject.ComputedObject):
1195
1194
  self,
1196
1195
  right: _arg_types.Geometry,
1197
1196
  # pylint: disable-next=invalid-name
1198
- maxError: Optional[_arg_types.ErrorMargin] = None,
1199
- proj: Optional[_arg_types.Projection] = None,
1197
+ maxError: _arg_types.ErrorMargin | None = None,
1198
+ proj: _arg_types.Projection | None = None,
1200
1199
  ) -> computedobject.ComputedObject:
1201
1200
  """Returns true if and only if the geometries are disjoint.
1202
1201
 
@@ -1219,8 +1218,8 @@ class Geometry(computedobject.ComputedObject):
1219
1218
  def dissolve(
1220
1219
  self,
1221
1220
  # pylint: disable-next=invalid-name
1222
- maxError: Optional[_arg_types.ErrorMargin] = None,
1223
- proj: Optional[_arg_types.Projection] = None,
1221
+ maxError: _arg_types.ErrorMargin | None = None,
1222
+ proj: _arg_types.Projection | None = None,
1224
1223
  ) -> Geometry:
1225
1224
  """Returns the union of the geometry.
1226
1225
 
@@ -1241,9 +1240,9 @@ class Geometry(computedobject.ComputedObject):
1241
1240
  self,
1242
1241
  right: _arg_types.Geometry,
1243
1242
  # pylint: disable-next=invalid-name
1244
- maxError: Optional[_arg_types.ErrorMargin] = None,
1245
- proj: Optional[_arg_types.Projection] = None,
1246
- spherical: Optional[_arg_types.Bool] = None,
1243
+ maxError: _arg_types.ErrorMargin | None = None,
1244
+ proj: _arg_types.Projection | None = None,
1245
+ spherical: _arg_types.Bool | None = None,
1247
1246
  ) -> ee_number.Number:
1248
1247
  """Returns the minimum distance between two geometries.
1249
1248
 
@@ -1325,8 +1324,8 @@ class Geometry(computedobject.ComputedObject):
1325
1324
  self,
1326
1325
  right: _arg_types.Geometry,
1327
1326
  # pylint: disable-next=invalid-name
1328
- maxError: Optional[_arg_types.ErrorMargin] = None,
1329
- proj: Optional[_arg_types.Projection] = None,
1327
+ maxError: _arg_types.ErrorMargin | None = None,
1328
+ proj: _arg_types.Projection | None = None,
1330
1329
  ) -> Geometry:
1331
1330
  """Returns the intersection of the two geometries.
1332
1331
 
@@ -1347,8 +1346,8 @@ class Geometry(computedobject.ComputedObject):
1347
1346
  self,
1348
1347
  right: _arg_types.Geometry,
1349
1348
  # pylint: disable-next=invalid-name
1350
- maxError: Optional[_arg_types.ErrorMargin] = None,
1351
- proj: Optional[_arg_types.Projection] = None,
1349
+ maxError: _arg_types.ErrorMargin | None = None,
1350
+ proj: _arg_types.Projection | None = None,
1352
1351
  ) -> computedobject.ComputedObject:
1353
1352
  """Returns true if and only if the geometries intersect.
1354
1353
 
@@ -1376,8 +1375,8 @@ class Geometry(computedobject.ComputedObject):
1376
1375
  def length(
1377
1376
  self,
1378
1377
  # pylint: disable-next=invalid-name
1379
- maxError: Optional[_arg_types.ErrorMargin] = None,
1380
- proj: Optional[_arg_types.Projection] = None,
1378
+ maxError: _arg_types.ErrorMargin | None = None,
1379
+ proj: _arg_types.Projection | None = None,
1381
1380
  ) -> ee_number.Number:
1382
1381
  """Returns the length of the linear parts of the geometry.
1383
1382
 
@@ -1398,8 +1397,8 @@ class Geometry(computedobject.ComputedObject):
1398
1397
  def perimeter(
1399
1398
  self,
1400
1399
  # pylint: disable-next=invalid-name
1401
- maxError: Optional[_arg_types.ErrorMargin] = None,
1402
- proj: Optional[_arg_types.Projection] = None,
1400
+ maxError: _arg_types.ErrorMargin | None = None,
1401
+ proj: _arg_types.Projection | None = None,
1403
1402
  ) -> ee_number.Number:
1404
1403
  """Returns the perimeter length of the polygonal parts of the geometry.
1405
1404
 
@@ -1436,7 +1435,7 @@ class Geometry(computedobject.ComputedObject):
1436
1435
  def simplify(
1437
1436
  self,
1438
1437
  maxError: _arg_types.ErrorMargin, # pylint: disable=invalid-name
1439
- proj: Optional[_arg_types.Projection] = None,
1438
+ proj: _arg_types.Projection | None = None,
1440
1439
  ) -> Geometry:
1441
1440
  """Returns a simplified geometry to within a given error margin.
1442
1441
 
@@ -1467,8 +1466,8 @@ class Geometry(computedobject.ComputedObject):
1467
1466
  self,
1468
1467
  right: _arg_types.Geometry,
1469
1468
  # pylint: disable-next=invalid-name
1470
- maxError: Optional[_arg_types.ErrorMargin] = None,
1471
- proj: Optional[_arg_types.Projection] = None,
1469
+ maxError: _arg_types.ErrorMargin | None = None,
1470
+ proj: _arg_types.Projection | None = None,
1472
1471
  ) -> Geometry:
1473
1472
  """Returns the symmetric difference between two geometries.
1474
1473
 
@@ -1487,9 +1486,9 @@ class Geometry(computedobject.ComputedObject):
1487
1486
 
1488
1487
  def transform(
1489
1488
  self,
1490
- proj: Optional[_arg_types.Projection] = None,
1489
+ proj: _arg_types.Projection | None = None,
1491
1490
  # pylint: disable-next=invalid-name
1492
- maxError: Optional[_arg_types.ErrorMargin] = None,
1491
+ maxError: _arg_types.ErrorMargin | None = None,
1493
1492
  ) -> Geometry:
1494
1493
  """Returns the geometry Transformed to a specific projection.
1495
1494
 
@@ -1514,8 +1513,8 @@ class Geometry(computedobject.ComputedObject):
1514
1513
  self,
1515
1514
  right: _arg_types.Geometry,
1516
1515
  # pylint: disable-next=invalid-name
1517
- maxError: Optional[_arg_types.ErrorMargin] = None,
1518
- proj: Optional[_arg_types.Projection] = None,
1516
+ maxError: _arg_types.ErrorMargin | None = None,
1517
+ proj: _arg_types.Projection | None = None,
1519
1518
  ) -> Geometry:
1520
1519
  """Returns the union of the two geometries.
1521
1520
 
@@ -1537,8 +1536,8 @@ class Geometry(computedobject.ComputedObject):
1537
1536
  right: _arg_types.Geometry,
1538
1537
  distance: _arg_types.Number,
1539
1538
  # pylint: disable-next=invalid-name
1540
- maxError: Optional[_arg_types.ErrorMargin] = None,
1541
- proj: Optional[_arg_types.Projection] = None,
1539
+ maxError: _arg_types.ErrorMargin | None = None,
1540
+ proj: _arg_types.Projection | None = None,
1542
1541
  ) -> computedobject.ComputedObject:
1543
1542
  """Returns true if the geometries are within a specified distance.
1544
1543