leftfield-geospatial / geedim

Search, composite, and download Google Earth Engine imagery.
https://geedim.readthedocs.io
Apache License 2.0
80 stars 11 forks source link

module 'geedim' has no attribute 'download' #3

Closed kgju closed 2 years ago

kgju commented 2 years ago

I was Successfully installed geedim-0.1.4, but This error occurs when I use geemap to download images

giswqs commented 2 years ago

Could you provide code that can reproduce the issue?

kgju commented 2 years ago

The code I use is only the sample code provided in geemap.

import os import ee import geemap

Map = geemap.Map() Map

image = ee.ImageCollection("LANDSAT/LC08/C02/T1_TOA").first() Map.addLayer(image, {}, 'Landsat') Map.centerObject(image)

geemap.download_ee_image(image, "landsat.tif", scale=100)

giswqs commented 2 years ago

@kgju Your geedim package is probably outdate. Try updating the geedim package using pip install -U geedim.

@dugalh I am using Python 3.10 and geedim v1.3.0. I keep running into the kernel dying error using the sample code @kgju provided above. It works before. No sure why it no longer works.

image

kgju commented 2 years ago

Referring to your GitHub tutorial, I created a new virtual environment to install geemap and geedim, which shows that the installation has been successful. But when i import geedim or using download code,I encountered the following errors: AttributeError: partially initialized module 'rasterio' has no attribute '_loading'

dugalh commented 2 years ago

@kgju I haven't been able to replicate your problem - the geemap example is working for me. Can you try downloading the example image with the latest version of geedim (v1.3.1) directly?

On the command line:

geedim download -i LANDSAT/LC08/C02/T1_TOA/LC08_001004_20140609 --scale 100 -o

Or via the API:

import geedim as gd
gd.Initialize()
gd_image = gd.MaskedImage.from_id('LANDSAT/LC08/C02/T1_TOA/LC08_001004_20140609')
gd_image.download('landsat.tif', scale=100, overwrite=True)
dugalh commented 2 years ago

@giswqs There is a problem with concurrent calls to ee.Image.getDownloadURL causing a segmentation fault, somewhere in the python networking libraries. Initially, I only saw this under python 3.10, but when I initialise Earth Engine as you do in geemap i.e. ee.Initialize(http_transport=httplib2.Http()), I found the same problem under other python versions. It should be resolved with a thread lock around ee.Image.getDownloadURL in the latest release v1.3.1.

See the tests here: download integration

giswqs commented 2 years ago

@dugalh Many thanks for looking into this. I can confirm that it is now working properly. One thing I noticed is that sometimes the progress bar is in red color even though the image has been downloaded successfully.

image

dugalh commented 2 years ago

@giswqs Sure. OK, great. I think the red bar is a feature of tqdm, to indicate it has completed. Red for stopped I guess.

giswqs commented 2 years ago

Yeah, I guess it is not a geedim issue. When downloading multiple images, sometimes in green, sometime in red. Users might be confused. However, it seems all images are downloaded successfully. The color does not really matter.

https://geemap.org/notebooks/118_download_image/

image

dugalh commented 2 years ago

I'll look into it. Possibly the tqdm progress is not quite getting to 100% on the bars that stay green.

dugalh commented 2 years ago

@giswqs The red bars are not quite getting to 100%. Which makes sense in hindsight. I'll fix it in the next release.

giswqs commented 2 years ago

@dugalh v1.3.2 has resolved the issue. Nice to see the beautiful green bars! Thank you for fixing it.

image

dugalh commented 2 years ago

:)