Replymessage unavailable
// Define the Area of Interest (AOI)
// Replace with your own geometry or draw one in the GEE interface
var aoi = table;
// Define the time period
var startDate = '2024-01-01';
var endDate = '2024-12-31';
// Load the Sentinel-1 GRD collection
var s1Collection = ee.ImageCollection('COPERNICUS/S1_GRD')
.filterBounds(aoi)
.filterDate(startDate, endDate)
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
.filter(ee.Filter.eq('instrumentMode', 'IW'));
// Function to convert from dB to linear
function toLinear(image) {
return image.expression('pow(10, db/10)', {'db': image});
}
// Function to calculate RFDI
function calculateRfdi(image) {
var vv = image. select('VV');
var vh = image. select('VH');
// Convert to linear scale
var vvLinear = toLinear(vv);
var vhLinear = toLinear(vh);
// Calculate RFDI
var rfdi = (vvLinear.subtract(vhLinear)).divide(vvLinear.add(vhLinear)).rename('RFDI');
return image. addBands(rfdi);
}
// Apply the RFDI calculation to the collection
var rfdiCollection = s1Collection. map(calculateRfdi);
// Create a median composite
var rfdiMedian = rfdiCollection.select('RFDI').median();
// Define visualization parameters for RFDI
var rfdiVisParams = {
min: -1,
max: 1,
palette: ['#d7191c', '#fdae61', '#ffffbf', '#abdda4', '#2b83ba'] // Red to Blue palette
};
// Center the map and add the RFDI layer
Map. centerObject(aoi, 13);
Map.addLayer(rfdiMedian.clip(aoi), rfdiVisParams, 'RFDI');
// Optional: Display the median VV and VH backscatter in dB for comparison
var vvMedian = s1Collection.select('VV').median();
var vhMedian = s1Collection.select('VH').median();
var s1VisParams = {min: -25, max: 0};
Map.addLayer(vvMedian.clip(aoi), s1VisParams, 'VV Median (dB)');
Map.addLayer(vhMedian.clip(aoi), s1VisParams, 'VH Median (dB)');
Try this code, but I'm not sure.