Closed 12rambau closed 3 years ago
I have tested the code with the trajectory option set to 'ndvi_trend'
. You can work on the assembly of the app now.
I tested the tile with the following parameters :
Spoiler alert : it didn't run to the end
I corrected some typos in function calls here, here and here
It was still not running
---------------------------------------------------------------------------
HttpError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries)
337 try:
--> 338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
/usr/local/lib/python3.6/dist-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
/usr/local/lib/python3.6/dist-packages/googleapiclient/http.py in 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 "Image.where: Incompatible number of bands in conditional image: 4.". Details: "Image.where: Incompatible number of bands in conditional image: 4.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
~/sdg_indicators_module/indicators/15-3/15-3-1/widgets/tile_15_3_1.py in start_process(self, widget, data, event)
310 statistics_type = "PERCENTAGE",
311 decimal_places=2,
--> 312 tile_scale=1.0)
313
314
~/.local/lib/python3.6/site-packages/geemap/common.py in zonal_statistics_by_group(in_value_raster, in_zone_vector, out_file_path, statistics_type, decimal_places, denominator, scale, crs, tile_scale)
4970 return
4971
-> 4972 band_count = in_value_raster.bandNames().size().getInfo()
4973
4974 band_name = ''
/usr/local/lib/python3.6/dist-packages/ee/computedobject.py in getInfo(self)
93 The object can evaluate to anything.
94 """
---> 95 return data.computeValue(self)
96
97 def encode(self, encoder):
/usr/local/lib/python3.6/dist-packages/ee/data.py in computeValue(obj)
680 body={'expression': serializer.encode(obj, for_cloud_api=True)},
681 project=_get_projects_path(),
--> 682 prettyPrint=False))['result']
683
684
/usr/local/lib/python3.6/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries)
338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
--> 340 raise _translate_cloud_exception(e)
341
342
EEException: Image.where: Incompatible number of bands in conditional image: 4.
this error was launch by the geemap.zonal_statistics_by_group
.
You should investigate that.
I muted it to see if i can get any image to display for tomorrow and I run into this one :
---------------------------------------------------------------------------
HttpError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries)
337 try:
--> 338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
/usr/local/lib/python3.6/dist-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
/usr/local/lib/python3.6/dist-packages/googleapiclient/http.py in 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/maps?fields=name&alt=json returned "Image.visualize: Cannot provide a palette when visualizing more than one band.". Details: "Image.visualize: Cannot provide a palette when visualizing more than one band.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
~/sdg_indicators_module/indicators/15-3/15-3-1/widgets/tile_15_3_1.py in start_process(self, widget, data, event)
318 # add the layers
319 m.addLayer(productivity, pm.viz, 'productivity')
--> 320 m.addLayer(land_cover, pm.viz, 'land_cover')
321 m.addLayer(soc, pm.viz, 'soil_organic_carbon')
322 m.addLayer(indicator_15_3_1, pm.viz, 'indicator_15_3_1')
~/.local/lib/python3.6/site-packages/geemap/geemap.py in add_ee_layer(self, ee_object, vis_params, name, shown, opacity)
1060 image = ee_object.mosaic()
1061
-> 1062 map_id_dict = ee.Image(image).getMapId(vis_params)
1063 tile_layer = ipyleaflet.TileLayer(
1064 url=map_id_dict["tile_fetcher"].url_format,
/usr/local/lib/python3.6/dist-packages/ee/image.py in getMapId(self, vis_params)
129 vis_image, request = self._apply_visualization(vis_params)
130 request['image'] = vis_image
--> 131 response = data.getMapId(request)
132 response['image'] = self
133 return response
/usr/local/lib/python3.6/dist-packages/ee/data.py in getMapId(params)
579 result = _execute_cloud_call(
580 _get_cloud_api_resource().projects().maps().create(
--> 581 parent=_get_projects_path(), fields='name', body=request))
582 map_name = result['name']
583 url_format = '%s/%s/%s/tiles/{z}/{x}/{y}' % (
/usr/local/lib/python3.6/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries)
338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
--> 340 raise _translate_cloud_exception(e)
341
342
EEException: Image.visualize: Cannot provide a palette when visualizing more than one band.
Which means that when you closed #10 you didn't think about the viz parameters that you provided, you simply copy/pasted the one that was already coded. I'm thus forced to reopen it
Conclusion
When you decided to close this issue how did you test your code ? with which parameters ? where ? My work is to provide interface and sepal support on top of a working GEE code, at the moment, it's not so I'm reopening this issue
I completely aggre with the conclusion. I tried to test the code inside SEPAL, but it is throwing the following error
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
Therefore, I tried to test in this notebook.
There was a problem with the output from land_cover
function as It retuns a multiband image. I have revised the code accordingly.
Please guide me on how to test the code properly to avoid such issues in future!
ok so if we're not working in the same env, we'll never gonna make it ;-).
Do you have a Sepal account ? if yes do you manage to open jupyterlab or jupyter notebook in the app dashboard ? if yes is the error you're talking about appear when you're running the tile notebook ?
The advantage of using github is to share code, so if you're not using the interface I'm working on I cannot understand why it's never working on my side.
I tested everything, soc
, land_cover
and indicator_15_3_1
are entirely 0 value ee.Image
It should not be the case
I wanted to start finishing the assembly of the app and create everything that is required for downloading and display of the histogram but it's impossible to launch the app.
Last time I spend several hours to make it work, I don't have this amount of time this week.
If you need to change the test area you can use any asset you have on your drive and replace the
users/bornToBeAlive/aoi_corsica
that is in the first cell of this file.Please make the necessary adjustments to your code so that something else than errors are displayed when I click the run button.
I'll code what's required to finish it when this issue will be closed. Note that if you have any question during the refactoring process, I'll be happy to answer them.