Two different rainfall products

Step 1: select your area and import the data

// filter province
var Anuradhapura = table.filter(ee.Filter.eq("NAME_1","Anuradhapura")).geometry();

// import rainfall data
var gpm = ee.ImageCollection("NASA/GPM_L3/IMERG_V05").select("precipitationCal");
var chirps = ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY");

Step 2: Filter for period of interest

// select period of interest
gpm = gpm.filterDate("2017-11-01","2017-12-01");
chirps = chirps.filterDate("2017-11-01","2017-12-01");

Step 3: Calculate the total amount of rain for your period

var gpmSum = gpm.mean().multiply(24*30).clip(Anuradhapura)
var chirpsSum = chirps.sum().clip(Anuradhapura);

Step 4: Add the data to them map

print(gpm);
print(chirps);

Map.addLayer(gpmSum,{min:0,max:400,palette:"white,blue,darkblue,purple"},"gpm")
Map.addLayer(chirpsSum,{min:0,max:400,palette:"white,blue,darkblue,purple"},"chirps")

Step 5: calculate the mean rainfall for your aoi.

var meanGPM = gpmSum.reduceRegion({reducer:ee.Reducer.mean(),geometry:Anuradhapura,scale:25000,crs:"epsg:32644"});
print(meanGPM);
var meanCHIRPS = chirpsSum.reduceRegion({reducer:ee.Reducer.mean(),geometry:Anuradhapura,scale:10000,crs:"epsg:32644"});
print(meanCHIRPS);

 

Advertisements