I am using the code from one of the example notebooks to get a time series by region with a feature collection, and I am getting an error when using some different datasets.
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/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 /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/ee/data.py:730, in computeValue(obj)
]()[721]()[ def computeValue(obj):
]()[722]()[ """Sends a request to compute a value.
]()[723]()[
]()[724]()[ Args:
(...)
]()[728]()[ The result of evaluating that object on the server.
]()[729]()[ """
--> ]()[730]()[ return _execute_cloud_call(
]()[731]()[ _get_cloud_api_resource().projects().value().compute(
]()[732]()[ body={'expression': serializer.encode(obj, for_cloud_api=True)},
]()[733]()[ project=_get_projects_path(),
]()[734]()[ prettyPrint=False))['result']
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/ee/data.py:332, in _execute_cloud_call(call, num_retries)
]()[330]()[ return call.execute(num_retries=num_retries)
]()[331]()[ except googleapiclient.errors.HttpError as e:
--> ]()[332]()[ raise _translate_cloud_exception(e)
EEException: Dictionary.set: Parameter 'value' is required.]()
I am using the code from one of the example notebooks to get a time series by region with a feature collection, and I am getting an error when using some different datasets.
The original code which works fine is:
test_site = ee.Geometry.Point([-71, -42]) test_feat = ee.Feature(test_site, {'name': 'test feature', 'buffer':0}) test_featcol = ee.FeatureCollection([ test_feat, test_feat.buffer(100).set('name', 'buffer 100', 'buffer', 100), test_feat.buffer(1000).set('name', 'buffer 1000', 'buffer', 1000) ]) col = ee.ImageCollection('COPERNICUS/S2').filterBounds(test_site) time_series = col.filterDate('2020-01-01', '2020-02-01')
chart_ts_region = ui.chart.Image.seriesByRegion(**{ 'imageCollection': time_series, 'reducer': ee.Reducer.median(), 'regions': test_featcol, 'scale': 10, 'band': 'B11', 'seriesProperty': 'name' })
Some other datasets work as well, such as the population count dataset. However, if I use the COPERNICUS/S5P/NRTI/L3_NO2 dataset, I get an error:
test_site = ee.Geometry.Point([-71, -42]) test_feat = ee.Feature(test_site, {'name': 'test feature', 'buffer':0}) test_featcol = ee.FeatureCollection([ test_feat, test_feat.buffer(100).set('name', 'buffer 100', 'buffer', 100), test_feat.buffer(1000).set('name', 'buffer 1000', 'buffer', 1000) ]) col = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2').filterBounds(test_site) time_series = col.filterDate('2020-01-01', '2020-02-01')
chart_ts_region = ui.chart.Image.seriesByRegion(**{ 'imageCollection': time_series, 'reducer': ee.Reducer.median(), 'regions': test_featcol, 'scale': 10, 'band': 'NO2_column_number_density', 'seriesProperty': 'name' })
Yields this traceback:
HttpError Traceback (most recent call last) File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/ee/data.py:330, in _execute_cloud_call(call, num_retries) [329]()[ try: --> ]()[330]()[ return call.execute(num_retries=num_retries) ]()[331]()[ except googleapiclient.errors.HttpError as e:
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/googleapiclient/_helpers.py:134, in positional..positional_decorator..positional_wrapper(*args, *kwargs)
]()[133]()[ logger.warning(message)
--> ]()[134]()[ return wrapped(args, **kwargs)
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/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/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Dictionary.set: Parameter 'value' is required.". Details: "Dictionary.set: Parameter 'value' is required.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last) /Users/andrewboomer/Desktop/GEE.ipynb Cell 10' in <cell line: 11>() ]()[8]()[ col = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2').filterBounds(test_site) ]()[9]()[ time_series = col.filterDate('2020-01-01', '2020-02-01') ---> ]()[11]()[ chart_ts_region = ui.chart.Image.seriesByRegion(**{ ]()[12]()[ 'imageCollection': time_series, ]()[13]()[ 'reducer': ee.Reducer.median(), ]()[14]()[ 'regions': test_featcol, ]()[15]()[ 'scale': 10, ]()[16]()[ 'band': 'NO2_column_number_density', ]()[17]()[ 'seriesProperty': 'name' ]()[18]()[ })
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/ipygee/chart.py:421, in Image.seriesByRegion(imageCollection, regions, reducer, band, scale, xProperty, seriesProperty) ]()[416]()[ return inicol.set(iid, fc_data) ]()[418]()[ data = ee.Dictionary( ]()[419]()[ imageCollection.iterate(over_col, ee.Dictionary({}))) --> ]()[421]()[ data = data.getInfo() ]()[423]()[ df = tools.imagecollection.data2pandas(data) ]()[424]()[ newdf = df.sort_values(xProperty)
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/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 /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/ee/data.py:730, in computeValue(obj) ]()[721]()[ def computeValue(obj): ]()[722]()[ """Sends a request to compute a value. ]()[723]()[ ]()[724]()[ Args: (...) ]()[728]()[ The result of evaluating that object on the server. ]()[729]()[ """ --> ]()[730]()[ return _execute_cloud_call( ]()[731]()[ _get_cloud_api_resource().projects().value().compute( ]()[732]()[ body={'expression': serializer.encode(obj, for_cloud_api=True)}, ]()[733]()[ project=_get_projects_path(), ]()[734]()[ prettyPrint=False))['result']
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/ee/data.py:332, in _execute_cloud_call(call, num_retries) ]()[330]()[ return call.execute(num_retries=num_retries) ]()[331]()[ except googleapiclient.errors.HttpError as e: --> ]()[332]()[ raise _translate_cloud_exception(e)
EEException: Dictionary.set: Parameter 'value' is required.]()
Thanks for the help!