You can covert an S1 image in db to linear with this:
ee.Image().expression('pow(10, db / 10)', {
db: db.select(['VV', 'VH'])
})
However, there are two image collections with S1 imagery, and one of them (COPERNICUS/S1_GRD_FLOAT
) already comes in linear. Here's a complete example showing conversion back and forth from db to linear:
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,VH,VV', min: -25, max: 0})
Map.addLayer(toDb(linear), {bands: 'VV,VH,VV', min: -25, max: 0})
Map.addLayer(toDb(toLinear(db)), {bands: 'VV,VH,VV', min: -25, max: 0})
function toLinear(db) {
return db.addBands(
ee.Image().expression('pow(10, db / 10)', {
db: db.select(['VV', 'VH'])
}),
null, true // Replace the bands to keep image properties
)
}
function toDb(linear) {
return linear.addBands(
ee.Image().expression('10 * log10(linear)', {
linear: linear.select(['VV', 'VH'])
}),
null, true // Replace the bands to keep image properties
)
}
https://code.earthengine.google.com/a57f1bef88f429abe73529844d219ae8