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
@@ -11,7 +11,7 @@ from ee import apitestcase
11
11
 
12
12
  class CollectionTestCase(apitestcase.ApiTestCase):
13
13
 
14
- def testSortAndLimit(self):
14
+ def test_sort_and_limit(self):
15
15
  """Verifies the behavior of the sort() and limit() methods."""
16
16
  collection = ee.Collection(ee.Function(), {})
17
17
 
@@ -41,12 +41,16 @@ class CollectionTestCase(apitestcase.ApiTestCase):
41
41
  'ascending': False
42
42
  }, reverse_sorted_collection.args)
43
43
 
44
- def testFilter(self):
44
+ def test_filter(self):
45
45
  """Verifies the behavior of filter() method."""
46
46
  collection = ee.Collection(ee.Function(), {})
47
47
 
48
48
  # We don't allow empty filters.
49
49
  self.assertRaises(Exception, collection.filter)
50
+ with self.assertRaisesRegex(ee.EEException, 'Empty filters.'):
51
+ collection.filter(None) # pytype: disable=wrong-arg-types
52
+ with self.assertRaisesRegex(ee.EEException, 'Empty filters.'):
53
+ collection.filter('')
50
54
 
51
55
  filtered = collection.filter(ee.Filter.eq('foo', 1))
52
56
  self.assertEqual(ee.ApiFunction.lookup('Collection.filter'), filtered.func)
@@ -56,7 +60,7 @@ class CollectionTestCase(apitestcase.ApiTestCase):
56
60
  }, filtered.args)
57
61
  self.assertIsInstance(filtered, ee.Collection)
58
62
 
59
- def testFilterShortcuts(self):
63
+ def test_filter_shortcuts(self):
60
64
  """Verifies the behavior of the various filtering shortcut methods."""
61
65
  collection = ee.Collection(ee.Function(), {})
62
66
  geom = {'type': 'Polygon', 'coordinates': [[[1, 2], [3, 4]]]}
@@ -75,7 +79,38 @@ class CollectionTestCase(apitestcase.ApiTestCase):
75
79
  collection.filter(ee.Filter.eq('foo', 13)),
76
80
  collection.filterMetadata('foo', 'equals', 13))
77
81
 
78
- def testMapping(self):
82
+ def test_load_table(self):
83
+ """Verifies Collection.loadTable()."""
84
+ table_id = 'a/table/id'
85
+ geometry_column = 'geom'
86
+ version = 123
87
+ result = ee.Collection.loadTable(
88
+ tableId=table_id, geometryColumn=geometry_column, version=version
89
+ )
90
+ self.assertEqual(ee.ApiFunction.lookup('Collection.loadTable'), result.func)
91
+ self.assertEqual(
92
+ {
93
+ 'tableId': ee.String(table_id),
94
+ 'geometryColumn': ee.String(geometry_column),
95
+ 'version': ee.Number(version),
96
+ },
97
+ result.args,
98
+ )
99
+ self.assertIsInstance(result, ee.FeatureCollection)
100
+
101
+ result2 = ee.Collection.loadTable(tableId=table_id)
102
+ self.assertEqual(ee.ApiFunction.lookup('Collection.loadTable'), result2.func)
103
+ self.assertEqual(
104
+ {
105
+ 'tableId': ee.String(table_id),
106
+ 'geometryColumn': None,
107
+ 'version': None,
108
+ },
109
+ result2.args,
110
+ )
111
+ self.assertIsInstance(result2, ee.FeatureCollection)
112
+
113
+ def test_mapping(self):
79
114
  """Verifies the behavior of the map() method."""
80
115
  collection = ee.ImageCollection('foo')
81
116
  algorithm = lambda img: img.select('bar')
@@ -96,7 +131,7 @@ class CollectionTestCase(apitestcase.ApiTestCase):
96
131
  self.assertEqual(expected_function.serialize(),
97
132
  mapped.args['baseAlgorithm'].serialize())
98
133
 
99
- def testNestedMapping(self):
134
+ def test_nested_mapping(self):
100
135
  """Verifies that nested map() calls produce distinct variables."""
101
136
  collection = ee.FeatureCollection('foo')
102
137
  result = collection.map(lambda x: collection.map(lambda y: [x, y]))
