earthengine-api 1.7.8rc0__py3-none-any.whl → 1.7.9__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: earthengine-api
3
- Version: 1.7.8rc0
3
+ Version: 1.7.9
4
4
  Summary: Earth Engine Python API
5
5
  Author-email: Google LLC <noreply@google.com>
6
6
  License: Apache-2.0
@@ -1,5 +1,5 @@
1
- earthengine_api-1.7.8rc0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
- ee/__init__.py,sha256=DK4eecWVgntWOe7i-m_vrJsApEBn21Tktb0_v9Q-UO0,16762
1
+ earthengine_api-1.7.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
+ ee/__init__.py,sha256=egVqpmJfMrMKvX_gT-jVCpbVrq4erXjuDEDLD-5oRLM,16759
3
3
  ee/_arg_types.py,sha256=nrJrnPFnAS8fzMxAGmG3TbUOi_yFVrnSGW5IP8ATzDQ,2662
4
4
  ee/_cloud_api_utils.py,sha256=5WPzP5bcBIbjA7yYN-Cwmht_HU-XobbTrZvRiOEn0e0,32890
5
5
  ee/_helpers.py,sha256=afDDqoz1WESKE-lzqLtrCbvoQ1yVpfvJIgFcmUjO4L8,4821
@@ -87,13 +87,13 @@ ee/tests/errormargin_test.py,sha256=YEBzvBFsD756nicZBcjnPFAXy06jZNKiSSAa2hAzN-M,
87
87
  ee/tests/feature_test.py,sha256=-9wJgY-eJM53ZKYjRcnfWAZXjkF_u8Tn4I1wc209R0U,23336
88
88
  ee/tests/featurecollection_test.py,sha256=CXy240UIRCJNY6nZ8wW-u2O9MqFkUX-ZVba9wTr8OTU,39118
89
89
  ee/tests/filter_test.py,sha256=d-KQ_zI-r7BAMazKqqHMMzNUZdeC46BZiciMfthKEO8,35033
90
- ee/tests/function_test.py,sha256=0hv7H-Q21vdDvqHNH_3NvFj_nPEWM2Fh7CD0wgjXE2M,3131
90
+ ee/tests/function_test.py,sha256=60Yl3K6VvOsObW3jhbhWnb9TzBjdQne63wbZWuyQxbY,3524
91
91
  ee/tests/geometry_point_test.py,sha256=w9MYTwvw2Co9rIjffFB0ezQ_jZz8nxbdgOcyhqTTmjk,15093
92
92
  ee/tests/geometry_test.py,sha256=5cNblTtXg4gg0k1_6go4XL2EldY2StOfD7sQ7Bu0WZU,32424
93
93
  ee/tests/image_converter_test.py,sha256=x29StMrzv6jlATtx3XXC7rEo7Cgrcx0XyVoM-ccVuao,1853
94
- ee/tests/image_test.py,sha256=_SJmee7orPot26vbxKEZcNZ6OsrNrxv3ToInWYLNZLM,150917
95
- ee/tests/imagecollection_test.py,sha256=qosRZXCbhwFuy8qR7DbA-FMl4ktW7Y2cUJHeXLcszpg,38444
96
- ee/tests/join_test.py,sha256=pFILq3qM27rO64WYbBC1A_Gs8_pabRv68X7MU_EM_cw,7630
94
+ ee/tests/image_test.py,sha256=bhu_GLQy0jRJORVNHnpShOHzg-ZptE3XG3r_APiJ4n4,152371
95
+ ee/tests/imagecollection_test.py,sha256=M2WdkCPx-w7wWFGw9q2XHRAXo7rCMAqIZknjhldlPs4,41535
96
+ ee/tests/join_test.py,sha256=uuMW2tvHVoBXuanhcsJ95cQTfRjJTs5gmaPrzAJZrGM,7860
97
97
  ee/tests/kernel_test.py,sha256=-0nZVNSxE1IGs4y60oijISh2Hi1V7NCjrmUnEMDd0nQ,19378
98
98
  ee/tests/model_test.py,sha256=dgnWfqR4R4MIUljMBL1TOcztzA-lWEl7cT5f2Y0k2ck,12483
