You are on page 1of 2

// Define a point of interest as a landslide location.

var POI = ee.Geometry.Point(-77.040803, -10.619406); // Adjust the coordinate


Map.centerObject(POI, 9);

// Date when landslide occurs


var lsevent = new Date('2017-03-17'); // Adjust date period with landslide event
var start = new Date(lsevent.getTime() - 18*24*60*60*1000); // 18-days before
var end = new Date(lsevent.getTime() + 17*24*60*60*1000); // 17-day after
print(start);
print(end);

// Import NASA GPM IMERG 30 minute data.


var imerg = ee.ImageCollection('NASA/GPM_L3/IMERG_V06');
var imergHH = imerg.filterBounds(POI)
.filterDate(start, end)
.select('precipitationCal');

// Add rainfall accumulation into map


var precip = imergHH.select('precipitationCal').sum();

// Rainfall vis parameter


var palette = [
'000096','0064ff', '00b4ff', '33db80', '9beb4a',
'ffeb00', 'ffb300', 'ff6400', 'eb1e00', 'af0000'
];
var precipVis = {min: 0.0, max: 1000.0, palette: palette, opacity:0.5};

Map.addLayer(precip, precipVis, "10-days rainfall", false);


Map.addLayer(POI, {palette:"#ff0000"}, "Landlside location", true);

// Create a function that takes an image, calculates the mean over a geometry and
returns
// the value and the corresponding date as a feature.
var timeSeries = imergHH.map(function (image) {
var imergdate1 = image.date().format('yyyy-MM-dd-hh-mm');
var value = image
.clip(POI)
.reduceRegion({
reducer: ee.Reducer.mean(),
scale: 30
}).get('precipitationCal');
return ee.Feature(null, {value: value, date: imergdate1});
});

// Create a graph of the time-series.


var graphTS = ui.Chart.feature.byFeature(timeSeries,'date', ['value']);
print(graphTS.setChartType("LineChart")
.setOptions({title: 'NASA GPM IMERG 30-minute rainfall time-series',
vAxis: {title: 'Rainfall estimates (mm)'},
hAxis: {title: 'Date'}}));

// Export the result to Google Drive as a CSV.


Export.table.toDrive({
collection: timeSeries,
description:'Gorgor',
folder:'GEE',
selectors: 'date, value',
fileFormat: 'CSV'
});
// End of script

You might also like