I am trying to reduce the percentage of crops from the CGLS-100 Landcover dataset for a set of points uploaded as asset from a shapefile. This is an operation that I've done tens of times, but for some reason in this particular instance reduceRegions
doesn't return any value from the image - only the fields from the original shapefile. I need someone to check my sanity:
# Load landcover
LC = ee.ImageCollection("COPERNICUS/Landcover/100m/Proba-V-C3/Global")\
.filterDate('2015-01-01', '2015-12-31').first().select(['crops-coverfraction'])
# Load POIs
POI = ee.FeatureCollection('users/sebastienbiasse/barangays')
# Produce buffer around POIs
POI = POI.select(['NAME_1', 'NAME_2', 'NAME_3']).map(lambda feat: ee.Feature(feat).buffer(1000))
# Reduce
col = LC.reduceRegions(collection=POI, reducer=ee.Reducer.mean(), scale=100)
# Remove geometry
col = col.map(lambda feat: feat.setGeometry())
# Request GEE to perform its magics
ee.batch.Export.table.toDrive(collection=col, description=f'LC_crops8', folder='CALDERA', fileFormat="CSV").start()
No error is returned, but the output csv file contains only the fields system:index
, NAME_1
, NAME_2
, NAME_3
, and .geo
. I expect a field called crops-coverfraction
as requested. Other SO answers to similar problems suggest that one source of error could be the size of the featureCollection and mine happens to be rather large (84k points). I get the same problem when using this instead:
ee.batch.Export.table.toDrive(collection=col.limit(1000), description=f'LC_crops8', folder='CALDERA', fileFormat="CSV").start()
Can anyone spot an error?
The bizarre thing is that I reduce another image ~10 lines above this and it works perfectly.
Export.table.toDrive
.Export.table.toDrive
, I've tried specifying this inimage.reduceRegions
but to no change, and from my experience it natively exports all bands in the image.