Question: Why won't image reduce region accept either a scale or a reprojection, in most of my cases but not all.
Context: I'm trying to find if a landsat pixel has any cloud (based on SimpleCloudScore) and then if no cloud I will extract the other bands to csv, I know this is intensive and slow but will only be done for a few select pixels. The errors may be something to do with the region being a point but it has worked for some of the points.
def arethereclouds(image):
image_cloud = image.select('cloud')
total_cloud = image_cloud.reduceRegion(**{
'reducer': ee.Reducer.sum(),
'geometry': eefeature_point,
'maxPixels': 100000,
'scale': 30,
})
im = ee.Algorithms.If(ee.Number(total_cloud.get('cloud')).gt(1), ee.Image.constant(-999).rename('extraction_band'), image)
return im
I started with the error "EEException: Image.reduceRegions: The default WGS84 projection is invalid for aggregations. Specify a scale or crs & crs_transform." for some, not all of the features I've tried
So I added
'crs': 'EPSG:3857' ,
'crsTransform':[1,0,0,0,1,0]
to the reducer, resulting in the error "EEException: ImageCollection.toBands: Error in map(ID=LC08_186029_20130505): Image.reduceRegion: Cannot specify both crsTransform and scale."
But when I remove scale from the reducer, we go the full circle back to the original EEexception?
Efforts to fix it I've tried:
- adding a buffer to the feature to see if it was some issue there
- different EPSGs
- different scales