-
-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I am using eemont
to preprocess a series of Sentinel-2 L2A images. Unfortunately, it cannot preprocess certain images as follows.
To Reproduce
import ee, eemont
ee.Initialize()
image = ee.Image("COPERNICUS/S2_SR/20220429T070619_20220429T071819_T39SYC")
image = image.preprocess()
prompts the following errors:
---------------------------------------------------------------------------
HttpError Traceback (most recent call last)
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/ee/data.py:328, in _execute_cloud_call(call, num_retries)
327 try:
--> 328 return call.execute(num_retries=num_retries)
329 except googleapiclient.errors.HttpError as e:
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/googleapiclient/_helpers.py:134, in positional.<locals>.positional_decorator.<locals>.positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/googleapiclient/http.py:915, in HttpRequest.execute(self, http, num_retries)
914 if resp.status >= 300:
--> 915 raise HttpError(resp, content, uri=self.uri)
916 return self.postproc(resp, content)
HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/fluent-imprint-343810/value:compute?prettyPrint=false&alt=json returned "Image.select: Parameter 'input' is required.". Details: "Image.select: Parameter 'input' is required.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
Input In [15], in <cell line: 2>()
1 image = ee.Image("COPERNICUS/S2_SR/20220429T070619_20220429T071819_T39SYC")
----> 2 image = image.preprocess()
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/eemont/image.py:1235, in preprocess(self, **kwargs)
1200 @extend(ee.image.Image)
1201 def preprocess(self, **kwargs):
1202 """Pre-processes the image: masks clouds and shadows, and scales and offsets the image.
1203
1204 Tip
(...)
1233 >>> S2 = ee.ImageCollection('COPERNICUS/S2_SR').first().preprocess()
1234 """
-> 1235 return ee_extra.QA.pipelines.preprocess(self, **kwargs)
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/ee_extra/QA/pipelines.py:38, in preprocess(x, **kwargs)
35 kwargs[key] = value
37 x = maskClouds(x, **kwargs)
---> 38 x = scaleAndOffset(x)
40 return x
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/ee_extra/STAC/core.py:116, in scaleAndOffset(x)
98 def scaleAndOffset(
99 x: Union[ee.Image, ee.ImageCollection]
100 ) -> Union[ee.Image, ee.ImageCollection]:
101 """Scales and offsets bands on an Image or Image Collection.
102
103 Args:
(...)
114 >>> scaleAndOffset(S2)
115 """
--> 116 scaleParams = getScaleParams(x)
117 offsetParams = getOffsetParams(x)
119 if scaleParams is None or offsetParams is None:
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/ee_extra/STAC/core.py:60, in getScaleParams(x)
44 def getScaleParams(x: Union[ee.Image, ee.ImageCollection]) -> dict:
45 """Gets the scale parameters for each band of the image or image collection.
46
47 Args:
(...)
58 >>> getScaleParams(S2)
59 """
---> 60 platformDict = _get_platform_STAC(x)
61 eeDict = _load_JSON("ee-catalog-scale.json")
62 platforms = list(eeDict.keys())
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/ee_extra/STAC/utils.py:25, in _get_platform_STAC(args)
22 eeDict = _load_JSON()
23 platforms = list(eeDict.keys())
---> 25 ID = args.get("system:id").getInfo()
27 plt = None
29 for platform in platforms:
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/ee/computedobject.py:98, in ComputedObject.getInfo(self)
92 def getInfo(self):
93 """Fetch and return information about this object.
94
95 Returns:
96 The object can evaluate to anything.
97 """
---> 98 return data.computeValue(self)
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/ee/data.py:738, in computeValue(obj)
735 if workload_tag:
736 body['workloadTag'] = workload_tag
--> 738 return _execute_cloud_call(
739 _get_cloud_api_resource().projects().value().compute(
740 body=body,
741 project=_get_projects_path(),
742 prettyPrint=False))['result']
File /exports/csce/datastore/geos/users/s1855106/miniconda/base/envs/gee/lib/python3.8/site-packages/ee/data.py:330, in _execute_cloud_call(call, num_retries)
328 return call.execute(num_retries=num_retries)
329 except googleapiclient.errors.HttpError as e:
--> 330 raise _translate_cloud_exception(e)
EEException: Image.select: Parameter 'input' is required.
Setup (please complete the following information):
- OS: Ubuntu 20.04.4 LTS
- python version: 3.8.13
- eemont version: 0.3.5
- earthengine-api version: 0.1.318
Additional context
I did some check and found that "system:id" disappears following maskClouds()
that subsequently leads to the error of scaleAndOffset()
. But I have no idea on how to fix the problem. I'd be grateful if you could help!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working