99
99
  ee/tests/oauth_test.py,sha256=8hldNiR3AYtQkWA4vwwSAO6jDIsh_fww7b_cOI9MJjo,9202
@@ -103,8 +103,8 @@ ee/tests/reducer_test.py,sha256=vqXpgLZ7fPyfZ12srpREgMpfrKYLcFQod3Qn1Niv7VM,3197
103
103
  ee/tests/serializer_test.py,sha256=d6IEW_dt-G900IRfQnZftrwjpc1wJ-ouaQQwaLO0FxI,9834
104
104
  ee/tests/table_converter_test.py,sha256=t4yIfy40R3U17I_2nVtKm_Q2Tae-UifwZLz8qOmoC9A,5091
105
105
  ee/tests/terrain_test.py,sha256=inZ2sy807nDG_HMutzGHaqcTUaLnZQOMdWyf0NrQzV0,4561
106
- earthengine_api-1.7.8rc0.dist-info/METADATA,sha256=AclNvSHk6s2ueWnRMQeTyo9YP4f5YKZm2P1FqfIIxc8,2198
107
- earthengine_api-1.7.8rc0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
108
- earthengine_api-1.7.8rc0.dist-info/entry_points.txt,sha256=-Ax4SCU-S474r8OD2LIxata6PRmkZoDrppQ4fP_exNc,50
109
- earthengine_api-1.7.8rc0.dist-info/top_level.txt,sha256=go5zOwCgm5lIS3yTR-Vsxp1gNI4qdS-MP5eY-7zMxVY,3
110
- earthengine_api-1.7.8rc0.dist-info/RECORD,,
106
+ earthengine_api-1.7.9.dist-info/METADATA,sha256=lebc7nR6BBje0swYH-S9jec7wr2Tc0skwu1bnyfWwWE,2195
107
+ earthengine_api-1.7.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
108
+ earthengine_api-1.7.9.dist-info/entry_points.txt,sha256=-Ax4SCU-S474r8OD2LIxata6PRmkZoDrppQ4fP_exNc,50
109
+ earthengine_api-1.7.9.dist-info/top_level.txt,sha256=go5zOwCgm5lIS3yTR-Vsxp1gNI4qdS-MP5eY-7zMxVY,3
110
+ earthengine_api-1.7.9.dist-info/RECORD,,
ee/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """The EE Python library."""
2
2
 
3
- __version__ = '1.7.8rc0'
3
+ __version__ = '1.7.9'
4
4
 
5
5
  # Using lowercase function naming to match the JavaScript names.
6
6
  # pylint: disable=g-bad-name
ee/tests/function_test.py CHANGED
@@ -34,6 +34,11 @@ Args:
34
34
 
35
35
  class FunctionTest(unittest.TestCase):
36
36
 
37
+ def test_get_signature_not_implemented(self):
38
+ message = 'Function subclasses must implement getSignature()'
39
+ with self.assertRaisesRegex(NotImplementedError, message):
40
+ ee.Function().getSignature()
41
+
37
42
  def test_name_args(self):
38
43
  """Verifies that Functions can convert positional to named arguments."""
39
44
  self.assertEqual({}, TEST_FUNC.nameArgs([]))
@@ -43,6 +48,13 @@ class FunctionTest(unittest.TestCase):
43
48
 
44
49
  self.assertRaisesRegex(ee.EEException, 'Too many', TEST_FUNC.nameArgs,
45
50
  [1, 2, 3])
51
+ self.assertRaisesRegex(
52
+ ee.EEException,
53
+ 'Argument a specified as both positional and keyword',
54
+ TEST_FUNC.nameArgs,
55
+ [1],
56
+ {'a': 2},
57
+ )
46
58
 
47
59
  def test_promote_args(self):
48
60
  """Verifies that Functions can promote and verify their arguments."""
ee/tests/image_test.py CHANGED
@@ -97,6 +97,20 @@ class ImageTest(apitestcase.ApiTestCase):
97
97
  'value': 'foo'
98
98
  }, from_variable.encode(None))
99
99
 