@@ -115,7 +150,7 @@ class CollectionTestCase(apitestcase.ApiTestCase):
115
150
  self.assertEqual('_MAPPING_VAR_0_0',
116
151
  inner_result.args['baseAlgorithm']._body[1].varName)
117
152
 
118
- def testIteration(self):
153
+ def test_iteration(self):
119
154
  """Verifies the behavior of the iterate() method."""
120
155
  collection = ee.ImageCollection('foo')
121
156
  first = ee.Image(0)
@@ -140,7 +175,7 @@ class CollectionTestCase(apitestcase.ApiTestCase):
140
175
  self.assertEqual(expected_function.serialize(),
141
176
  result.args['function'].serialize())
142
177
 
143
- def testNestedFunctions(self):
178
+ def test_nested_functions(self):
144
179
  """Verifies that nested function calls produce distinct variables."""
145
180
  fc = ee.FeatureCollection('fc')
146
181
  def f0(feat):
@@ -159,7 +194,7 @@ class CollectionTestCase(apitestcase.ApiTestCase):
159
194
  '0_0, 1_0, 1_1, 2_0, 2_1, 3_0, 3_1, 4_0',
160
195
  ', '.join(sorted(set(mapped_vars))))
161
196
 
162
- def testUnboundArguments(self):
197
+ def test_unbound_arguments(self):
163
198
  fc = ee.FeatureCollection('fc')
164
199
  with self.assertRaisesRegex(
165
200
  Exception, 'User-defined methods must return a value'):
@@ -172,11 +207,11 @@ class CollectionTestCase(apitestcase.ApiTestCase):
172
207
  ):
173
208
  fc.map(lambda x: x.serialize())
174
209
 
175
- def testInitOptVarName(self):
210
+ def test_init_opt_var_name(self):
176
211
  result = ee.Collection(func=None, args=None, opt_varName='test').serialize()
177
212
  self.assertIn('"argumentReference": "test"', result)
178
213
 
179
- def testFilterDateOptParams(self):
214
+ def test_filter_date_opt_params(self):
180
215
  result = (
181
216
  ee.Collection(func=None, args=None, varName='test')
182
217
  .filterDate(0, opt_end=42)
@@ -184,7 +219,7 @@ class CollectionTestCase(apitestcase.ApiTestCase):
184
219
  )
185
220
  self.assertIn('"end": {"constantValue": 42}', result)
186
221
 
187
- def testLimitOptParams(self):
222
+ def test_limit_opt_params(self):
188
223
  result = (
189
224
  ee.Collection(func=None, args=None, varName='test')
190
225
  .limit(0, opt_property='abc', opt_ascending=True)
@@ -193,7 +228,7 @@ class CollectionTestCase(apitestcase.ApiTestCase):
193
228
  self.assertIn('"key": {"constantValue": "abc"}', result)
194
229
  self.assertIn('"ascending": {"constantValue": true}', result)
195
230
 
196
- def testSortOptParams(self):
231
+ def test_sort_opt_params(self):
197
232
  result = (
198
233
  ee.Collection(func=None, args=None, varName='test')
199
234
  .sort('abc', opt_ascending=True)
@@ -201,7 +236,7 @@ class CollectionTestCase(apitestcase.ApiTestCase):
201
236
  )
202
237
  self.assertIn('"ascending": {"constantValue": true}', result)
203
238
 
204
- def testMapOptParams(self):
239
+ def test_map_opt_params(self):
205
240
  a_func = lambda x: ee.Image(0)
206
241
  result = (
207
242
  ee.Collection(func=None, args=None, varName='test')
@@ -2,7 +2,7 @@
2
2
  """Tests for the ee.ConfusionMatrix module."""
3
3
 
4
4
  import json
5
- from typing import Any, Dict
5
+ from typing import Any
6
6
 
7
7
  import unittest
8
8
  import ee
@@ -26,8 +26,8 @@ MATRIX = {
26
26
 
27
27
 
28
28
  def make_expression_graph(
29
- function_invocation_value: Dict[str, Any],
30
- ) -> Dict[str, Any]:
29
+ function_invocation_value: dict[str, Any],
30
+ ) -> dict[str, Any]:
31
31
  return {
32
32
  'result': '0',
33
33
  'values': {'0': {'functionInvocationValue': function_invocation_value}},