geetools
geetools copied to clipboard
Issue running cloud masking on Sentinel Collection
Hi! Whenever I try to run the ESA cloud masking on a sentinel collection I get the error: "object of type 'Image' has no len()"
my code is as follows:
`imagecol = ee.ImageCollection("COPERNICUS/S2_SR").filterDate('2019-02-21', '2019-03-23').filterBounds(riv);
def s2cloud(imagecol): return imagecol.updateMask(cloud_mask.sentinel2(imagecol))
imagecol2 = imagecol.map(s2cloud); `
I really appreciate any help- thanks for this awesome toolbox!
Hello @WHBSpeiser ,
Try this:
imagecol = ee.ImageCollection("COPERNICUS/S2_SR").filterDate('2019-02-21', '2019-03-23').filterBounds(riv)
imagecol_masked = imagecol.map(cloud_mask.sentinel2())
and let me know =)
It looks like it works when I make the date range so that there is only one image in the collection! However, when I make the range any larger I get an "internal error" when trying to batch export the collection... weird!
Similar issue here, I tried that solution without success as @WHBSpeiser. I also tried to map applyHollstein as shown below. An EEException is raised.
s2_aoi = (ee.ImageCollection('COPERNICUS/S2_SR')\
.filterDate(start_date_str, end_date_str)\
.filterBounds(aoi)\
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
)
s2_date_mosaic = tools.imagecollection.mosaicSameDay(s2_aoi)
# So far so good ! ! !
s2_masked = s2_date_mosaic.map(cloud_mask.applyHollstein)
s2_masked.getInfo()
# Whatever I do on the masked ImageCollection returns
EEException: Error in map(ID=9):
Image.select: Pattern 'B10' did not match any bands
Any clue how to get this done?
Btw...thank you for these tools @fitoprincipe!
This error is quite old now and we are relying on ee_extra for cloud masking from now on. If the problem persists let me know and open a new issue.