100
+ def test_constructor_invalid_version(self):
101
+ with self.assertRaisesRegex(
102
+ ee_exception.EEException,
103
+ r'If version is specified, the arg to Image\(\) must be a string',
104
+ ):
105
+ ee.Image(123, version=456)
106
+
107
+ def test_constructor_unrecognized_type(self):
108
+ with self.assertRaisesRegex(
109
+ ee_exception.EEException,
110
+ 'Unrecognized argument type to convert to an Image:',
111
+ ):
112
+ ee.Image({'some': 'dict'})
113
+
100
114
  def test_image_signatures(self):
101
115
  """Verifies that the API functions are added to ee.Image."""
102
116
  self.assertTrue(hasattr(ee.Image(1), 'addBands'))
@@ -629,6 +643,19 @@ class CloudThumbnailAndExportImageTest(apitestcase.ApiTestCase):
629
643
  )
630
644
  self.assertEqual({}, params)
631
645
 
646
+ def test_prepare_for_export_with_crs_and_crsTransform(self):
647
+ with apitestcase.UsingCloudApi():
648
+ image, params = self._base_image.prepare_for_export(
649
+ {'crs': 'ABCD', 'crsTransform': '1,2,3,4,5,6'}
650
+ )
651
+ self.assertImageEqual(
652
+ self._base_image.reproject(
653
+ crs='ABCD', crsTransform=[1, 2, 3, 4, 5, 6]
654
+ ),
655
+ image,
656
+ )
657
+ self.assertEqual({}, params)
658
+
632
659
  def test_prepare_for_export_invalid_crs_and_transform(self):
633
660
  with apitestcase.UsingCloudApi():
634
661
  with self.assertRaises(ee_exception.EEException):
@@ -637,6 +664,20 @@ class CloudThumbnailAndExportImageTest(apitestcase.ApiTestCase):
637
664
  self._base_image.prepare_for_export(
638
665
  {'crs': 'ABCD', 'crs_transform': 'x'}
639
666
  )
667
+ with self.assertRaisesRegex(
668
+ ee_exception.EEException,
669
+ 'Both "crs_transform" and "crsTransform" are specified.',
670
+ ):
671
+ self._base_image.prepare_for_export({
672
+ 'crs': 'EPSG:4326',
673
+ 'crs_transform': [1, 2, 3, 4, 5, 6],
674
+ 'crsTransform': [1, 2, 3, 4, 5, 6],
675
+ })
676
+
677
+ def test_prepare_for_export_invalid_dimensions(self):
678
+ with apitestcase.UsingCloudApi():
679
+ with self.assertRaisesRegex(ee_exception.EEException, 'Invalid dimensions'):
680
+ self._base_image.prepare_for_export({'dimensions': [1, 2, 3]})
640
681
 
641
682
  def test_prepare_for_export_with_polygon(self):
642
683
  with apitestcase.UsingCloudApi():
@@ -84,6 +84,13 @@ class ImageCollectionTest(apitestcase.ApiTestCase):
84
84
  ee.ComputedObject(None, {'x': 'y'}))
85
85
  self.assertEqual({'x': 'y'}, from_computed_object.args)
86
86
 
87
+ def test_unrecognized_type(self):
88
+ with self.assertRaisesRegex(
89
+ ee.EEException,
90
+ 'Unrecognized argument type to convert to an ImageCollection: 123',
91
+ ):
92
+ ee.ImageCollection(123)
93
+
87
94
  def test_imperative_functions(self):
88
95
  """Verifies that imperative functions return ready values."""
89
96
  image_collection = ee.ImageCollection(ee.Image(1))
@@ -135,6 +142,18 @@ class ImageCollectionTest(apitestcase.ApiTestCase):
135
142
  collection.serialize(for_cloud_api=True))
136
143
  self.assertEqual({}, params)
137
144
 
145
+ def test_filmstrip_thumb_url_invalid_format(self):
146
+ """Verifies correct thumbnailing behavior."""
147
+ message = r'Invalid format specified for thumbnail\. gif'
148
+ with self.assertRaisesRegex(ee.EEException, message):
149
+ ee.ImageCollection(ee.Image(1)).getFilmstripThumbURL({'format': 'gif'})
150
+
151
+ def test_video_thumb_url_invalid_format(self):
152
+ """Verifies correct thumbnailing behavior."""
153
+ message = r'Invalid format specified for thumbnail\. png'
154
+ with self.assertRaisesRegex(ee.EEException, message):
155
+ ee.ImageCollection(ee.Image(1)).getVideoThumbURL({'format': 'png'})
156
+
138
157
  def test_select_opt_params(self):
