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/tests/collection_test.py
CHANGED
|
@@ -11,7 +11,7 @@ from ee import apitestcase
|
|
|
11
11
|
|
|
12
12
|
class CollectionTestCase(apitestcase.ApiTestCase):
|
|
13
13
|
|
|
14
|
-
def
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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')
|
ee/tests/confusionmatrix_test.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""Tests for the ee.ConfusionMatrix module."""
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
|
-
from typing import Any
|
|
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:
|
|
30
|
-
) ->
|
|
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}},
|