I'm trying to get annual composites VIIRS-DNB from 2012 to 2021 for Ukraine and export these images
# define our start and end years
start = 2012
end = 2021
years = ee.List.sequence(start, end)
colID = "NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG"
def viirs_annual_median_reduce(year):
return ee.ImageCollection(colID).filter(
ee.Filter.calendarRange(year,year,"year")).select("avg_rad").median().set('year',year)
# map function to each year in our list
yearComps = ee.ImageCollection.fromImages(years.map(viirs_annual_median_reduce))
# get boundaries for Ukraine
aoi_UA = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level0').filter(ee.Filter.eq('ADM0_CODE', 254))
# clipping image to only include nightlight data for Ukraine
viirs_UA = yearComps.map(lambda x: x.clip(aoi_UA))
I don't know how to export ImageCollection so I'm exporting one image at a time
img1 = viirs_UA.filterMetadata("year","equals",2012).first()
task = ee.batch.Export.image.toDrive(image=img1,
fileFormat='GeoTIFF',
description='Ukraine_VIIRS_2012',
scale=30,
folder='tmp',
maxPixels=1e9)
task.start()
When I run task.status()
I get this error 'error_message': 'Image.clipToBoundsAndScale: The image must have at least one band.'
What am i doing wrong?