I have prepared the code for flood mapping risk. But when I am using the below code, the error show dem is not a function. Can anyone help me.
Thanks in advance.
// Import a satellite image of the Houston area
var image = ee.Image('COPERNICUS/S2_SR/20221225T101057_20221225T132927_T32UMA')
.clip(roi);
// Extract the elevation data from the image
var elevation = image.select('elevation');
// Create a digital elevation model (DEM) from the elevation data
var dem = ee.Terrain.hillshade(elevation);
// Calculate the flood risk for each pixel in the image
var floodRisk = dem.expression(
'exp(-((x - mean)^2) / (2 * sigma^2))', {
'x': dem,
'mean': dem.mean(),
'sigma': dem.stdDev()
}
);