I am trying to create at-sensor albedo for image collection of Landsat 8 for the year 2021. I created a function for that with applying ee.Algorithms.Landsat.TOA. But the error occurs:
TOA: Layer error: ImageCollection.mosaic: Error in map: Landsat.TOA: Band 'B1' is Type Float, expected Type<Integer<0, 65535>>.
function addtoa(image) {
var toa = ee.Algorithms.Landsat.TOA(image);
return image.addBands(toa);
}
var filtered = filtered.map(addtoa);
Map.addLayer(filtered, {}, 'TOA');
I am using LANDSAT/LC08/C02/T1_TOA collection.
Best Answer
This occurs because you are using the wrong dataset. It must be LANDSAT/LC08/C02/T1 instead LANDSAT/LC08/C02/T1_TOA collection.
Documentation for
ee.Algorithms.Landsat.TOA(input)
says:So, if you try:
you will get the following result: