earthengine-api 1.7.9rc0__py3-none-any.whl → 1.7.10rc0__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.9rc0
3
+ Version: 1.7.10rc0
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.9rc0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
- ee/__init__.py,sha256=Wj-KQ4KUWD6Sh9Urx4rxEfmJNrSxKHrsC2cAM4MZ8ks,16762
1
+ earthengine_api-1.7.10rc0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
+ ee/__init__.py,sha256=VQd47xDwRNdo7ygHuIypAiPnEJUbNJrT6RgNP2O706A,16763
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
@@ -32,12 +32,12 @@ ee/encodable.py,sha256=bZLsuIPNO5_nOBuwnbhuxTRcjTKqFPgL8ox7uy41w6M,1963
32
32
  ee/errormargin.py,sha256=x8kAgFeUdXmpc_kv8Vx5qv-fHeJvFU9EBFbSOxhNl8Y,3039
33
33
  ee/feature.py,sha256=Qp5Dyl0eM6yjmQSH0D-dc9LEeKMCqlNibYJ9jOhHsaE,30326
34
34
  ee/featurecollection.py,sha256=HBLIAS0HogRzTEVHaLn-X9ONfdu5qFvN_6Bb54KYQ28,14400
35
- ee/filter.py,sha256=GKz3IqeZSrK4X26TjWaw_uOE8KjZgSx1pS1zM07PXfI,35321
35
+ ee/filter.py,sha256=Zu1t4rZItJmEgIzdfwkhyYwGMoFtNJUuTPdX7xMuJoE,34378
36
36
  ee/function.py,sha256=X-Mz0AvF_l809NZXK8RM6fa2h-nP7YU2sUFp6hvIbdU,7049
37
37
  ee/geometry.py,sha256=D__UeT72DDaJFakmyaPnmfHwxNtDxLJW7Vbze0Hh2Y4,59517
38
38
  ee/image.py,sha256=8ErloWEwLZZRHgwf5SHITnMvRAawPZtGC6Kfq-jCTK8,170923
39
39
  ee/image_converter.py,sha256=LblcmkWruE0BjItZ7ICv87XZlCCjZeX2HmGxf47HXyo,1469
40
- ee/imagecollection.py,sha256=5ZUUreU0iY23UC9sd8gh8fLapVZTruV3DGhsjmQF0xg,27102
40
+ ee/imagecollection.py,sha256=-2x37vsl3mOLa2dZUCL0GBaxR265DD_BOuH7NsMFmGU,27107
41
41
  ee/join.py,sha256=idnuzRNFvKHRLHV5m9unp_xTsZb-E2kfgUCEYSg64ts,7578
42
42
  ee/kernel.py,sha256=eTzJFvW4nbyiFl2dDZ0_cA_o3KqCbBewY-BDp7tCB_M,15002
43
43
  ee/mapclient.py,sha256=feCFwL76juFFZPI4uycVxUoFMeEFbPFfIVETkmpvmcY,17491
