Calculate the height – volume curve of a newly constructed dam
1. Copy the template into a new script and fill in the author details, date and contact information.
2. Import the SRTM Digital Elevation Data 30m.
The Ban Ve dam in Nghe An was constructed in 2009. The SRTM data is from 2000, so the Bathemetry is represented in the DEM. The location of Ban Ve is 19.3363 104.4841.
3. Draw a polygon around the Ban Ve dam, as shown in the image below.
3. Draw a polygon around the Ban Ve dam, as shown in the image below.
4. We create a list with values from 155 to 220 meter.
// set list with water levels var waterlevel = ee.List.sequence(155,220,1);
5. Clip the polygon from the DEM.
// clip ban ve area var dem = srtm.clip(BanVe);
6. Copy paste the function below to calculate the volume for each water level.
var calcVolume = function(level,list){
// calculate area inundated
var inundated = srtm.clip(BanVe).lte(ee.Number(level));
// calculate water level in each pixel
var water = inundated.multiply(dem).subtract(ee.Number(level)).multiply(-1)
// calculate area
var area = inundated.multiply(30).multiply(30);
// calculate volume
var volume = area.multiply(water);
// sum the volume
var totalvolume = volume.reduceRegion(ee.Reducer.sum(), BanVe);
// retunr result to list
return ee.List(list).add(totalvolume.get('elevation'));
};
7. Use the function below to run the function.
// create emtpy list var first = ee.List([]); // iterate over water levels var Volumes = ee.List(waterlevel.iterate(calcVolume, first));
8. Make an array with x-values for volume, y-values for water level.
// set x an y values for list var xValues = ee.Array(Volumes).divide(1000000000); var yValues = ee.Array(waterlevel);
9. Use the function below to create a chart.
// Create the chart
var chart = ui.Chart.array.values(yValues, 0, xValues)
.setOptions({
title: 'Relation Volume Waterlevel',
vAxis: {'title': 'water level (m)'},
hAxis: {'title': 'Volume (billion m3)'},
pointSize: 3,
});
10. Display the chart.
// Print the chart. print(chart);
Now we are going to display the inundated area using the DEM
11. Create a variable level with 200 (m).
// Set water level at 200 m
var level = 200;
// create a color table
var myWater = {min:0, max:1, palette:"0000FF"};
12. We select all pixels with a height less then the water level.
// select all pixels less than the water level var inundated = srtm.clip(BanVe).lte(ee.Number(level));
13. Visualize the inundated area.
// add srtm water mask Map.addLayer(inundated.updateMask(inundated),myWater ,'inundated from dem');
We like to include a sentinel-2 image for comparisons.
14. Use the snippets from the previous assignment to include a sentinel-2 water mask.
Now we save the DEM to the google drive.
15. add a fusion table of the Ca basin.
// the ca basin
var cabasin = ee.FeatureCollection('ft:1i9DzFa6iPLZ5i62qajSK_zvKV_gt1zEV_rPqad0k');
16. Add the ca basin to the canvas.
// Add Ca fusion table
Map.addLayer(cabasin,{},"The Ca basin")
17. add the srtm of Ca to the canvas.
// set viz parameters
var myviz = {min:0, max:2000, palette:"000000,0000FF,FDFF92,FF2700,FF00E7"};
// add srtm for Ca
Map.addLayer(srtm.clip(cabasin),myviz ,'srtm image');
18. In the geometry click add layer and draw a polygon around the Ca basin as shown below. Call the new layer CaMask

19. Export the map using this Mask. The image is saved to your google drive
//Export the image, specifying scale and region.
Export.image.toDrive({
image: srtm,
description: 'CaBasin',
scale: 500,
region: CaMask
});
Wow, this is exactly what I was looking for. Thanks a lot for sharing!!
LikeLike