-
Dear Dr. Wu, I got some error when calling the extract_pixel_values. Is it a bug in my use or a bug in the package? lat = 19.526390
lon = 109.468799
years = 2018
yeare = 2021
bound = ee.Geometry.Point(lon,lat)
def getNDVI(image):
return image.normalizedDifference(['sur_refl_b02','sur_refl_b01']).toFloat().rename('NDVI').copyProperties(image)
mod09q1 = ee.ImageCollection("MODIS/006/MOD09Q1").filterBounds(bound).filterDate(str(years)+'-01-01',str(yeare)+'-12-31')
imgs = mod09q1.map(getNDVI)
img_ndvi = imgs.select('NDVI').toBands()
pts = geemap.extract_pixel_values(ee_object=img_ndvi,region=bound,scale=250,getInfo=True)
pts Here is the error messageHttpError Traceback (most recent call last) ~\Anaconda3\envs\pheno\lib\site-packages\googleapiclient_helpers.py in positional_wrapper(*args, **kwargs) ~\Anaconda3\envs\pheno\lib\site-packages\googleapiclient\http.py in execute(self, http, num_retries) HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Element.toDictionary: Parameter 'element' is required.". Details: "Element.toDictionary: Parameter 'element' is required."> During handling of the above exception, another exception occurred: EEException Traceback (most recent call last) ~\Anaconda3\envs\pheno\lib\site-packages\geemap\common.py in extract_pixel_values(ee_object, region, scale, projection, tileScale, getInfo) ~\Anaconda3\envs\pheno\lib\site-packages\ee\computedobject.py in getInfo(self) ~\Anaconda3\envs\pheno\lib\site-packages\ee\data.py in computeValue(obj) ~\Anaconda3\envs\pheno\lib\site-packages\ee\data.py in _execute_cloud_call(call, num_retries) EEException: Element.toDictionary: Parameter 'element' is required. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It is because the image has nodata. You need to use the |
Beta Was this translation helpful? Give feedback.
It is because the image has nodata. You need to use the
.unmask()
to set the nodata to zero or other values.