# Why this linear to db function works only when given 2 polarization bands?

I am working only on `VV` polarization of Sentinel-1 Images. Wanted to use the function from other answer (Convert Sentinel-1 images data from dB to linear) but it doesn't seem to work when given only `VV`. Why is that? How do I make it work when having only 1 band? Please be aware that originally image has 3 bands, so I really don't understand that behaviour. Here's the test code:

``````var filter = ee.Filter.and(
ee.Filter.bounds(Map.getBounds(true)),
ee.Filter.date('2022-01-01', '2022-02-01')
)

var db = ee.ImageCollection('COPERNICUS/S1_GRD')
.filter(filter)
.mosaic()

var linear = ee.ImageCollection('COPERNICUS/S1_GRD_FLOAT')
.filter(filter)
.mosaic()

Map.addLayer(db, {bands: 'VV', min: -25, max: 0}, 'DB')
Map.addLayer(linear, {bands: 'VV', min: -25, max: 0}, 'LINEAR')
Map.addLayer(toDb1(linear), {bands: 'VV', min: -25, max: 0}, 'AFTER DB1') // THIS WORKS
Map.addLayer(toDb2(linear), {bands: 'VV', min: -25, max: 0}, 'AFTER DB2') // THIS DOES NOT

function toDb1(linear) {
ee.Image().expression('10 * log10(linear)', {
linear: linear.select(['VV', 'VH']) // VV and VH
}),
null, true // Replace the bands to keep image properties
)
}

function toDb2(linear) {
ee.Image().expression('10 * log10(linear)', {
linear: linear.select(['VV']) // only VV
}),
null, true // Replace the bands to keep image properties
)
}
``````

This is `expression()` behaving a bit inconsistent. In the multi-band case, your resulting bands are named after the input. When you have a single band, your result is `constant`. Manually rename the output and you're good.

``````  return linear.addBands(
ee.Image().expression('10 * log10(linear)', {
linear: linear.select(['VV'])
}).rename('VV'),
null, true // Replace the bands to keep image properties
)
``````