I have an image collection of 4 images and when I map a function to this it only picks up on two images.
I've created a simple version of the problem to hopefully make this more solvable.
# data to Filter IC
geom_meta_list = ee.List([7040632150, 7040707710, 7040632220])
WWF = ee.FeatureCollection("WWF/HydroSHEDS/v1/Basins/hybas_4").filter(ee.Filter.inList('HYBAS_ID',geom_meta_list))
geometry = WWF.geometry()
date_start = '2014-08-01'
date_end = '2014-08-30'
#Load IC
ls = TOA = ee.ImageCollection("LANDSAT/LC08/C01/T1").filterDate(date_start,date_end).filterBounds(geometry)
#check how many images
# ls.size().getInfo() # returns 4
#simple function
def test_func(image):
print('one')
#ERRORS are here:
ls.map(test_func) # one one (as opposed to one one one one)
# ls.map(lambda x:test_func(x)) # tried to see if this would make any difference but no luck
#proves there are 4 seperate images
list_images = ls.toList(4)
for i in range(0,4):
image = ee.Image(list_images.get(i))
image_ID = image.get('LANDSAT_PRODUCT_ID')
print(image_ID.getInfo())
When it comes to changing IC's to bands it responds with EEException: ImageCollection.toBands: Error in map(ID=LC08_038035_20171229): Image.select: Invalid band number (1) specified to select. Input only contains 0 bands.
Suggesting its missing these images from the IC after the map function occurred. I have some very similar code that runs with no issues. Is it something to do with how it uses scenes causing this issue?
I'm using the Python API on Jupyter.