-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprecipitation
31 lines (26 loc) · 1.15 KB
/
precipitation
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
/**** Start of imports. If edited, may not auto-convert in the playground. ****/
var imageCollection = ee.ImageCollection("NASA/GPM_L3/IMERG");
/***** End of imports. If edited, may not auto-convert in the playground. *****/
// function addPrecipitationLayer(dateStart, dateEnd)
// Parameters:
// string dateStart, indicating start of data range (e.g. '2017-03-01')
// string dateEnd, indicating end of datarange (e.g. '2017-03-27')
// Return values:
// like any good function, this function returns void and just has tons of side effects
HotMap.prototype.addPrecipitationLayer = function(s, e) {
if (!this.layerPrecipitation) {
if(s == null){
s = '2017-03-01';
e = '2017-03-27';
}
this.ic = ee.ImageCollection('UCSB-CHG/CHIRPS/PENTAD')
//.filterDate('2017-03-01', '2017-03-27');
.filterDate(s, e);
var meanPrecip = this.ic.reduce(ee.Reducer.mean());
this.layerPrecipitation = Map.addLayer(meanPrecip, {min:0,max:10, palette: ['FF0000', '0000FF']}, 'precipitation', true, 0.40);
}
}
HotMap.prototype.removePrecipitationLayer = function() {
Map.remove(this.layerPrecipitation);
this.layerPrecipitation = null;
}