@@ -86,13 +86,13 @@ ee/tests/encodable_test.py,sha256=tRCtW6HO5-OnjXlxVUEUgoVrEOllvs-Z9pWMXISMYHQ,83
86
86
  ee/tests/errormargin_test.py,sha256=YEBzvBFsD756nicZBcjnPFAXy06jZNKiSSAa2hAzN-M,5061
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
- ee/tests/filter_test.py,sha256=d-KQ_zI-r7BAMazKqqHMMzNUZdeC46BZiciMfthKEO8,35033
89
+ ee/tests/filter_test.py,sha256=VB5R4GdHKqzIJrpxlyBrGu5kv0_5lOYjsMu8AWhd8-8,37047
90
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=bhu_GLQy0jRJORVNHnpShOHzg-ZptE3XG3r_APiJ4n4,152371
95
- ee/tests/imagecollection_test.py,sha256=M2WdkCPx-w7wWFGw9q2XHRAXo7rCMAqIZknjhldlPs4,41535
94
+ ee/tests/image_test.py,sha256=A2vxHBOt0Xo5FQQYWzr9cu2XfL1Lz1dcHTeGIWwIiEU,154615
95
+ ee/tests/imagecollection_test.py,sha256=iYDj8q8VOywBN4rc-8cvDm59dEysrwA9Eq_X-bL_X8k,42691
96
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
@@ -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.9rc0.dist-info/METADATA,sha256=dqnhR0YwRAxz41x1Mn4hGM2dFBoAZOPxgQEr_9hyhy4,2198
107
- earthengine_api-1.7.9rc0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
108
- earthengine_api-1.7.9rc0.dist-info/entry_points.txt,sha256=-Ax4SCU-S474r8OD2LIxata6PRmkZoDrppQ4fP_exNc,50
109
- earthengine_api-1.7.9rc0.dist-info/top_level.txt,sha256=go5zOwCgm5lIS3yTR-Vsxp1gNI4qdS-MP5eY-7zMxVY,3
110
- earthengine_api-1.7.9rc0.dist-info/RECORD,,
106
+ earthengine_api-1.7.10rc0.dist-info/METADATA,sha256=J-f7WEECoA-LUQ5C8ZtGvmrksKq9OwnzLwyqkelDnxo,2199
107
+ earthengine_api-1.7.10rc0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
108
+ earthengine_api-1.7.10rc0.dist-info/entry_points.txt,sha256=-Ax4SCU-S474r8OD2LIxata6PRmkZoDrppQ4fP_exNc,50
109
+ earthengine_api-1.7.10rc0.dist-info/top_level.txt,sha256=go5zOwCgm5lIS3yTR-Vsxp1gNI4qdS-MP5eY-7zMxVY,3
110
+ earthengine_api-1.7.10rc0.dist-info/RECORD,,
ee/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """The EE Python library."""
2
2
 
3
- __version__ = '1.7.9rc0'
3
+ __version__ = '1.7.10rc0'
4
4
 
5
5
  # Using lowercase function naming to match the JavaScript names.
6
6
  # pylint: disable=g-bad-name
ee/filter.py CHANGED
@@ -7,7 +7,6 @@ Example usage:
7
7
  .lt('time', value)
8
8
  """
9
9
 
10
- # Using lowercase function naming to match the JavaScript names.
11
10
  # pylint: disable=g-bad-name
12
11
 
13
12
  from __future__ import annotations
@@ -70,9 +69,8 @@ class Filter(computedobject.ComputedObject):
70
69
  super().__init__(filter_.func, filter_.args, filter_.varName)
71
70
  self._filter = (filter_,)
72
71
  elif filter_ is None:
73
- # A silly call with no arguments left for backward-compatibility.
74
- # Encoding such a filter is expected to fail, but it can be composed
75
- # by calling the various methods that end up in _append().
72
+ # A call with no arguments left for backward-compatibility.
73
+ # Encoding such a filter is expected to fail.
76
74
  super().__init__(None, None)
77
75
  self._filter = ()
78
76
  else:
@@ -102,31 +100,6 @@ class Filter(computedobject.ComputedObject):
102
100
  """
103
101
  return len(self._filter)
104
102
 
105
- def _append(self, new_filter: _arg_types.Filter) -> Filter:
106
- """Append a predicate to this filter.
107
-
108
- These are implicitly ANDed.
109
-
110
- Args:
111
- new_filter: The filter to append to this one. Possible types are:
112
- 1) another fully constructed Filter,
113
- 2) a JSON representation of a filter,
114
- 3) an array of 1 or 2.
115
-
116
- Returns:
117
- A new filter that is the combination of both.
118
- """
119
- if new_filter is None:
120
- raise ValueError('new_filter should never be None')
121
- prev = list(self._filter)
122
- if isinstance(new_filter, Filter):
123
- prev.extend(new_filter._filter) # pylint: disable=protected-access
124
- elif isinstance(new_filter, list):
125
- prev.extend(new_filter)
126
- else:
127
- prev.append(new_filter)
128
- return Filter(prev)
129
-
130
103
  @staticmethod
131
104
  def metadata_(name: str, operator: str, value: _arg_types.Any) -> Filter:
