-
Notifications
You must be signed in to change notification settings - Fork 16
/
SAR_Water_Detection
49 lines (39 loc) · 1.43 KB
/
SAR_Water_Detection
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Script showing how to use Sentinel-1 data and
// static thresholding for water detection
var hydrobasins = ee.FeatureCollection("WWF/HydroSHEDS/v1/Basins/hybas_7");
var basin = hydrobasins.filter(ee.Filter.eq('HYBAS_ID', 4071139640));
var geometry = basin.geometry();
Map.addLayer(basin, {color: 'grey'}, 'Arkavathy Sub Basin')
Map.centerObject(geometry, 12);
// Use Sentinel-1 ARD Pre-Processing
// See https://github.com/adugnag/gee_s1_ard/
var wrapper = require('users/adugnagirma/gee_s1_ard:wrapper');
var helper = require('users/adugnagirma/gee_s1_ard:utilities');
var parameters = {
// Input
START_DATE: '2019-01-01',
STOP_DATE: '2020-01-01',
POLARIZATION:'VVVH',
ORBIT : 'DESCENDING',
GEOMETRY: geometry,
// Speckle filter
APPLY_SPECKLE_FILTERING: true,
SPECKLE_FILTER_FRAMEWORK: 'MONO',
SPECKLE_FILTER: 'REFINED LEE',
// Output
FORMAT : 'DB',
CLIP_TO_ROI: true,
SAVE_ASSETS: false
};
// Preprocess the S1 collection
var output = wrapper.s1_preproc(parameters);
var s1 = output[0];
var s1_preprocess = output[1];
// Convert to DB and Add VV/VH ratio band
var speckleFiltered = s1_preprocess
.map(helper.lin_to_db);
// Mean is preferred for SAR data
var sarComposite = speckleFiltered.mean().select('VH');
var threshold = -25;
var sarWater = sarComposite.lt(threshold);
Map.addLayer(sarWater.clip(geometry).selfMask(), {min:0, max:1, palette: ['blue']}, 'Water')