139
158
  result = (
140
159
  ee.ImageCollection([])
@@ -143,6 +162,56 @@ class ImageCollectionTest(apitestcase.ApiTestCase):
143
162
  )
144
163
  self.assertIn('"newNames": {"constantValue": ["name_a", "name_b"]}', result)
145
164
 
165
+ def test_link_collection_all_args(self):
166
+ image_collection_1 = ee.ImageCollection('a')
167
+ image_collection_2 = ee.ImageCollection('b')
168
+ linked_bands = ['b1', 'b2']
169
+ linked_properties = ['p1', 'p2']
170
+ match_property_name = 'p3'
171
+ result = image_collection_1.linkCollection(
172
+ image_collection_2,
173
+ linked_bands,
174
+ linked_properties,
175
+ match_property_name,
176
+ )
177
+ self.assertIsInstance(result, ee.ImageCollection)
178
+ self.assertEqual(ee.ApiFunction.lookup('Collection.map'), result.func)
179
+ self.assertEqual(image_collection_1, result.args['collection'])
180
+ self.assertIsInstance(result.args['baseAlgorithm'], ee.Function)
181
+
182
+ serialized = result.serialize()
183
+ self.assertIn('"functionName": "ImageCollection.load"', serialized)
184
+ self.assertIn('"id": {"constantValue": "a"}', serialized)
185
+ self.assertIn('"functionName": "Image.linkCollection"', serialized)
186
+ self.assertIn('"id": {"constantValue": "b"}', serialized)
187
+ self.assertIn('"linkedBands": {"constantValue": ["b1", "b2"]}', serialized)
188
+ self.assertIn(
189
+ '"linkedProperties": {"constantValue": ["p1", "p2"]}', serialized
190
+ )
191
+ self.assertIn('"matchPropertyName": {"constantValue": "p3"}', serialized)
192
+
193
+ def test_link_collection_necessary_args(self):
194
+ image_collection_1 = ee.ImageCollection('a')
195
+ image_collection_2 = ee.ImageCollection('b')
196
+ linked_bands = ['b1', 'b2']
197
+ result = image_collection_1.linkCollection(
198
+ image_collection_2,
199
+ linkedBands=linked_bands,
200
+ )
201
+ self.assertIsInstance(result, ee.ImageCollection)
202
+ self.assertEqual(ee.ApiFunction.lookup('Collection.map'), result.func)
203
+ self.assertEqual(image_collection_1, result.args['collection'])
204
+ self.assertIsInstance(result.args['baseAlgorithm'], ee.Function)
205
+
206
+ serialized = result.serialize()
207
+ self.assertIn('"functionName": "ImageCollection.load"', serialized)
208
+ self.assertIn('"id": {"constantValue": "a"}', serialized)
209
+ self.assertIn('"functionName": "Image.linkCollection"', serialized)
210
+ self.assertIn('"id": {"constantValue": "b"}', serialized)
211
+ self.assertIn('"linkedBands": {"constantValue": ["b1", "b2"]}', serialized)
212
+ self.assertNotIn('"linkedProperties"', serialized)
213
+ self.assertNotIn('"matchPropertyName"', serialized)
214
+
146
215
  def test_aggregate_array(self):
147
216
  property_name = 'property name'
148
217
  expect = make_expression_graph({
ee/tests/join_test.py CHANGED
@@ -28,6 +28,11 @@ class JoinTest(apitestcase.ApiTestCase):
28
28
  with self.assertRaisesRegex(TypeError, message):
29
29
  ee.Join() # pytype:disable=missing-parameter
30
30
 
31
+ def test_join_type_error(self):
32
+ message = r"Join can only be used as a cast to Join\. Found <class 'str'>"
33
+ with self.assertRaisesRegex(TypeError, message):
34
+ ee.Join('some string') # pytype:disable=wrong-arg-types
35
+
31
36
  def test_apply(self):
32
37
  expect = make_expression_graph({
33
38
  'arguments': {