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) {
return linear.addBands(
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) {
return linear.addBands(
ee.Image().expression('10 * log10(linear)', {
linear: linear.select(['VV']) // only VV
}),
null, true // Replace the bands to keep image properties
)
}
Link to the code: https://code.earthengine.google.com/f3656ddfd179f7559c7425e96e913faf