132
105
  """Filter on metadata. This is deprecated.
ee/imagecollection.py CHANGED
@@ -299,7 +299,8 @@ class ImageCollection(collection.Collection[image.Image]):
299
299
  request['format'] = params.get('format', valid_formats[0])
300
300
  if request['format'] not in valid_formats:
301
301
  raise ee_exception.EEException(
302
- 'Invalid format specified for thumbnail. ' + str(params['format']))
302
+ f'Invalid format specified for thumbnail: "{request["format"]}"'
303
+ )
303
304
 
304
305
  if params and 'framesPerSecond' in params:
305
306
  request['framesPerSecond'] = params.get('framesPerSecond')
ee/tests/filter_test.py CHANGED
@@ -40,6 +40,64 @@ class FilterTest(apitestcase.ApiTestCase):
40
40
  copy = ee.Filter(from_static_method)
41
41
  self.assertEqual(from_static_method, copy)
42
42
 
43
+ def test_constructor_no_args(self):
44
+ # This is code to be avoided, but since it has been this way for a long
45
+ # time, this captures the current behavior.
46
+ # Please do not use `ee.Filter()` to access static methods like `Or`.
47
+ # Instead, call them directly on the class, e.g., `ee.Filter.Or(...)`.
48
+ a_filter = ee.Filter()
49
+ self.assertEqual(a_filter.predicateCount(), 0)
50
+
51
+ self.assertTrue(a_filter.isVariable())
52
+
53
+ # Not very intuitive error message.
54
+ with self.assertRaisesRegex(ee.EEException, 'arguments cannot be used'):
55
+ a_filter.serialize()
56
+
57
+ # Not very intuitive error message.
58
+ with self.assertRaisesRegex(ee.EEException, 'arguments cannot be used'):
59
+ str(a_filter)
60
+
61
+ def test_empty_list_filter(self):
62
+ with self.assertRaisesRegex(
63
+ ee.EEException, 'Empty list specified for ee.Filter().'
64
+ ):
65
+ ee.Filter([])
66
+
67
+ def test_list_of_filters(self):
68
+ f1 = ee.Filter.eq('x', 1)
69
+ f2 = ee.Filter.eq('y', 2)
70
+ filters = [f1, f2]
71
+ multi_filter = ee.Filter(filters)
72
+ self.assertEqual(tuple(filters), multi_filter._filter)
73
+ self.assertEqual(ee.ApiFunction.lookup('Filter.and'), multi_filter.func)
74
+ self.assertEqual({'filters': tuple(filters)}, multi_filter.args)
75
+
76
+ def test_invalid_argument(self):
77
+ with self.assertRaisesRegex(
78
+ ee.EEException, 'Invalid argument specified for ee.Filter().*'
79
+ ):
80
+ ee.Filter(123) # pytype: disable=wrong-arg-types
81
+
82
+ def test_predicate_count(self):
83
+ self.assertEqual(0, ee.Filter().predicateCount())
84
+ self.assertEqual(1, ee.Filter(ee.Filter.eq('x', 1)).predicateCount())
85
+ self.assertEqual(1, ee.Filter([ee.Filter.eq('x', 1)]).predicateCount())
86
+ self.assertEqual(
87
+ 2,
88
+ ee.Filter(
89
+ [ee.Filter.eq('x', 1), ee.Filter.eq('y', 2)]
90
+ ).predicateCount(),
91
+ )
92
+ self.assertEqual(
93
+ 3,
94
+ ee.Filter([
95
+ ee.Filter.eq('x', 1),
96
+ ee.Filter.eq('y', 2),
97
+ ee.Filter.eq('z', 3),
98
+ ]).predicateCount(),
99
+ )
100
+
43
101
  def test_metadata(self):
44
102
  """Verifies that the metadata_() method works."""
45
103
  self.assertEqual(
ee/tests/image_test.py CHANGED
@@ -148,6 +148,60 @@ class ImageTest(apitestcase.ApiTestCase):
148
148
  'srcImg': image2
149
149
  }, combined.args['input'].args)
150
150
 
151
+ def test_rgb(self):
152
+ """Verifies the behavior of ee.Image.rgb()."""
153
+ r = 1.1
154
+ g = 2.2
155
+ b = 3.3
156
+ expression = ee.Image.rgb(r, g, b)
157
+ expect = make_expression_graph({
158
+ 'arguments': {
159
+ 'input': {
160
+ 'functionInvocationValue': {
161
+ 'functionName': 'Image.addBands',
162
+ 'arguments': {
163
+ 'dstImg': {
164
+ 'functionInvocationValue': {
165
+ 'functionName': 'Image.addBands',
166
+ 'arguments': {
167
+ 'dstImg': {
168
+ 'functionInvocationValue': {
169
+ 'functionName': 'Image.constant',
170
+ 'arguments': {
171
+ 'value': {'constantValue': r}
172
+ },
173
+ }
174
+ },
175
+ 'srcImg': {
176
+ 'functionInvocationValue': {
177
+ 'functionName': 'Image.constant',
178
+ 'arguments': {
179
+ 'value': {'constantValue': g}
180
+ },
181
+ }
182
+ },
183
+ },
184
+ }
185
+ },
186
+ 'srcImg': {
187
+ 'functionInvocationValue': {
188
+ 'functionName': 'Image.constant',
189
+ 'arguments': {'value': {'constantValue': b}},
190
+ }
191
+ },
192
+ },
193
+ }
194
+ },
195
+ 'bandSelectors': {'constantValue': ['.*']},
196
+ 'newNames': {
197
+ 'constantValue': ['vis-red', 'vis-green', 'vis-blue']
198
+ },
199
+ },
200
+ 'functionName': 'Image.select',
201
+ })
202
+ result = json.loads(expression.serialize())
203
+ self.assertEqual(expect, result)
204
+
151
205
  def test_select(self):
152
206
  """Verifies regression in the behavior of empty ee.Image.select()."""
153
207
  image = ee.Image([1, 2]).select()
@@ -144,13 +144,13 @@ class ImageCollectionTest(apitestcase.ApiTestCase):
144
144
 
145
145
  def test_filmstrip_thumb_url_invalid_format(self):
146
146
  """Verifies correct thumbnailing behavior."""
147
- message = r'Invalid format specified for thumbnail\. gif'
147
+ message = r'Invalid format specified for thumbnail: "gif"'
148
148
  with self.assertRaisesRegex(ee.EEException, message):
149
149
  ee.ImageCollection(ee.Image(1)).getFilmstripThumbURL({'format': 'gif'})
150
150
 
151
151
  def test_video_thumb_url_invalid_format(self):
152
152
  """Verifies correct thumbnailing behavior."""
153
- message = r'Invalid format specified for thumbnail\. png'
153
+ message = r'Invalid format specified for thumbnail: "png"'
154
154
  with self.assertRaisesRegex(ee.EEException, message):
155
155
  ee.ImageCollection(ee.Image(1)).getVideoThumbURL({'format': 'png'})
156
156
 
@@ -722,7 +722,38 @@ class ImageCollectionTest(apitestcase.ApiTestCase):
722
722
  result = json.loads(expression.serialize())
723
723
  self.assertEqual(expect, result)
724
724
 
725
- # fromImages already tested in other tests.
725
+ def test_from_images(self):
726
+ images = [ee.Image(1), ee.Image(2)]
727
+ expect = make_expression_graph({
728
+ 'arguments': {
729
+ 'images': {
730
+ 'arrayValue': {
731
+ 'values': [
732
+ {
733
+ 'functionInvocationValue': {
734
+ 'functionName': 'Image.constant',
735
+ 'arguments': {'value': {'constantValue': 1}},
736
+ }
737
+ },
738
+ {
739
+ 'functionInvocationValue': {
740
+ 'functionName': 'Image.constant',
741
+ 'arguments': {'value': {'constantValue': 2}},
742
+ }
743
+ },
744
+ ]
745
+ }
746
+ }
747
+ },
748
+ 'functionName': 'ImageCollection.fromImages',
749
+ })
750
+ expression = ee.ImageCollection.fromImages(images)
751
+ result = json.loads(expression.serialize())
752
+ self.assertEqual(expect, result)
753
+
754
+ expression = ee.ImageCollection.fromImages(images=images)
755
+ result = json.loads(expression.serialize())
756
+ self.assertEqual(expect, result)
726
757
 
727
758
  def test_geometry(self):
728
759
  max_error = 1.1