I am getting error Image.gt: If one image has no bands, the other must also have no bands. Got 0 and 1.:
var imageCollection = ee.ImageCollection("LANDSAT/LC08/C02/T2_L2"),
geometry =
/* color: #0b4a8b */
/* displayProperties: [
{
"type": "rectangle"
}
] */
ee.Geometry.Polygon(
[[[44.5346944926502, 38.37189110732085],
[44.5346944926502, 36.97192200651999],
[46.2925069926502, 36.97192200651999],
[46.2925069926502, 38.37189110732085]]], null, false);
var coordinates = [
[42.000552219688586, 38.18969302118053],
[43.868228000938586, 38.18969302118053],
[43.868228000938586, 39.209978258633186],
[42.000552219688586, 39.209978258633186],
[42.000552219688586, 38.18969302118053]
];
var roi = ee.Geometry.Polygon(coordinates);
Map.addLayer(roi)
var time_start = '2013', time_end = '2021'
var landsat = imageCollection
.filterDate(time_start, time_end)
.filter(ee.Filter.lt('CLOUD_COVER', 10))
.filter(ee.Filter.calendarRange(6,9,'month'))
.filterBounds(geometry).map(function(img){
var bands = img.select('SR_.*').multiply(2.75e-05).add(-0.2);
var ndwi = bands.normalizedDifference(['SR_B3','SR_B5']).rename('ndwi');
return ndwi
.copyProperties(img, img.propertyNames())
}).median();
Map.addLayer(landsat.clip(geometry), [], 'ndwi_summer', false);
Map.addLayer(landsat.clip(geometry).gt(0), [], 'ndwi_thr', false);
var thr = landsat.gt(0.1);
var mask = thr.updateMask(thr);
Map.addLayer(mask, [], 'ndwi_masked', false);
var pixel_area = mask.multiply(ee.Image.pixelArea().divide(1e6));
Map.addLayer(pixel_area.clip(geometry), [], 'ndwi_pixel_area', false);
var lake_area = pixel_area.reduceRegion({
reducer: ee.Reducer.sum(), geometry: geometry, scale: 100
}).values().get(0);
print(ee.Number(lake_area))