import os import ee import geemap ee.Authenticate() ee.Initialize(project='project') out_dir = os.path.expanduser("C:/Users/15302/Pythonwork") roi = ee.FeatureCollection('projects/assets/openetExtentYolo') # Import NDVI collection dataset = (ee.ImageCollection('MODIS/061/MOD13A1').select('NDVI') .filterBounds(roi) .filterDate('2000-02-01','2024-09-30')) # define a python fn to clip image collection to roi def clipfn(image): return image.clip(roi) # and apply it datasetclip = dataset.map(clipfn) # reprojection parameters def imreproj(image): return image.reproject(crs='EPSG:4326', scale=500) # apply to the NDVI data datareproj = datasetclip.map(imreproj) # download geemap.download_ee_image_collection(datareproj,out_dir) import os import ee import geemap ee.Authenticate() ee.Initialize(project='project') out_dir = os.path.expanduser("C:/Users/15302/Pythonwork") roi = ee.FeatureCollection('projects/assets/openetExtentYolo') # Import NDVI collection dataset = (ee.ImageCollection('MODIS/061/MOD13A1').select('NDVI') .filterBounds(roi) .filterDate('2000-02-01','2024-09-30')) # define a python fn to clip image collection to roi def clipfn(image): return image.clip(roi) # and apply it datasetclip = dataset.map(clipfn) # reprojection parameters def imreproj(image): return image.reproject(crs='EPSG:4326', scale=500) # apply to the NDVI data datareproj = datasetclip.map(imreproj) # download geemap.download_ee_image_collection(datareproj,out_dir) import os import ee import geemap ee.Authenticate() ee.Initialize(project='project') out_dir = os.path.expanduser("C:/Users/15302/Pythonwork") roi = ee.FeatureCollection('projects/assets/openetExtentYolo') # Import NDVI collection dataset = (ee.ImageCollection('MODIS/061/MOD13A1').select('NDVI') .filterBounds(roi) .filterDate('2000-02-01','2024-09-30')) # define a python fn to clip image collection to roi def clipfn(image): return image.clip(roi) # and apply it datasetclip = dataset.map(clipfn) # reprojection parameters def imreproj(image): return image.reproject(crs='EPSG:4326', scale=500) # apply to the NDVI data datareproj = datasetclip.map(imreproj) # download geemap.download_ee_image_collection(datareproj,out_dir) Error downloading GEE image collection: "Exception: This image is unbounded"
I'm trying to download MODIS NDVI collection using geemap. The exact same code worked when downloading a different image collection (OpenET collection). I can't figure out why it's not working with the MODIS collection.
Here's the code:
import os import ee import geemap ee.Authenticate() ee.Initialize(project='project') out_dir = os.path.expanduser("C:/Users/15302/Pythonwork") roi = ee.FeatureCollection('projects/assets/openetExtentYolo') # Import NDVI collection dataset = (ee.ImageCollection('MODIS/061/MOD13A1').select('NDVI') .filterBounds(roi) .filterDate('2000-02-01','2024-09-30')) # define a python fn to clip image collection to roi def clipfn(image): return image.clip(roi) # and apply it datasetclip = dataset.map(clipfn) # reprojection parameters def imreproj(image): return image.reproject(crs='EPSG:4326', scale=500) # apply to the NDVI data datareproj = datasetclip.map(imreproj) # download geemap.download_ee_image_collection(datareproj,out_dir) I get the following error:
Downloading 1/567: 2000_02_18.tif --------------------------------------------------------------------------- ValueError Traceback (most recent call last) File ~\anaconda3\envs\gee\Lib\site-packages\geemap\common.py:12790, in download_ee_image_collection(collection, out_dir, filenames, region, crs, crs_transform, scale, resampling, dtype, overwrite, num_threads, max_tile_size, max_tile_dim, shape, scale_offset, unmask_value, **kwargs) 12789 print(f"Downloading {i + 1}/{count}: {name}") > 12790 download_ee_image( 12791 image, 12792 filename, 12793 region, 12794 crs, 12795 crs_transform, 12796 scale, 12797 resampling, 12798 dtype, 12799 overwrite, 12800 num_threads, 12801 max_tile_size, 12802 max_tile_dim, 12803 shape, 12804 scale_offset, 12805 unmask_value, 12806 **kwargs, 12807 ) 12809 except Exception as e: File ~\anaconda3\envs\gee\Lib\site-packages\geemap\common.py:12472, in download_ee_image(image, filename, region, crs, crs_transform, scale, resampling, dtype, overwrite, num_threads, max_tile_size, max_tile_dim, shape, scale_offset, unmask_value, **kwargs) 12471 img = gd.download.BaseImage(image) > 12472 img.download(filename, overwrite=overwrite, num_threads=num_threads, **kwargs) File ~\anaconda3\envs\gee\Lib\site-packages\geedim\download.py:921, in BaseImage.download(self, filename, overwrite, num_threads, max_tile_size, max_tile_dim, **kwargs) 920 # prepare (resample, convert, reproject) the image for download --> 921 exp_image, profile = self._prepare_for_download(**kwargs) 923 # get the dimensions of an image tile that will satisfy GEE download limits File ~\anaconda3\envs\gee\Lib\site-packages\geedim\download.py:559, in BaseImage._prepare_for_download(self, set_nodata, **kwargs) 558 # resample, convert, clip and reproject image according to download params --> 559 exp_image = self._prepare_for_export(**kwargs) 560 # see float nodata workaround note in Tile.download(...) File ~\anaconda3\envs\gee\Lib\site-packages\geedim\download.py:497, in BaseImage._prepare_for_export(self, crs, crs_transform, shape, region, scale, resampling, dtype, scale_offset, bands) 496 if (not region and (not crs_transform or not shape)) and (not self.bounded): --> 497 raise ValueError(f'This image is unbounded, you need to specify a region; or a crs_transform and shape.') 499 if scale and shape: ValueError: This image is unbounded, you need to specify a region; or a crs_transform and shape. During handling of the above exception, another exception occurred: Exception Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_15728\624755762.py in ?() ----> 1 geemap.download_ee_image_collection(datasetclip, out_dir,crs="EPSG:32611",scale=500) ~\anaconda3\envs\gee\Lib\site-packages\geemap\common.py in ?(collection, out_dir, filenames, region, crs, crs_transform, scale, resampling, dtype, overwrite, num_threads, max_tile_size, max_tile_dim, shape, scale_offset, unmask_value, **kwargs) 12806 **kwargs, 12807 ) 12808 12809 except Exception as e: > 12810 raise Exception(f"Error downloading image collection: {e}") Exception: Error downloading image collection: This image is unbounded, you need to specify a region; or a crs_transform and shape lang-js